• Daniel Borkmann's avatar
    net, neigh: Fix NTF_EXT_LEARNED in combination with NTF_USE · e4400bbf
    Daniel Borkmann authored
    The NTF_EXT_LEARNED neigh flag is usually propagated back to user space
    upon dump of the neighbor table. However, when used in combination with
    NTF_USE flag this is not the case despite exempting the entry from the
    garbage collector. This results in inconsistent state since entries are
    typically marked in neigh->flags with NTF_EXT_LEARNED, but here they are
    not. Fix it by propagating the creation flag to ___neigh_create().
    
    Before fix:
    
      # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn
      # ./ip/ip n
      192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a REACHABLE
      [...]
    
    After fix:
    
      # ./ip/ip n replace 192.168.178.30 dev enp5s0 use extern_learn
      # ./ip/ip n
      192.168.178.30 dev enp5s0 lladdr f4:8c:50:5e:71:9a extern_learn REACHABLE
      [...]
    
    Fixes: 9ce33e46 ("neighbour: support for NTF_EXT_LEARNED flag")
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarRoopa Prabhu <roopa@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e4400bbf
neighbour.c 91.7 KB