]> git.proxmox.com Git - ovs.git/commit
netdev: fix netmask in netdev_get_addrs
authorThadeu Lima de Souza Cascardo <cascardo@redhat.com>
Tue, 15 Nov 2016 09:49:45 +0000 (01:49 -0800)
committerPravin B Shelar <pshelar@ovn.org>
Tue, 15 Nov 2016 20:31:19 +0000 (12:31 -0800)
commit3f31aded6212b19f28026aa1a8f907c0f8e8777a
tree5b582291c3eff4f71fe6d0d930ddb30bb2a0db5d
parent858c2f7655c0480c9712e6dd92b1b104d4c2d38f
netdev: fix netmask in netdev_get_addrs

When iterating on getifaddrs result, ifa_netmask is dereferenced, but it's
already a pointer to struct sockaddr. This would result in wrong masks being
used when comparing addresses while calculating the source address given a
destination address at the routing code.

For example, the mask ::ffff:116.85.0.0 would be used, causing 172.16.100.0/24
to match 172.16.101.1, though they should not match.

This will not happen when using a dummy netdev, as netdev_get_addrs is not used
by it.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
lib/netdev.c