From patchwork Mon Sep 7 22:04:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Davey X-Patchwork-Id: 1359311 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=alliedtelesis.co.nz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.a=rsa-sha256 header.s=mail181024 header.b=OCt8tCcF; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Blj4y042qz9sTK for ; Tue, 8 Sep 2020 08:05:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728158AbgIGWEZ (ORCPT ); Mon, 7 Sep 2020 18:04:25 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:45400 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbgIGWEU (ORCPT ); Mon, 7 Sep 2020 18:04:20 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id D73BD80719; Tue, 8 Sep 2020 10:04:14 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599516254; bh=TIK2ZarG+pHpksoKlt2pxfkQdePFZ8pjCPM1KihJnMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OCt8tCcFNZ/559HZmJQ4bXOzTRltxwe+p8Btq9rskFxCTcyXVxt5iC3yAdzwkvNSH x8zBp6DPdxx9kpZXMHQEih3CCjsp4Aj1hs99D4Tv6rMJCo5B+1OD7R17/T6dbPhe8V f+CiVpF0nRP6vM12heh9b03bq6ljl7OiXOxnumdEDlKoiqulEuIqIXb2aSSltd6ki8 uEtlh7JMiKKdIUo1X/NCUQ3caqlLtyBKCszB83BGPXGTpdfzfKrivITEMVAWwam//8 Rh13iCNpmfnIrtCaWjB/ABsw0an18SYj96ykRJpGhkMULjKKw3+vNQkaRmK4dpH0uq QV7ueBsoU5pDA== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Tue, 08 Sep 2020 10:04:14 +1200 Received: from pauld-dl.ws.atlnz.lc (pauld-dl.ws.atlnz.lc [10.33.23.16]) by smtp (Postfix) with ESMTP id C5F8413EED0; Tue, 8 Sep 2020 10:04:13 +1200 (NZST) Received: by pauld-dl.ws.atlnz.lc (Postfix, from userid 1684) id 7B0201E0978; Tue, 8 Sep 2020 10:04:14 +1200 (NZST) From: Paul Davey To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Davey Subject: [PATCH net-next v2 1/3] ipmr: Add route table ID to netlink cache reports Date: Tue, 8 Sep 2020 10:04:06 +1200 Message-Id: <20200907220408.32385-2-paul.davey@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907220408.32385-1-paul.davey@alliedtelesis.co.nz> References: <20200907220408.32385-1-paul.davey@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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); From patchwork Mon Sep 7 22:04:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Davey X-Patchwork-Id: 1359310 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=alliedtelesis.co.nz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.a=rsa-sha256 header.s=mail181024 header.b=emT8VmPS; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Blj4q49F7z9sSP for ; Tue, 8 Sep 2020 08:04:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727771AbgIGWEZ (ORCPT ); Mon, 7 Sep 2020 18:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728110AbgIGWEU (ORCPT ); Mon, 7 Sep 2020 18:04:20 -0400 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D355DC061575 for ; Mon, 7 Sep 2020 15:04:19 -0700 (PDT) Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id DFFF8891B0; Tue, 8 Sep 2020 10:04:14 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599516254; bh=t9kWVwdz3UiadOPYbUab6wnQhbmCb906FDfP3HnvERU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=emT8VmPSwjkWoVPlpkR32uaj6y6asl68EWpHtj5Z0Xew9nbL7F7MpLhU0khGvdJhQ ZFaYQlyv9RVwLwmrSyZGqpsalef2iRBXQXu8SeMX8UNbNTffXLqvgRtBJswu7Qi+Us eTmonRFXfv1fOdrrMz9jM8xFurLalb79wFJtYqFqnqfDnGFq999m82YdgMkLNWDUUW IyXBdW+tWpnbRDziW2bYdllDXbqGWL2DsGinhWtCA27mmg1ctCTCFTruH7En6wr1Fs sBoIna176ATZ4zhWepJzo4gyWzM/+Og8DqkB4AHwoJE/Lz2ghcboL8a4A3sf6Il+LV 8D6e6gGt7/Jgg== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Tue, 08 Sep 2020 10:04:14 +1200 Received: from pauld-dl.ws.atlnz.lc (pauld-dl.ws.atlnz.lc [10.33.23.16]) by smtp (Postfix) with ESMTP id CABCB13EEBA; Tue, 8 Sep 2020 10:04:13 +1200 (NZST) Received: by pauld-dl.ws.atlnz.lc (Postfix, from userid 1684) id 7EFC21E3851; Tue, 8 Sep 2020 10:04:14 +1200 (NZST) From: Paul Davey To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Davey Subject: [PATCH net-next v2 2/3] ipmr: Add high byte of VIF ID to igmpmsg Date: Tue, 8 Sep 2020 10:04:07 +1200 Message-Id: <20200907220408.32385-3-paul.davey@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907220408.32385-1-paul.davey@alliedtelesis.co.nz> References: <20200907220408.32385-1-paul.davey@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- include/uapi/linux/mroute.h | 4 ++-- net/ipv4/ipmr.c | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h index 918f1ef32ffe..1a42f5f9b31b 100644 --- a/include/uapi/linux/mroute.h +++ b/include/uapi/linux/mroute.h @@ -113,8 +113,8 @@ struct igmpmsg { __u32 unused1,unused2; unsigned char im_msgtype; /* What is this */ unsigned char im_mbz; /* Must be zero */ - unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ - unsigned char unused3; + unsigned char im_vif; /* Low 8 bits of Interface */ + unsigned char im_vif_hi; /* High 8 bits of Interface */ struct in_addr im_src,im_dst; }; diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 19b2f586319b..4809318f591b 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -1038,10 +1038,13 @@ static int ipmr_cache_report(struct mr_table *mrt, memcpy(msg, skb_network_header(pkt), sizeof(struct iphdr)); msg->im_msgtype = assert; msg->im_mbz = 0; - if (assert == IGMPMSG_WRVIFWHOLE) + if (assert == IGMPMSG_WRVIFWHOLE) { msg->im_vif = vifi; - else + msg->im_vif_hi = vifi >> 8; + } else { msg->im_vif = mrt->mroute_reg_vif_num; + msg->im_vif_hi = mrt->mroute_reg_vif_num >> 8; + } ip_hdr(skb)->ihl = sizeof(struct iphdr) >> 2; ip_hdr(skb)->tot_len = htons(ntohs(ip_hdr(pkt)->tot_len) + sizeof(struct iphdr)); @@ -1054,6 +1057,7 @@ static int ipmr_cache_report(struct mr_table *mrt, ip_hdr(skb)->protocol = 0; msg = (struct igmpmsg *)skb_network_header(skb); msg->im_vif = vifi; + msg->im_vif_hi = vifi >> 8; skb_dst_set(skb, dst_clone(skb_dst(pkt))); /* Add our header */ igmp = skb_put(skb, sizeof(struct igmphdr)); From patchwork Mon Sep 7 22:04:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Davey X-Patchwork-Id: 1359309 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=alliedtelesis.co.nz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.a=rsa-sha256 header.s=mail181024 header.b=DJz1EeaE; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Blj4Y0BtMz9sTW for ; Tue, 8 Sep 2020 08:04:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbgIGWEZ (ORCPT ); Mon, 7 Sep 2020 18:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728104AbgIGWEU (ORCPT ); Mon, 7 Sep 2020 18:04:20 -0400 Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF7D1C061756 for ; Mon, 7 Sep 2020 15:04:19 -0700 (PDT) Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id DBF1A84487; Tue, 8 Sep 2020 10:04:14 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599516254; bh=7JNB/ELAvKPdDOSBGNHPPqtpnOjczRJOS+hfHYsRwmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DJz1EeaEyq9ne4h7WBSgn4dvh6B4K9N9mozgld+pnJFExoMHenZNO0lz6TSr8+71h 3Lngoamx7HLmX6dAIxb5V+ErlFdJTpsJrii19W+GmerlfY5Rpr51MPkPtZ+HMW9+tg Kh+JxCxMS+8+1x+Hr0sBaFAeJy6lnJwBiS20DpyYKHE6WKdsWl9MTMIoBpjXREiQBL v1GhXCaC0PXhZxfhEQJvDKb0HbMyjulT+fR0GYdEA2RNWJbAevd7upcetDaK42xoXB KHeZP9d2lAaxDdz6D8oG8otkPjEPFv6JqWQ3nEHE8WsiK33I/qGQssh95SVIATD1vj nC6vAr0xhSxGg== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Tue, 08 Sep 2020 10:04:14 +1200 Received: from pauld-dl.ws.atlnz.lc (pauld-dl.ws.atlnz.lc [10.33.23.16]) by smtp (Postfix) with ESMTP id CD77913EF9B; Tue, 8 Sep 2020 10:04:13 +1200 (NZST) Received: by pauld-dl.ws.atlnz.lc (Postfix, from userid 1684) id 82EF91E0978; Tue, 8 Sep 2020 10:04:14 +1200 (NZST) From: Paul Davey To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Davey Subject: [PATCH net-next v2 3/3] ipmr: Use full VIF ID in netlink cache reports Date: Tue, 8 Sep 2020 10:04:08 +1200 Message-Id: <20200907220408.32385-4-paul.davey@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907220408.32385-1-paul.davey@alliedtelesis.co.nz> References: <20200907220408.32385-1-paul.davey@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Insert the full 16 bit VIF ID into ipmr Netlink cache reports. The VIF_ID attribute has 32 bits of space so can store the full VIF ID extracted from the high and low byte fields in the igmpmsg. Signed-off-by: Paul Davey --- net/ipv4/ipmr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 4809318f591b..939792a38814 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -2432,7 +2432,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, msg->im_vif | (msg->im_vif_hi << 8)) || nla_put_in_addr(skb, IPMRA_CREPORT_SRC_ADDR, msg->im_src.s_addr) || nla_put_in_addr(skb, IPMRA_CREPORT_DST_ADDR,