summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bonding.h
diff options
context:
space:
mode:
authorWang Weidong <wangweidong1@huawei.com>2013-11-15 16:34:30 +0100
committerDavid S. Miller <davem@davemloft.net>2013-11-15 23:44:43 +0100
commitf9de11a165943a55e0fbda714caf60eaeb276a42 (patch)
tree794f837d6f53a0b096c8c31aa1f867a1ecf0edcb /drivers/net/bonding/bonding.h
parent6lowpan: Uncompression of traffic class field was incorrect (diff)
downloadlinux-f9de11a165943a55e0fbda714caf60eaeb276a42.tar.xz
linux-f9de11a165943a55e0fbda714caf60eaeb276a42.zip
bonding: add ip checks when store ip target
I met a Bug when I add ip target with the wrong ip address: echo +500.500.500.500 > /sys/class/net/bond0/bonding/arp_ip_target the wrong ip address will transfor to 245.245.245.244 and add to the ip target success, it is uncorrect, so I add checks to avoid adding wrong address. The in4_pton() will set wrong ip address to 0.0.0.0, it will return by the next check and will not add to ip target. v2 According Veaceslav's opinion, simplify the code. v3 According Veaceslav's opinion, add broadcast check and make a micro definition to package it. v4 Solve the problem of the format which David point out. Suggested-by: Veaceslav Falico <vfalico@redhat.com> Suggested-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bonding.h')
-rw-r--r--drivers/net/bonding/bonding.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 77a07a12e77f..ca31286aa028 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -63,6 +63,9 @@
(((mode) == BOND_MODE_TLB) || \
((mode) == BOND_MODE_ALB))
+#define IS_IP_TARGET_UNUSABLE_ADDRESS(a) \
+ ((htonl(INADDR_BROADCAST) == a) || \
+ ipv4_is_zeronet(a))
/*
* Less bad way to call ioctl from within the kernel; this needs to be
* done some other way to get the call out of interrupt context.