[PATCH net-next 2/2] ipmr: Use full VIF ID in netlink cache reports
From: Paul Davey
Date: Tue Sep 01 2020 - 23:22:42 EST
Insert the full 16 bit VIF ID into ipmr Netlink cache reports.
If using more than 255 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 are only 8
bits wide in the igmpmsg header. The VIF_ID attribute has 32 bits of
space however so can store the full VIF ID.
Signed-off-by: Paul Davey <paul.davey@xxxxxxxxxxxxxxxxxxx>
---
net/ipv4/ipmr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 19b2f586319b..26cd4ec450f4 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -104,7 +104,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
struct sk_buff *pkt, vifi_t vifi, int assert);
static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
int cmd);
-static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt);
+static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt, vifi_t vifi);
static void mroute_clean_tables(struct mr_table *mrt, int flags);
static void ipmr_expire_process(struct timer_list *t);
@@ -1072,7 +1072,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
return -EINVAL;
}
- igmpmsg_netlink_event(mrt, skb);
+ igmpmsg_netlink_event(mrt, skb, vifi);
/* Deliver to mrouted */
ret = sock_queue_rcv_skb(mroute_sk, skb);
@@ -2404,7 +2404,7 @@ static size_t igmpmsg_netlink_msgsize(size_t payloadlen)
return len;
}
-static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt)
+static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt, vifi_t vifi)
{
struct net *net = read_pnet(&mrt->net);
struct nlmsghdr *nlh;
@@ -2428,7 +2428,7 @@ static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt)
rtgenm = nlmsg_data(nlh);
rtgenm->rtgen_family = RTNL_FAMILY_IPMR;
if (nla_put_u8(skb, IPMRA_CREPORT_MSGTYPE, msg->im_msgtype) ||
- nla_put_u32(skb, IPMRA_CREPORT_VIF_ID, msg->im_vif) ||
+ nla_put_u32(skb, IPMRA_CREPORT_VIF_ID, vifi) ||
nla_put_in_addr(skb, IPMRA_CREPORT_SRC_ADDR,
msg->im_src.s_addr) ||
nla_put_in_addr(skb, IPMRA_CREPORT_DST_ADDR,
--
2.28.0