Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipmr: Add high byte of VIF ID to igmpmsg

Use the unused3 byte in struct igmpmsg to hold the high 8 bits of the
VIF ID.

If using more than 255 IPv4 multicast interfaces it is necessary to have
access to a VIF ID for cache reports that is wider than 8 bits, the VIF
ID present in the igmpmsg reports sent to mroute_sk was only 8 bits wide
in the igmpmsg header. Adding the high 8 bits of the 16 bit VIF ID in
the unused byte allows use of more than 255 IPv4 multicast interfaces.

Signed-off-by: Paul Davey <paul.davey@alliedtelesis.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Paul Davey and committed by
David S. Miller
c8715a8e 501cb008

+8 -4
+2 -2
include/uapi/linux/mroute.h
··· 113 113 __u32 unused1,unused2; 114 114 unsigned char im_msgtype; /* What is this */ 115 115 unsigned char im_mbz; /* Must be zero */ 116 - unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ 117 - unsigned char unused3; 116 + unsigned char im_vif; /* Low 8 bits of Interface */ 117 + unsigned char im_vif_hi; /* High 8 bits of Interface */ 118 118 struct in_addr im_src,im_dst; 119 119 }; 120 120
+6 -2
net/ipv4/ipmr.c
··· 1038 1038 memcpy(msg, skb_network_header(pkt), sizeof(struct iphdr)); 1039 1039 msg->im_msgtype = assert; 1040 1040 msg->im_mbz = 0; 1041 - if (assert == IGMPMSG_WRVIFWHOLE) 1041 + if (assert == IGMPMSG_WRVIFWHOLE) { 1042 1042 msg->im_vif = vifi; 1043 - else 1043 + msg->im_vif_hi = vifi >> 8; 1044 + } else { 1044 1045 msg->im_vif = mrt->mroute_reg_vif_num; 1046 + msg->im_vif_hi = mrt->mroute_reg_vif_num >> 8; 1047 + } 1045 1048 ip_hdr(skb)->ihl = sizeof(struct iphdr) >> 2; 1046 1049 ip_hdr(skb)->tot_len = htons(ntohs(ip_hdr(pkt)->tot_len) + 1047 1050 sizeof(struct iphdr)); ··· 1057 1054 ip_hdr(skb)->protocol = 0; 1058 1055 msg = (struct igmpmsg *)skb_network_header(skb); 1059 1056 msg->im_vif = vifi; 1057 + msg->im_vif_hi = vifi >> 8; 1060 1058 skb_dst_set(skb, dst_clone(skb_dst(pkt))); 1061 1059 /* Add our header */ 1062 1060 igmp = skb_put(skb, sizeof(struct igmphdr));