Nicholas Hughes created NIFI-5445:
-------------------------------------

             Summary: 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


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)

Reply via email to