1e49132 nwfilter: fix IP address learning

Authored and Committed by berrange 6 years ago
    nwfilter: fix IP address learning
    
    In a previous commit:
    
      commit d4bf8f415074759baf051644559e04fe78888f8b
      Author: Daniel P. Berrangé <berrange@redhat.com>
      Date:   Wed Feb 14 09:43:59 2018 +0000
    
        nwfilter: handle missing switch enum cases
    
        Ensure all enum cases are listed in switch statements, or cast away
        enum type in places where we don't wish to cover all cases.
    
        Reviewed-by: John Ferlan <jferlan@redhat.com>
        Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
    
    we changed a switch in the nwfilter learning thread so that it had
    explict cases for all enum entries. Unfortunately the parameters in the
    method had been declared with incorrect type. The "howDetect" parameter
    does *not* accept "enum howDetect" values, rather it accepts a bitmask
    of "enum howDetect" values, so it should have been an "int" type.
    
    The caller always passes DETECT_STATIC|DETECT_DHCP, so essentially the
    IP addressing learning was completely broken by the above change, as it
    never matched any switch case, hitting the default leading to EINVAL.
    
    Stop using a typedef for the parameter name this this is a bitmask,
    not a plain enum value. Also stop using switch() since that's misleading
    with bitmasks too.
    
    Reviewed-by: John Ferlan <jferlan@redhat.com>
    Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>