]> git.baikalelectronics.ru Git - kernel.git/commit
bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls
authorLinus Lüssing <linus.luessing@c0d3.blue>
Mon, 21 Jan 2019 06:26:25 +0000 (07:26 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jan 2019 01:18:08 +0000 (17:18 -0800)
commit40a8efcec8afdb0c46ecf123a0560156e2aaed0d
tree9bcc70bdcaa5cb0b19a1c625c470e70571327d0e
parent595de95a5510cb6b2bf93a312a02c568127eac16
bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls

This patch refactors ip_mc_check_igmp(), ipv6_mc_check_mld() and
their callers (more precisely, the Linux bridge) to not rely on
the skb_trimmed parameter anymore.

An skb with its tail trimmed to the IP packet length was initially
introduced for the following three reasons:

1) To be able to verify the ICMPv6 checksum.
2) To be able to distinguish the version of an IGMP or MLD query.
   They are distinguishable only by their size.
3) To avoid parsing data for an IGMPv3 or MLDv2 report that is
   beyond the IP packet but still within the skb.

The first case still uses a cloned and potentially trimmed skb to
verfiy. However, there is no need to propagate it to the caller.
For the second and third case explicit IP packet length checks were
added.

This hopefully makes ip_mc_check_igmp() and ipv6_mc_check_mld() easier
to read and verfiy, as well as easier to use.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/igmp.h
include/linux/ip.h
include/linux/ipv6.h
include/net/addrconf.h
net/batman-adv/multicast.c
net/bridge/br_multicast.c
net/ipv4/igmp.c
net/ipv6/mcast_snoop.c