diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-11-24 03:16:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-26 14:50:05 -0500 |
commit | 4f5762ec9135d24887844549de3c83e0290a3567 (patch) | |
tree | 30f7273649576a5e251ab913e7a6d72c8a13564d /drivers/net/bonding | |
parent | d11ead75672d655652dbfc1b1a2c359e5b65536d (diff) |
bonding: Remove obsolete source file 'bond_ipv6.c'
This file is now unused and should have been removed by commit
7c89943236750537d26421d9bbb6f6575e2d1e1b ("bonding, ipv4, ipv6, vlan:
Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS").
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_ipv6.c | 223 |
1 files changed, 0 insertions, 223 deletions
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c deleted file mode 100644 index 7e6632221a75..000000000000 --- a/drivers/net/bonding/bond_ipv6.c +++ /dev/null | |||
@@ -1,223 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2008 Hewlett-Packard Development Company, L.P. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called LICENSE. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
25 | #include <linux/types.h> | ||
26 | #include <linux/if_vlan.h> | ||
27 | #include <net/ipv6.h> | ||
28 | #include <net/ndisc.h> | ||
29 | #include <net/addrconf.h> | ||
30 | #include <net/netns/generic.h> | ||
31 | #include "bonding.h" | ||
32 | |||
33 | /* | ||
34 | * Assign bond->master_ipv6 to the next IPv6 address in the list, or | ||
35 | * zero it out if there are none. | ||
36 | */ | ||
37 | static void bond_glean_dev_ipv6(struct net_device *dev, struct in6_addr *addr) | ||
38 | { | ||
39 | struct inet6_dev *idev; | ||
40 | |||
41 | if (!dev) | ||
42 | return; | ||
43 | |||
44 | idev = in6_dev_get(dev); | ||
45 | if (!idev) | ||
46 | return; | ||
47 | |||
48 | read_lock_bh(&idev->lock); | ||
49 | if (!list_empty(&idev->addr_list)) { | ||
50 | struct inet6_ifaddr *ifa | ||
51 | = list_first_entry(&idev->addr_list, | ||
52 | struct inet6_ifaddr, if_list); | ||
53 | *addr = ifa->addr; | ||
54 | } else | ||
55 | ipv6_addr_set(addr, 0, 0, 0, 0); | ||
56 | |||
57 | read_unlock_bh(&idev->lock); | ||
58 | |||
59 | in6_dev_put(idev); | ||
60 | } | ||
61 | |||
62 | static void bond_na_send(struct net_device *slave_dev, | ||
63 | struct in6_addr *daddr, | ||
64 | int router, | ||
65 | unsigned short vlan_id) | ||
66 | { | ||
67 | struct in6_addr mcaddr; | ||
68 | struct icmp6hdr icmp6h = { | ||
69 | .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT, | ||
70 | }; | ||
71 | struct sk_buff *skb; | ||
72 | |||
73 | icmp6h.icmp6_router = router; | ||
74 | icmp6h.icmp6_solicited = 0; | ||
75 | icmp6h.icmp6_override = 1; | ||
76 | |||
77 | addrconf_addr_solict_mult(daddr, &mcaddr); | ||
78 | |||
79 | pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n", | ||
80 | slave_dev->name, &mcaddr, daddr); | ||
81 | |||
82 | skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr, | ||
83 | ND_OPT_TARGET_LL_ADDR); | ||
84 | |||
85 | if (!skb) { | ||
86 | pr_err("NA packet allocation failed\n"); | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | if (vlan_id) { | ||
91 | /* The Ethernet header is not present yet, so it is | ||
92 | * too early to insert a VLAN tag. Force use of an | ||
93 | * out-of-line tag here and let dev_hard_start_xmit() | ||
94 | * insert it if the slave hardware can't. | ||
95 | */ | ||
96 | skb = __vlan_hwaccel_put_tag(skb, vlan_id); | ||
97 | if (!skb) { | ||
98 | pr_err("failed to insert VLAN tag\n"); | ||
99 | return; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | ndisc_send_skb(skb, slave_dev, NULL, &mcaddr, daddr, &icmp6h); | ||
104 | } | ||
105 | |||
106 | /* | ||
107 | * Kick out an unsolicited Neighbor Advertisement for an IPv6 address on | ||
108 | * the bonding master. This will help the switch learn our address | ||
109 | * if in active-backup mode. | ||
110 | * | ||
111 | * Caller must hold curr_slave_lock for read or better | ||
112 | */ | ||
113 | void bond_send_unsolicited_na(struct bonding *bond) | ||
114 | { | ||
115 | struct slave *slave = bond->curr_active_slave; | ||
116 | struct vlan_entry *vlan; | ||
117 | struct inet6_dev *idev; | ||
118 | int is_router; | ||
119 | |||
120 | pr_debug("%s: bond %s slave %s\n", bond->dev->name, | ||
121 | __func__, slave ? slave->dev->name : "NULL"); | ||
122 | |||
123 | if (!slave || !bond->send_unsol_na || | ||
124 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | ||
125 | return; | ||
126 | |||
127 | bond->send_unsol_na--; | ||
128 | |||
129 | idev = in6_dev_get(bond->dev); | ||
130 | if (!idev) | ||
131 | return; | ||
132 | |||
133 | is_router = !!idev->cnf.forwarding; | ||
134 | |||
135 | in6_dev_put(idev); | ||
136 | |||
137 | if (!ipv6_addr_any(&bond->master_ipv6)) | ||
138 | bond_na_send(slave->dev, &bond->master_ipv6, is_router, 0); | ||
139 | |||
140 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | ||
141 | if (!ipv6_addr_any(&vlan->vlan_ipv6)) { | ||
142 | bond_na_send(slave->dev, &vlan->vlan_ipv6, is_router, | ||
143 | vlan->vlan_id); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * bond_inet6addr_event: handle inet6addr notifier chain events. | ||
150 | * | ||
151 | * We keep track of device IPv6 addresses primarily to use as source | ||
152 | * addresses in NS probes. | ||
153 | * | ||
154 | * We track one IPv6 for the main device (if it has one). | ||
155 | */ | ||
156 | static int bond_inet6addr_event(struct notifier_block *this, | ||
157 | unsigned long event, | ||
158 | void *ptr) | ||
159 | { | ||
160 | struct inet6_ifaddr *ifa = ptr; | ||
161 | struct net_device *vlan_dev, *event_dev = ifa->idev->dev; | ||
162 | struct bonding *bond; | ||
163 | struct vlan_entry *vlan; | ||
164 | struct bond_net *bn = net_generic(dev_net(event_dev), bond_net_id); | ||
165 | |||
166 | list_for_each_entry(bond, &bn->dev_list, bond_list) { | ||
167 | if (bond->dev == event_dev) { | ||
168 | switch (event) { | ||
169 | case NETDEV_UP: | ||
170 | if (ipv6_addr_any(&bond->master_ipv6)) | ||
171 | bond->master_ipv6 = ifa->addr; | ||
172 | return NOTIFY_OK; | ||
173 | case NETDEV_DOWN: | ||
174 | if (ipv6_addr_equal(&bond->master_ipv6, | ||
175 | &ifa->addr)) | ||
176 | bond_glean_dev_ipv6(bond->dev, | ||
177 | &bond->master_ipv6); | ||
178 | return NOTIFY_OK; | ||
179 | default: | ||
180 | return NOTIFY_DONE; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | ||
185 | rcu_read_lock(); | ||
186 | vlan_dev = __vlan_find_dev_deep(bond->dev, | ||
187 | vlan->vlan_id); | ||
188 | rcu_read_unlock(); | ||
189 | if (vlan_dev == event_dev) { | ||
190 | switch (event) { | ||
191 | case NETDEV_UP: | ||
192 | if (ipv6_addr_any(&vlan->vlan_ipv6)) | ||
193 | vlan->vlan_ipv6 = ifa->addr; | ||
194 | return NOTIFY_OK; | ||
195 | case NETDEV_DOWN: | ||
196 | if (ipv6_addr_equal(&vlan->vlan_ipv6, | ||
197 | &ifa->addr)) | ||
198 | bond_glean_dev_ipv6(vlan_dev, | ||
199 | &vlan->vlan_ipv6); | ||
200 | return NOTIFY_OK; | ||
201 | default: | ||
202 | return NOTIFY_DONE; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | return NOTIFY_DONE; | ||
208 | } | ||
209 | |||
210 | static struct notifier_block bond_inet6addr_notifier = { | ||
211 | .notifier_call = bond_inet6addr_event, | ||
212 | }; | ||
213 | |||
214 | void bond_register_ipv6_notifier(void) | ||
215 | { | ||
216 | register_inet6addr_notifier(&bond_inet6addr_notifier); | ||
217 | } | ||
218 | |||
219 | void bond_unregister_ipv6_notifier(void) | ||
220 | { | ||
221 | unregister_inet6addr_notifier(&bond_inet6addr_notifier); | ||
222 | } | ||
223 | |||