linux/drivers/net
Andy Gospodarek eaddcd7690 bonding: remove entries for master_ip and vlan_ip and query devices instead
The following patch aimed to resolve an issue where secondary, tertiary,
etc. addresses added to bond interfaces could overwrite the
bond->master_ip and vlan_ip values.

        commit 917fbdb32f
        Author: Henrik Saavedra Persson <henrik.e.persson@ericsson.com>
        Date:   Wed Nov 23 23:37:15 2011 +0000

            bonding: only use primary address for ARP

That patch was good because it prevented bonds using ARP monitoring from
sending frames with an invalid source IP address.  Unfortunately, it
didn't always work as expected.

When using an ioctl (like ifconfig does) to set the IP address and
netmask, 2 separate ioctls are actually called to set the IP and netmask
if the mask chosen doesn't match the standard mask for that class of
address.  The first ioctl did not have a mask that matched the one in
the primary address and would still cause the device address to be
overwritten.  The second ioctl that was called to set the mask would
then detect as secondary and ignored, but the damage was already done.

This was not an issue when using an application that used netlink
sockets as the setting of IP and netmask came down at once.  The
inconsistent behavior between those two interfaces was something that
needed to be resolved.

While I was thinking about how I wanted to resolve this, Ralf Zeidler
came with a patch that resolved this on a RHEL kernel by keeping a full
shadow of the entries in dev->ifa_list for the bonding device and vlan
devices in the bonding driver.  I didn't like the duplication of the
list as I want to see the 'bonding' struct and code shrink rather than
grow, but liked the general idea.

As the Subject indicates this patch drops the master_ip and vlan_ip
elements from the 'bonding' and 'vlan_entry' structs, respectively.
This can be done because a device's address-list is now traversed to
determine the optimal source IP address for ARP requests and for checks
to see if the bonding device has a particular IP address.  This code
could have all be contained inside the bonding driver, but it made more
sense to me to EXPORT and call inet_confirm_addr since it did exactly
what was needed.

I tested this and a backported patch and everything works as expected.
Ralf also helped with verification of the backported patch.

Thanks to Ralf for all his help on this.

v2: Whitespace and organizational changes based on suggestions from Jay
Vosburgh and Dave Miller.

v3: Fixup incorrect usage of rcu_read_unlock based on Dave Miller's
suggestion.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
CC: Ralf Zeidler <ralf.zeidler@nsn.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-03-22 22:36:17 -04:00
..
appletalk
arcnet
bonding bonding: remove entries for master_ip and vlan_ip and query devices instead 2012-03-22 22:36:17 -04:00
caif Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-03-09 14:34:20 -08:00
can can: peak_usb: PCAN-USB specific part: fix little endian usage 2012-03-07 15:51:01 +01:00
cris
dsa
ethernet cnic: Fix parity error code conflict 2012-03-21 21:57:36 -04:00
fddi
hamradio
hippi
hyperv net/hyperv: Fix the code handling tx busy 2012-03-19 17:27:06 -04:00
irda net/irda: add clk_prepare/clk_unprepare to pxaficp_ir 2012-03-16 23:11:14 -07:00
phy Generialize powerpc's irq_host as irq_domain 2012-03-21 10:27:19 -07:00
plip
ppp ppp: Replace uses of <linux/if_ppp.h> with <linux/ppp-ioctl.h> 2012-03-04 20:41:38 -05:00
slip
team net: use eth_hw_addr_random() and reset addr_assign_type 2012-02-15 15:34:17 -05:00
tokenring
usb usbnet: don't clear urb->dev in tx_complete 2012-03-22 19:32:34 -04:00
vmxnet3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-03-05 21:16:26 -05:00
wan Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-03-20 21:04:47 -07:00
wimax wimax/i2400m: fix erroneous NETDEV_TX_BUSY use 2012-03-16 02:01:41 -07:00
wireless Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2012-03-20 21:12:50 -07:00
xen-netback
dummy.c net: use eth_hw_addr_random() and reset addr_assign_type 2012-02-15 15:34:17 -05:00
eql.c
ifb.c net: replace random_ether_addr() with eth_hw_addr_random() 2012-02-15 15:34:16 -05:00
Kconfig
LICENSE.SRC
loopback.c
macvlan.c net: use eth_hw_addr_random() and reset addr_assign_type 2012-02-15 15:34:17 -05:00
macvtap.c
Makefile
mdio.c ethtool, mdio, mii: Specify MDIO information fields in struct ethtool_cmd 2012-03-01 16:41:26 -05:00
mii.c ethtool, mdio, mii: Specify MDIO information fields in struct ethtool_cmd 2012-03-01 16:41:26 -05:00
netconsole.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-03-18 23:29:41 -04:00
veth.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2012-02-19 16:03:15 -05:00
virtio_net.c net: replace random_ether_addr() with eth_hw_addr_random() 2012-02-15 15:34:16 -05:00
xen-netfront.c