br_mdb.c (ff0fd34eaee9978f9ed7f6e2ac47f9590d4afac3) br_mdb.c (2a26028d119267a2386733dd71d256f269e70f52)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/err.h>
3#include <linux/igmp.h>
4#include <linux/kernel.h>
5#include <linux/netdevice.h>
6#include <linux/rculist.h>
7#include <linux/skbuff.h>
8#include <linux/if_ether.h>

--- 303 unchanged lines hidden (view full) ---

312 if (entry->addr.proto == htons(ETH_P_IP))
313 ip_eth_mc_map(entry->addr.u.ip4, mdb.addr);
314#if IS_ENABLED(CONFIG_IPV6)
315 else
316 ipv6_eth_mc_map(&entry->addr.u.ip6, mdb.addr);
317#endif
318
319 mdb.obj.orig_dev = port_dev;
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/err.h>
3#include <linux/igmp.h>
4#include <linux/kernel.h>
5#include <linux/netdevice.h>
6#include <linux/rculist.h>
7#include <linux/skbuff.h>
8#include <linux/if_ether.h>

--- 303 unchanged lines hidden (view full) ---

312 if (entry->addr.proto == htons(ETH_P_IP))
313 ip_eth_mc_map(entry->addr.u.ip4, mdb.addr);
314#if IS_ENABLED(CONFIG_IPV6)
315 else
316 ipv6_eth_mc_map(&entry->addr.u.ip6, mdb.addr);
317#endif
318
319 mdb.obj.orig_dev = port_dev;
320 if (port_dev && type == RTM_NEWMDB) {
320 if (p && port_dev && type == RTM_NEWMDB) {
321 complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC);
322 if (complete_info) {
323 complete_info->port = p;
324 __mdb_entry_to_br_ip(entry, &complete_info->ip);
325 mdb.obj.complete_priv = complete_info;
326 mdb.obj.complete = br_mdb_complete;
327 if (switchdev_port_obj_add(port_dev, &mdb.obj))
328 kfree(complete_info);
329 }
321 complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC);
322 if (complete_info) {
323 complete_info->port = p;
324 __mdb_entry_to_br_ip(entry, &complete_info->ip);
325 mdb.obj.complete_priv = complete_info;
326 mdb.obj.complete = br_mdb_complete;
327 if (switchdev_port_obj_add(port_dev, &mdb.obj))
328 kfree(complete_info);
329 }
330 } else if (port_dev && type == RTM_DELMDB) {
330 } else if (p && port_dev && type == RTM_DELMDB) {
331 switchdev_port_obj_del(port_dev, &mdb.obj);
332 }
333
334 skb = nlmsg_new(rtnl_mdb_nlmsg_size(), GFP_ATOMIC);
335 if (!skb)
336 goto errout;
337
338 err = nlmsg_populate_mdb_fill(skb, dev, entry, 0, 0, type, NTF_SELF);

--- 9 unchanged lines hidden (view full) ---

348}
349
350void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
351 struct br_ip *group, int type, u8 flags)
352{
353 struct br_mdb_entry entry;
354
355 memset(&entry, 0, sizeof(entry));
331 switchdev_port_obj_del(port_dev, &mdb.obj);
332 }
333
334 skb = nlmsg_new(rtnl_mdb_nlmsg_size(), GFP_ATOMIC);
335 if (!skb)
336 goto errout;
337
338 err = nlmsg_populate_mdb_fill(skb, dev, entry, 0, 0, type, NTF_SELF);

--- 9 unchanged lines hidden (view full) ---

348}
349
350void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
351 struct br_ip *group, int type, u8 flags)
352{
353 struct br_mdb_entry entry;
354
355 memset(&entry, 0, sizeof(entry));
356 entry.ifindex = port->dev->ifindex;
356 if (port)
357 entry.ifindex = port->dev->ifindex;
358 else
359 entry.ifindex = dev->ifindex;
357 entry.addr.proto = group->proto;
358 entry.addr.u.ip4 = group->u.ip4;
359#if IS_ENABLED(CONFIG_IPV6)
360 entry.addr.u.ip6 = group->u.ip6;
361#endif
362 entry.vid = group->vid;
363 __mdb_entry_fill_flags(&entry, flags);
364 __br_mdb_notify(dev, port, &entry, type);

--- 363 unchanged lines hidden ---
360 entry.addr.proto = group->proto;
361 entry.addr.u.ip4 = group->u.ip4;
362#if IS_ENABLED(CONFIG_IPV6)
363 entry.addr.u.ip6 = group->u.ip6;
364#endif
365 entry.vid = group->vid;
366 __mdb_entry_fill_flags(&entry, flags);
367 __br_mdb_notify(dev, port, &entry, type);

--- 363 unchanged lines hidden ---