[ 
https://issues.apache.org/jira/browse/NIFI-5445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16551362#comment-16551362
 ] 

ASF GitHub Bot commented on NIFI-5445:
--------------------------------------

GitHub user nicholasmhughes opened a pull request:

    https://github.com/apache/nifi/pull/2909

    NIFI-5445 changing property for listen processors to allow binding to…

    … an IP address instead of an interface
    
    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [ ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nicholasmhughes/nifi NIFI-5445

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2909.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2909
    
----
commit 90f7e13790e6a2f6b674c8de59cb9cf35a1a1833
Author: nicholasmhughes <nicholasmhughes@...>
Date:   2018-07-20T22:09:49Z

    NIFI-5445 changing property for listen processors to allow binding to an IP 
address instead of an interface

----


> 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)

Reply via email to