26 #include <linux/kernel.h>
27 #include <linux/net.h>
28 #include <linux/slab.h>
29 #include <linux/netdevice.h>
30 #include <linux/phonet.h>
32 #include <linux/if_arp.h>
70 bitmap_zero(pnd->addrs, 64);
73 list_add_rcu(&pnd->
list, &pndevs->
list);
95 list_for_each_entry_rcu(pnd, &pndevs->
list,
list) {
102 static void phonet_device_destroy(
struct net_device *dev)
110 pnd = __phonet_get(dev);
112 list_del_rcu(&pnd->
list);
131 list_for_each_entry_rcu(pnd, &pndevs->
list,
list) {
154 pnd = __phonet_get(dev);
156 pnd = __phonet_device_alloc(dev);
172 pnd = __phonet_get(dev);
176 }
else if (bitmap_empty(pnd->addrs, 64))
177 list_del_rcu(&pnd->
list);
195 pnd = __phonet_get_rcu(dev);
197 BUG_ON(bitmap_empty(pnd->addrs, 64));
200 if (
test_bit(daddr >> 2, pnd->addrs))
229 list_for_each_entry_rcu(pnd, &pndevs->
list,
list) {
231 if ((pnd->
netdev->reg_state != NETREG_REGISTERED) ||
235 if (
test_bit(addr >> 2, pnd->addrs)) {
246 static int phonet_device_autoconf(
struct net_device *dev)
264 req.ifr_phonet_autoconf.device);
268 static void phonet_route_autodel(
struct net_device *dev)
270 struct phonet_net *pnn = phonet_pernet(dev_net(dev));
275 bitmap_zero(deleted, 64);
277 for (i = 0; i < 64; i++)
278 if (dev == pnn->
routes.table[i]) {
284 if (bitmap_empty(deleted, 64))
302 phonet_device_autoconf(dev);
305 phonet_device_destroy(dev);
306 phonet_route_autodel(dev);
314 .notifier_call = phonet_device_notify,
326 INIT_LIST_HEAD(&pnn->
pndevs.list);
332 static void __net_exit phonet_exit_net(
struct net *net)
338 .init = phonet_init_net,
339 .exit = phonet_exit_net,
340 .id = &phonet_net_id,
369 struct phonet_net *pnn = phonet_pernet(dev_net(dev));
386 struct phonet_net *pnn = phonet_pernet(dev_net(dev));
391 if (dev == routes->
table[daddr])