netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces
@ 2020-09-02  3:22 Paul Davey
  2020-09-02  3:22 ` [PATCH net-next 1/2] ipmr: Add route table ID to netlink cache reports Paul Davey
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paul Davey @ 2020-09-02  3:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, linux-kernel, Paul Davey

Currently it is not possible to use more than 255 multicast interfaces
for IPv4 due to the format of the igmpmsg header which only has 8 bits
available for the VIF ID.  There is enough space for the full VIF ID in
the Netlink cache notifications, however the value is currently taken
directly from the igmpmsg header and has thus already been truncated.

Using the full VIF ID in the Netlink notifications allows use of more
than 255 IPv4 multicast interfaces if the user space routing daemon
uses the Netlink notifications instead of the igmpmsg cache reports.

However doing this reveals a deficiency in the Netlink cache report
notifications, they lack any means for differentiating cache reports
relating to different multicast routing tables.  This is easily
resolved by adding the multicast route table ID to the cache reports.

Paul Davey (2):
  ipmr: Add route table ID to netlink cache reports
  ipmr: Use full VIF ID in netlink cache reports

 include/uapi/linux/mroute.h |  1 +
 net/ipv4/ipmr.c             | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] ipmr: Add route table ID to netlink cache reports
  2020-09-02  3:22 [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces Paul Davey
@ 2020-09-02  3:22 ` Paul Davey
  2020-09-02  3:22 ` [PATCH net-next 2/2] ipmr: Use full VIF ID in " Paul Davey
  2020-09-03 22:14 ` [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Davey @ 2020-09-02  3:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, linux-kernel, Paul Davey

Insert the multicast route table ID as a Netlink attribute to Netlink
cache report notifications.

When multiple route tables are in use it is necessary to have a way to
determine which route table a given cache report belongs to when
receiving the cache report.

Signed-off-by: Paul Davey <paul.davey@alliedtelesis.co.nz>
---
 include/uapi/linux/mroute.h | 1 +
 net/ipv4/ipmr.c             | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
index 11c8c1fc1124..918f1ef32ffe 100644
--- a/include/uapi/linux/mroute.h
+++ b/include/uapi/linux/mroute.h
@@ -169,6 +169,7 @@ enum {
 	IPMRA_CREPORT_SRC_ADDR,
 	IPMRA_CREPORT_DST_ADDR,
 	IPMRA_CREPORT_PKT,
+	IPMRA_CREPORT_TABLE,
 	__IPMRA_CREPORT_MAX
 };
 #define IPMRA_CREPORT_MAX (__IPMRA_CREPORT_MAX - 1)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 876fd6ff1ff9..19b2f586319b 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2396,6 +2396,7 @@ static size_t igmpmsg_netlink_msgsize(size_t payloadlen)
 		+ nla_total_size(4)	/* IPMRA_CREPORT_VIF_ID */
 		+ nla_total_size(4)	/* IPMRA_CREPORT_SRC_ADDR */
 		+ nla_total_size(4)	/* IPMRA_CREPORT_DST_ADDR */
+		+ nla_total_size(4)	/* IPMRA_CREPORT_TABLE */
 					/* IPMRA_CREPORT_PKT */
 		+ nla_total_size(payloadlen)
 		;
@@ -2431,7 +2432,8 @@ static void igmpmsg_netlink_event(struct mr_table *mrt, struct sk_buff *pkt)
 	    nla_put_in_addr(skb, IPMRA_CREPORT_SRC_ADDR,
 			    msg->im_src.s_addr) ||
 	    nla_put_in_addr(skb, IPMRA_CREPORT_DST_ADDR,
-			    msg->im_dst.s_addr))
+			    msg->im_dst.s_addr) ||
+	    nla_put_u32(skb, IPMRA_CREPORT_TABLE, mrt->id))
 		goto nla_put_failure;
 
 	nla = nla_reserve(skb, IPMRA_CREPORT_PKT, payloadlen);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] ipmr: Use full VIF ID in netlink cache reports
  2020-09-02  3:22 [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces Paul Davey
  2020-09-02  3:22 ` [PATCH net-next 1/2] ipmr: Add route table ID to netlink cache reports Paul Davey
@ 2020-09-02  3:22 ` Paul Davey
  2020-09-03 22:14 ` [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Davey @ 2020-09-02  3:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, linux-kernel, Paul Davey

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@alliedtelesis.co.nz>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces
  2020-09-02  3:22 [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces Paul Davey
  2020-09-02  3:22 ` [PATCH net-next 1/2] ipmr: Add route table ID to netlink cache reports Paul Davey
  2020-09-02  3:22 ` [PATCH net-next 2/2] ipmr: Use full VIF ID in " Paul Davey
@ 2020-09-03 22:14 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-09-03 22:14 UTC (permalink / raw)
  To: paul.davey; +Cc: netdev, linux-kernel

From: Paul Davey <paul.davey@alliedtelesis.co.nz>
Date: Wed,  2 Sep 2020 15:22:20 +1200

> Currently it is not possible to use more than 255 multicast interfaces
> for IPv4 due to the format of the igmpmsg header which only has 8 bits
> available for the VIF ID.  There is enough space for the full VIF ID in
> the Netlink cache notifications, however the value is currently taken
> directly from the igmpmsg header and has thus already been truncated.
> 
> Using the full VIF ID in the Netlink notifications allows use of more
> than 255 IPv4 multicast interfaces if the user space routing daemon
> uses the Netlink notifications instead of the igmpmsg cache reports.
> 
> However doing this reveals a deficiency in the Netlink cache report
> notifications, they lack any means for differentiating cache reports
> relating to different multicast routing tables.  This is easily
> resolved by adding the multicast route table ID to the cache reports.

But this means that mrouted has no way to see the full 16-bit value
via traditional igmpmsg UAPI interfaces.

Please instead make use of the unused3 member to store the high
order 16-bits of the vifi_t in the igmpmsg, and then code your
netlink changes around that.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-03 22:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02  3:22 [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces Paul Davey
2020-09-02  3:22 ` [PATCH net-next 1/2] ipmr: Add route table ID to netlink cache reports Paul Davey
2020-09-02  3:22 ` [PATCH net-next 2/2] ipmr: Use full VIF ID in " Paul Davey
2020-09-03 22:14 ` [PATCH net-next 0/2] Allow more than 255 IPv4 multicast interfaces David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).