[
https://issues.apache.org/jira/browse/NIFI-5445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16566698#comment-16566698
]
ASF GitHub Bot commented on NIFI-5445:
--------------------------------------
Github user nicholasmhughes commented on the issue:
https://github.com/apache/nifi/pull/2909
@markap14 Understood. I figured a complete property change would get shot
down, and I didn't even think about the implications in a cluster. However, the
main problem is that virtual interfaces (e.g. eth0:1) aren't able to be
specified in the existing parameter due to issues I listed in the Jira ticket.
Do you know of a way to overcome this barrier?
> ListenTCP does not allow binding to subinterfaces
> -------------------------------------------------
>
> Key: NIFI-5445
> URL: https://issues.apache.org/jira/browse/NIFI-5445
> Project: Apache NiFi
> Issue Type: Bug
> Reporter: Nicholas Hughes
> Priority: Minor
>
> While attempting to bind ListenTCP to a certain interface, it was discovered
> that it does not support subinterfaces (virtual interfaces) while validating
> the contents of the "Local Network Interface" property. I traced it back to
> the ListenerProperties class [1], which uses
> "NetworkInterface.getNetworkInterfaces()" to pull a list of interfaces. This
> method does not include subinterfaces, so further iteration using the
> "getSubInterfaces()" method [2] on each interface would be required to fully
> populate the list.
> However, IP addresses are not found on the subinterfaces when using
> "getInetAddresses()" on each interface. Instead, they can be found in the
> enumeration returned by the parent interface. Further (needlessly complex)
> logic would be required to determine which IP address is being requested when
> specifying a virtual interface.
> In a scenario where someone has assigned a virtual interface on a host and
> entered the parent interface into the "Local Network Interface" property for
> ListenTCP, the code will find multiple IP addresses for that parent
> interface... but only select the first one in the list. [3] I'm uncertain as
> to how the IP addresses are ordered in the returned enumeration, but I
> suspect that unpredictable outcomes would result based upon that ordering.
> Since this logic resides in the abstract class, multiple Listen processors
> are affected.
>
> [1]
> [https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/listen/ListenerProperties.java#L41]
> [2]
> [https://docs.oracle.com/javase/8/docs/api/java/net/NetworkInterface.html#getSubInterfaces--]
> [3]
> [https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/listen/AbstractListenEventProcessor.java#L189]
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)