Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] MAINTAINERS: Fix wrong include file path
From: Andrew Lunn @ 2018-09-29 19:57 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Andrew Lunn

Fix the patch for the mv88e6xxx.h header file in MAINTAINERS

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 15565de091af..12d1da4a9653 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8753,7 +8753,7 @@ M:	Vivien Didelot <vivien.didelot@savoirfairelinux.com>
 L:	netdev@vger.kernel.org
 S:	Maintained
 F:	drivers/net/dsa/mv88e6xxx/
-F:	linux/platform_data/mv88e6xxx.h
+F:	include/linux/platform_data/mv88e6xxx.h
 F:	Documentation/devicetree/bindings/net/dsa/marvell.txt
 
 MARVELL ARMADA DRM SUPPORT
-- 
2.19.0.rc1

^ permalink raw reply related

* Re: [PATCH net-next] net: caif: fix return type of ndo_start_xmit function
From: YueHaibing @ 2018-09-30  1:52 UTC (permalink / raw)
  To: David Miller; +Cc: dmitry.tarnyagin, linux-kernel, netdev
In-Reply-To: <20180929.113802.1016843680571572182.davem@davemloft.net>


On 2018/9/30 2:38, David Miller wrote:
> From: YueHaibing <yuehaibing@huawei.com>
> Date: Wed, 26 Sep 2018 17:27:05 +0800
> 
>> @@ -1014,7 +1014,7 @@ static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
>>  	int prio;
>>  
>>  	if (!dev)
>> -		return -EINVAL;
>> +		return NETDEV_TX_BUSY;
>>  
>>  	cfhsi = netdev_priv(dev);
>>  
> 
> Even though the return type of ndo_start_xmit is netdev_tx_t, negative error codes are
> still allowed I believe.

I missed this and do the wrong thing.

> 
> Look, reviewing these are pretty stressful for me, because you aren't documenting your
> changes and in many cases the transformations look incorrect.
> 

I'm really sorry for this.

> I'm tossing the rest of your changes in this area for now, sorry.
> 
> Please double check your work and resubmit this at some time in the not-too-near
> future.
> 
> Thank you.
> 
> .
> 

^ permalink raw reply

* [PATCH net] r8169: always autoneg on resume
From: Alex Xu (Hello71) @ 2018-09-30  1:18 UTC (permalink / raw)
  To: linux-netdev; +Cc: hkallweit1, nic_swsd, davem, linux-kernel

This affects at least versions 25 and 33, so assume all cards are broken
and just renegotiate by default.

Fixes: a2965f12fde6 ("r8169: remove rtl8169_set_speed_xmii")
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
---
 drivers/net/ethernet/realtek/r8169.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index ab30aaeac6d3..db2f347c1463 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4072,13 +4072,12 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 
 	genphy_soft_reset(dev->phydev);
 
-	/* It was reported that chip version 33 ends up with 10MBit/Half on a
+	/* It was reported that several chips end up with 10MBit/Half on a
 	 * 1GBit link after resuming from S3. For whatever reason the PHY on
-	 * this chip doesn't properly start a renegotiation when soft-reset.
+	 * these chips doesn't properly start a renegotiation when soft-reset.
 	 * Explicitly requesting a renegotiation fixes this.
 	 */
-	if (tp->mac_version == RTL_GIGA_MAC_VER_33 &&
-	    dev->phydev->autoneg == AUTONEG_ENABLE)
+	if (dev->phydev->autoneg == AUTONEG_ENABLE)
 		phy_restart_aneg(dev->phydev);
 }
 
-- 
2.19.0

^ permalink raw reply related

* Re: [PATCH] netlink: fix typo in nla_parse_nested() comment
From: David Miller @ 2018-09-29 18:49 UTC (permalink / raw)
  To: johannes; +Cc: netdev, johannes.berg
In-Reply-To: <20180926201942.5932-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Wed, 26 Sep 2018 22:19:42 +0200

> From: Johannes Berg <johannes.berg@intel.com>
> 
> Fix a simple typo: attribuets -> attributes
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Applied.

^ permalink raw reply

* Re: [PATCH] r8169: Disable clk during suspend / resume
From: David Miller @ 2018-09-29 18:49 UTC (permalink / raw)
  To: hdegoede; +Cc: nic_swsd, netdev
In-Reply-To: <20180926201239.28517-1-hdegoede@redhat.com>

From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 26 Sep 2018 22:12:39 +0200

> Disable the clk during suspend to save power. Note that tp->clk may be
> NULL, the clk core functions handle this without problems.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Carlo Caione <carlo@endlessm.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied.

^ permalink raw reply

* Re: [PATCH net 1/1] qlcnic: fix Tx descriptor corruption on 82xx devices
From: David Miller @ 2018-09-29 18:47 UTC (permalink / raw)
  To: shahed.shaikh; +Cc: netdev, Manish.Chopra, Dept-GELinuxNICDev
In-Reply-To: <20180926194110.28043-1-shahed.shaikh@cavium.com>

From: Shahed Shaikh <shahed.shaikh@cavium.com>
Date: Wed, 26 Sep 2018 12:41:10 -0700

> In regular NIC transmission flow, driver always configures MAC using
> Tx queue zero descriptor as a part of MAC learning flow.
> But with multi Tx queue supported NIC, regular transmission can occur on
> any non-zero Tx queue and from that context it uses
> Tx queue zero descriptor to configure MAC, at the same time TX queue
> zero could be used by another CPU for regular transmission
> which could lead to Tx queue zero descriptor corruption and cause FW
> abort.
> 
> This patch fixes this in such a way that driver always configures
> learned MAC address from the same Tx queue which is used for
> regular transmission.
> 
> Fixes: 7e2cf4feba05 ("qlcnic: change driver hardware interface mechanism")
> Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [net 1/1] tipc: fix failover problem
From: David Miller @ 2018-09-29 18:46 UTC (permalink / raw)
  To: jon.maloy
  Cc: netdev, gordan.mihaljevic, tung.q.nguyen, hoang.h.le, canh.d.luu,
	ying.xue, tipc-discussion
In-Reply-To: <1537988454-4210-1-git-send-email-jon.maloy@ericsson.com>

From: Jon Maloy <jon.maloy@ericsson.com>
Date: Wed, 26 Sep 2018 21:00:54 +0200

> From: LUU Duc Canh <canh.d.luu@dektech.com.au>
> 
> We see the following scenario:
> 1) Link endpoint B on node 1 discovers that its peer endpoint is gone.
>    Since there is a second working link, failover procedure is started.
> 2) Link endpoint A on node 1 sends a FAILOVER message to peer endpoint
>    A on node 2. The node item 1->2 goes to state FAILINGOVER.
> 3) Linke endpoint A/2 receives the failover, and is supposed to take
>    down its parallell link endpoint B/2, while producing a FAILOVER
>    message to send back to A/1.
> 4) However, B/2 has already been deleted, so no FAILOVER message can
>    created.
> 5) Node 1->2 remains in state FAILINGOVER forever, refusing to receive
>    any messages that can bring B/1 up again. We are left with a non-
>    redundant link between node 1 and 2.
> 
> We fix this with letting endpoint A/2 build a dummy FAILOVER message
> to send to back to A/1, so that the situation can be resolved.
> 
> Signed-off-by: LUU Duc Canh <canh.d.luu@dektech.com.au>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>

Applied.

^ permalink raw reply

* Re: [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops
From: David Miller @ 2018-09-29 18:44 UTC (permalink / raw)
  To: pkusunyifeng; +Cc: netdev
In-Reply-To: <1537987214-6414-1-git-send-email-pkusunyifeng@gmail.com>

From: Yifeng Sun <pkusunyifeng@gmail.com>
Date: Wed, 26 Sep 2018 11:40:14 -0700

> This patch fixes the bug that all datapath and vport ops are returning
> wrong values (OVS_FLOW_CMD_NEW or OVS_DP_CMD_NEW) in their replies.
> 
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] tls: Remove redundant vars from tls record structure
From: David Miller @ 2018-09-29 18:41 UTC (permalink / raw)
  To: vakul.garg; +Cc: netdev, borisp, aviadye, davejwatson, doronrk
In-Reply-To: <20180926105208.18515-1-vakul.garg@nxp.com>

From: Vakul Garg <vakul.garg@nxp.com>
Date: Wed, 26 Sep 2018 16:22:08 +0530

> Structure 'tls_rec' contains sg_aead_in and sg_aead_out which point
> to a aad_space and then chain scatterlists sg_plaintext_data,
> sg_encrypted_data respectively. Rather than using chained scatterlists
> for plaintext and encrypted data in aead_req, it is efficient to store
> aad_space in sg_encrypted_data and sg_plaintext_data itself in the
> first index and get rid of sg_aead_in, sg_aead_in and further chaining.
> 
> This requires increasing size of sg_encrypted_data & sg_plaintext_data
> arrarys by 1 to accommodate entry for aad_space. The code which uses
> sg_encrypted_data and sg_plaintext_data has been modified to skip first
> index as it points to aad_space.
> 
> Signed-off-by: Vakul Garg <vakul.garg@nxp.com>

Applied, thanks.

^ permalink raw reply

* linux-next: Signed-off-by missing for commits in the net tree
From: Stephen Rothwell @ 2018-09-30  1:04 UTC (permalink / raw)
  To: David Miller, Networking
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

Hi all,

Commits

  5f672090e44f ("qed: Fix shmem structure inconsistency between driver and the mfw.")
  ce7d17d6c607 ("MAINTAINERS: change bridge maintainers")

are missing a Signed-off-by from their committers.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: pull-request: ieee802154 for net 2018-09-28
From: David Miller @ 2018-09-29 18:30 UTC (permalink / raw)
  To: stefan; +Cc: linux-wpan, alex.aring, netdev
In-Reply-To: <20180928102043.25080-1-stefan@datenfreihafen.org>

From: Stefan Schmidt <stefan@datenfreihafen.org>
Date: Fri, 28 Sep 2018 12:20:42 +0200

> An update from ieee802154 for your *net* tree.
> 
> Some cleanup patches throughout the drivers from the Huawei tag team
> Yue Haibing and Zhong Jiang.
> Xue is replacing some magic numbers with defines in his mcr20a driver.

Applied, thanks.

^ permalink raw reply

* Re: [net-next 0/5] tipc: make connection setup more robust
From: David Miller @ 2018-09-29 18:25 UTC (permalink / raw)
  To: jon.maloy
  Cc: netdev, gordan.mihaljevic, tung.q.nguyen, hoang.h.le, canh.d.luu,
	ying.xue, tipc-discussion
In-Reply-To: <1538159002-11800-1-git-send-email-jon.maloy@ericsson.com>

From: Jon Maloy <jon.maloy@ericsson.com>
Date: Fri, 28 Sep 2018 20:23:17 +0200

> In this series we make a few improvements to the connection setup and
> probing mechanism, culminating in the last commit where we make it 
> possible for a client socket to make multiple setup attempts in case
> it encounters receive buffer overflow at the listener socket.

Series applied, thanks Jon.

^ permalink raw reply

* Re: [PATCH net-next v2] tcp: up initial rmem to 128KB and SYN rwin to around 64KB
From: David Miller @ 2018-09-29 18:23 UTC (permalink / raw)
  To: ycheng; +Cc: edumazet, netdev, ncardwell, weiwan, soheil
In-Reply-To: <20180928200902.62121-1-ycheng@google.com>

From: Yuchung Cheng <ycheng@google.com>
Date: Fri, 28 Sep 2018 13:09:02 -0700

> Previously TCP initial receive buffer is ~87KB by default and
> the initial receive window is ~29KB (20 MSS). This patch changes
> the two numbers to 128KB and ~64KB (rounding down to the multiples
> of MSS) respectively. The patch also simplifies the calculations s.t.
> the two numbers are directly controlled by sysctl tcp_rmem[1]:
> 
>   1) Initial receiver buffer budget (sk_rcvbuf): while this should
>      be configured via sysctl tcp_rmem[1], previously tcp_fixup_rcvbuf()
>      always override and set a larger size when a new connection
>      establishes.
> 
>   2) Initial receive window in SYN: previously it is set to 20
>      packets if MSS <= 1460. The number 20 was based on the initial
>      congestion window of 10: the receiver needs twice amount to
>      avoid being limited by the receive window upon out-of-order
>      delivery in the first window burst. But since this only
>      applies if the receiving MSS <= 1460, connection using large MTU
>      (e.g. to utilize receiver zero-copy) may be limited by the
>      receive window.
> 
> This patch also lowers the initial bytes expected to receive in
> the receiver buffer autotuning algorithm - otherwise the receiver
> may take two to three rounds to increase the buffer to the
> appropriate level (2x sender congestion window).
> 
> With this patch TCP memory configuration is more straight-forward and
> more properly sized to modern high-speed networks by default. Several
> popular stacks have been announcing 64KB rwin in SYNs as well.
> 
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Wei Wang <weiwan@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>

Applied, thanks.

^ permalink raw reply

* [PATCH iproute2-next 10/11] libnetlink: Rename rtnl_wilddump_* to rtnl_linkdump_*
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Rename rtnl_wilddump_req_filter to rtnl_linkdump_req_filter,
rtnl_wilddump_request to rtnl_linkdump_request and
rtnl_wilddump_req_filter_fn to rtnl_linkdump_req_filter_fn.

In all cases drop the type argument which at this point is only
RTM_GETLINK and hardcode in the functions.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 bridge/link.c        |  4 ++--
 bridge/vlan.c        |  2 +-
 include/libnetlink.h |  7 +++----
 ip/ipaddress.c       |  4 ++--
 ip/iptoken.c         |  2 +-
 ip/iptuntap.c        |  2 +-
 ip/rtmon.c           |  2 +-
 ip/tunnel.c          |  2 +-
 lib/libnetlink.c     | 12 ++++++------
 lib/ll_map.c         |  2 +-
 misc/ifstat.c        |  2 +-
 11 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/bridge/link.c b/bridge/link.c
index 8557026387d2..5d4f9b525cad 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -502,7 +502,7 @@ static int brlink_show(int argc, char **argv)
 	}
 
 	if (show_details) {
-		if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
+		if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
 					     (compress_vlans ?
 					      RTEXT_FILTER_BRVLAN_COMPRESSED :
 					      RTEXT_FILTER_BRVLAN)) < 0) {
@@ -510,7 +510,7 @@ static int brlink_show(int argc, char **argv)
 			exit(1);
 		}
 	} else {
-		if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETLINK) < 0) {
+		if (rtnl_linkdump_request(&rth, PF_BRIDGE) < 0) {
 			perror("Cannon send dump request");
 			exit(1);
 		}
diff --git a/bridge/vlan.c b/bridge/vlan.c
index bdce55ae4e14..59ed1964bcd2 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -575,7 +575,7 @@ static int vlan_show(int argc, char **argv)
 	new_json_obj(json);
 
 	if (!show_stats) {
-		if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
+		if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
 					     (compress_vlans ?
 					      RTEXT_FILTER_BRVLAN_COMPRESSED :
 					      RTEXT_FILTER_BRVLAN)) < 0) {
diff --git a/include/libnetlink.h b/include/libnetlink.h
index f22c92ac03dc..29eb906ec9eb 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -66,15 +66,14 @@ int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
 int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 
-int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
+int rtnl_linkdump_request(struct rtnl_handle *rth, int fam)
 	__attribute__((warn_unused_result));
-int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
-				    __u32 filt_mask)
+int rtnl_linkdump_req_filter(struct rtnl_handle *rth, int fam, __u32 filt_mask)
 	__attribute__((warn_unused_result));
 
 typedef int (*req_filter_fn_t)(struct nlmsghdr *nlh, int reqlen);
 
-int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int fam, int type,
+int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int fam,
 				req_filter_fn_t fn)
 	__attribute__((warn_unused_result));
 int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index f29480ce51d4..ffe1e1617cba 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1778,7 +1778,7 @@ static int iplink_filter_req(struct nlmsghdr *nlh, int reqlen)
 int ip_linkaddr_list(int family, req_filter_fn_t filter_fn,
 		     struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo)
 {
-	if (rtnl_wilddump_req_filter_fn(&rth, preferred_family, RTM_GETLINK,
+	if (rtnl_linkdump_req_filter_fn(&rth, preferred_family,
 					filter_fn) < 0) {
 		perror("Cannot send dump request");
 		return 1;
@@ -2031,7 +2031,7 @@ void ipaddr_get_vf_rate(int vfnum, int *min, int *max, const char *dev)
 		exit(1);
 	}
 
-	if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/ip/iptoken.c b/ip/iptoken.c
index fb64da4ec262..ce0051dfdf8a 100644
--- a/ip/iptoken.c
+++ b/ip/iptoken.c
@@ -109,7 +109,7 @@ static int iptoken_list(int argc, char **argv)
 		argc--; argv++;
 	}
 
-	if (rtnl_wilddump_request(&rth, af, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, af) < 0) {
 		perror("Cannot send dump request");
 		return -1;
 	}
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 58996e6c5733..8c84e6206fa9 100644
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -459,7 +459,7 @@ static int print_tuntap(const struct sockaddr_nl *who,
 
 static int do_show(int argc, char **argv)
 {
-	if (rtnl_wilddump_req_filter_fn(&rth, AF_UNSPEC, RTM_GETLINK,
+	if (rtnl_linkdump_req_filter_fn(&rth, AF_UNSPEC,
 					tuntap_filter_req) < 0) {
 		perror("Cannot send dump request\n");
 		return -1;
diff --git a/ip/rtmon.c b/ip/rtmon.c
index 0e795f740e62..86b4fe2e448d 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -163,7 +163,7 @@ main(int argc, char **argv)
 	if (rtnl_open(&rth, groups) < 0)
 		exit(1);
 
-	if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 79de7f2406f0..41ff1a686a9f 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -392,7 +392,7 @@ static int print_nlmsg_tunnel(const struct sockaddr_nl *who,
 
 int do_tunnels_list(struct tnl_print_nlmsg_info *info)
 {
-	if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(&rth, preferred_family) < 0) {
 		perror("Cannot send dump request\n");
 		return -1;
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 2dd14ac5ea58..bc72272be9c4 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -346,12 +346,12 @@ int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
-int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
+int rtnl_linkdump_request(struct rtnl_handle *rth, int family)
 {
-	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
+	return rtnl_linkdump_req_filter(rth, family, RTEXT_FILTER_VF);
 }
 
-int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
+int rtnl_linkdump_req_filter(struct rtnl_handle *rth, int family,
 			    __u32 filt_mask)
 {
 	struct {
@@ -362,7 +362,7 @@ int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
 		__u32 ext_filter_mask;
 	} req = {
 		.nlh.nlmsg_len = sizeof(req),
-		.nlh.nlmsg_type = type,
+		.nlh.nlmsg_type = RTM_GETLINK,
 		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
 		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
 		.ifm.ifi_family = family,
@@ -374,7 +374,7 @@ int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int family, int type,
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
-int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
+int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int family,
 				req_filter_fn_t filter_fn)
 {
 	struct {
@@ -383,7 +383,7 @@ int rtnl_wilddump_req_filter_fn(struct rtnl_handle *rth, int family, int type,
 		char buf[1024];
 	} req = {
 		.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
-		.nlh.nlmsg_type = type,
+		.nlh.nlmsg_type = RTM_GETLINK,
 		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
 		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
 		.ifm.ifi_family = family,
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 0afe68979283..4c3ed0d71913 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -218,7 +218,7 @@ void ll_init_map(struct rtnl_handle *rth)
 	if (initialized)
 		return;
 
-	if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
+	if (rtnl_linkdump_request(rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 50b906e86d5d..36eba605d5ba 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -214,7 +214,7 @@ static void load_info(void)
 			exit(1);
 		}
 	} else {
-		if (rtnl_wilddump_request(&rth, AF_INET, RTM_GETLINK) < 0) {
+		if (rtnl_linkdump_request(&rth, AF_INET) < 0) {
 			perror("Cannot send dump request");
 			exit(1);
 		}
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 11/11] libnetlink: Rename rtnl_wilddump_stats_req_filter to rtnl_statsdump_req_filter
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

rtnl_wilddump_stats_req_filter only takes RTM_GETSTATS as the type argument
so rename to rtnl_statsdump_req_filter for consistency with other request
functions and hardcode the type argument.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 bridge/vlan.c        | 8 ++------
 include/libnetlink.h | 3 +--
 ip/iplink.c          | 4 +---
 ip/iplink_xstats.c   | 4 +---
 lib/libnetlink.c     | 5 ++---
 misc/ifstat.c        | 4 ++--
 6 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/bridge/vlan.c b/bridge/vlan.c
index 59ed1964bcd2..239907bdad89 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -603,9 +603,7 @@ static int vlan_show(int argc, char **argv)
 		__u32 filt_mask;
 
 		filt_mask = IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_XSTATS);
-		if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC,
-						   RTM_GETSTATS,
-						   filt_mask) < 0) {
+		if (rtnl_statsdump_req_filter(&rth, AF_UNSPEC, filt_mask) < 0) {
 			perror("Cannont send dump request");
 			exit(1);
 		}
@@ -619,9 +617,7 @@ static int vlan_show(int argc, char **argv)
 		}
 
 		filt_mask = IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_XSTATS_SLAVE);
-		if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC,
-						   RTM_GETSTATS,
-						   filt_mask) < 0) {
+		if (rtnl_statsdump_req_filter(&rth, AF_UNSPEC, filt_mask) < 0) {
 			perror("Cannont send slave dump request");
 			exit(1);
 		}
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 29eb906ec9eb..8655e0b75c38 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -76,8 +76,7 @@ typedef int (*req_filter_fn_t)(struct nlmsghdr *nlh, int reqlen);
 int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int fam,
 				req_filter_fn_t fn)
 	__attribute__((warn_unused_result));
-int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
-				   __u32 filt_mask)
+int rtnl_statsdump_req_filter(struct rtnl_handle *rth, int fam, __u32 filt_mask)
 	__attribute__((warn_unused_result));
 int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
 			     int len)
diff --git a/ip/iplink.c b/ip/iplink.c
index d99c49ed244a..50ccb49a0263 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1601,9 +1601,7 @@ static int iplink_afstats(int argc, char **argv)
 		}
 	}
 
-	if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC,
-					   RTM_GETSTATS,
-					   filt_mask) < 0) {
+	if (rtnl_statsdump_req_filter(&rth, AF_UNSPEC, filt_mask) < 0) {
 		perror("Cannont send dump request");
 		return 1;
 	}
diff --git a/ip/iplink_xstats.c b/ip/iplink_xstats.c
index 10f953bc4584..908d9228369f 100644
--- a/ip/iplink_xstats.c
+++ b/ip/iplink_xstats.c
@@ -65,9 +65,7 @@ int iplink_ifla_xstats(int argc, char **argv)
 	else
 		filt_mask = IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_XSTATS);
 
-	if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC,
-					   RTM_GETSTATS,
-					   filt_mask) < 0) {
+	if (rtnl_statsdump_req_filter(&rth, AF_UNSPEC, filt_mask) < 0) {
 		perror("Cannont send dump request");
 		return -1;
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index bc72272be9c4..e12ce63bd05a 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -400,8 +400,7 @@ int rtnl_linkdump_req_filter_fn(struct rtnl_handle *rth, int family,
 	return send(rth->fd, &req, req.nlh.nlmsg_len, 0);
 }
 
-int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
-				   __u32 filt_mask)
+int rtnl_statsdump_req_filter(struct rtnl_handle *rth, int fam, __u32 filt_mask)
 {
 	struct {
 		struct nlmsghdr nlh;
@@ -410,7 +409,7 @@ int rtnl_wilddump_stats_req_filter(struct rtnl_handle *rth, int fam, int type,
 
 	memset(&req, 0, sizeof(req));
 	req.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct if_stats_msg));
-	req.nlh.nlmsg_type = type;
+	req.nlh.nlmsg_type = RTM_GETSTATS;
 	req.nlh.nlmsg_flags = NLM_F_DUMP|NLM_F_REQUEST;
 	req.nlh.nlmsg_pid = 0;
 	req.nlh.nlmsg_seq = rth->dump = ++rth->seq;
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 36eba605d5ba..f12c88f295c3 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -203,8 +203,8 @@ static void load_info(void)
 	if (is_extended) {
 		ll_init_map(&rth);
 		filter_mask = IFLA_STATS_FILTER_BIT(filter_type);
-		if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC, RTM_GETSTATS,
-						   filter_mask) < 0) {
+		if (rtnl_statsdump_req_filter(&rth, AF_UNSPEC,
+					      filter_mask) < 0) {
 			perror("Cannot send dump request");
 			exit(1);
 		}
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 09/11] libnetlink: Convert GETNSID dumps to use rtnl_nsiddump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_nsiddump_req for namespace id dumps using the proper rtgenmsg
as the header. Convert existing RTM_GETNSID dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 ip/ipnetns.c         |  2 +-
 lib/libnetlink.c     | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 5ccc421b4b0e..f22c92ac03dc 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -63,6 +63,8 @@ int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 
 int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
 	__attribute__((warn_unused_result));
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 368be0cbc0a4..e8500c773994 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -346,7 +346,7 @@ static int netns_list_id(int argc, char **argv)
 		return -ENOTSUP;
 	}
 
-	if (rtnl_wilddump_request(&rth, AF_UNSPEC, RTM_GETNSID) < 0) {
+	if (rtnl_nsiddump_req(&rth, AF_UNSPEC) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index c28047e4b055..2dd14ac5ea58 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -330,6 +330,22 @@ int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_nsiddump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct rtgenmsg rtm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETNSID,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.rtm.rtgen_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
 {
 	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 08/11] libnetlink: Convert GETNEIGHTBL dumps to use rtnl_neightbldump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_neightbldump_req for neighbor table dumps using the proper ndtmsg
as the header. Convert existing RTM_GETNEIGHTBL dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 ip/ipntable.c        |  2 +-
 lib/libnetlink.c     | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index e22ccbb82ce2..5ccc421b4b0e 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -57,6 +57,8 @@ int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_neighdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_neightbldump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
diff --git a/ip/ipntable.c b/ip/ipntable.c
index dd4f7c2ee6d9..ce3f4614e32b 100644
--- a/ip/ipntable.c
+++ b/ip/ipntable.c
@@ -658,7 +658,7 @@ static int ipntable_show(int argc, char **argv)
 		argc--; argv++;
 	}
 
-	if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETNEIGHTBL) < 0) {
+	if (rtnl_neightbldump_req(&rth, preferred_family) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index fd0f95a24194..c28047e4b055 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -282,6 +282,22 @@ int rtnl_neighdump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_neightbldump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct ndtmsg ndtmsg;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETNEIGHTBL,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.ndtmsg.ndtm_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 {
 	struct {
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 05/11] libnetlink: Convert GETNETCONF dumps to use rtnl_netconfdump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_netconfdump_req for netconf dumps using the proper netconfmsg
as the header. Convert existing RTM_GETNETCONF dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 ip/ipnetconf.c       |  3 +--
 lib/libnetlink.c     | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 8f2b2935074a..7e9ef640c704 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -55,6 +55,8 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 
 int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
 	__attribute__((warn_unused_result));
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 04c4d60807b1..21822e367e11 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -210,8 +210,7 @@ static int do_show(int argc, char **argv)
 	} else {
 		rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
 dump:
-		if (rtnl_wilddump_request(&rth, filter.family,
-					  RTM_GETNETCONF) < 0) {
+		if (rtnl_netconfdump_req(&rth, filter.family) < 0) {
 			perror("Cannot send dump request");
 			exit(1);
 		}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 51ea457cd31a..e5cb275faf09 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -265,6 +265,22 @@ int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct netconfmsg ncm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETNETCONF,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.ncm.ncm_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
 {
 	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 07/11] libnetlink: Convert GETNEIGH dumps to use rtnl_neighdump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_neighdump_req for neighbor dumps using the proper ndmsg
as the header. Convert existing rtnl_wilddump_request for RTM_GETNEIGH
to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 lib/libnetlink.c     | 16 ++++++++++++++++
 misc/arpd.c          |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 5f6bbe55fe4a..e22ccbb82ce2 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -55,6 +55,8 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_neighdump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 89e4d6a2a662..fd0f95a24194 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -266,6 +266,22 @@ int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_neighdump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct ndmsg ndm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETNEIGH,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.ndm.ndm_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 {
 	struct {
diff --git a/misc/arpd.c b/misc/arpd.c
index 67d86b67957b..ce7c09978c2b 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -424,7 +424,7 @@ static int do_one_request(struct nlmsghdr *n)
 
 static void load_initial_table(void)
 {
-	if (rtnl_wilddump_request(&rth, AF_INET, RTM_GETNEIGH) < 0) {
+	if (rtnl_neighdump_req(&rth, AF_INET) < 0) {
 		perror("dump request failed");
 		exit(1);
 	}
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 06/11] libnetlink: Convert GETRULE dumps to use rtnl_ruledump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_ruledump_req for fib fule dumps using the proper fib_rule_hdr
as the header. Convert existing RTM_GETRULE dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 ip/iprule.c          |  2 +-
 lib/libnetlink.c     | 17 +++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 7e9ef640c704..5f6bbe55fe4a 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -53,6 +53,8 @@ int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_netconfdump_req(struct rtnl_handle *rth, int family)
diff --git a/ip/iprule.c b/ip/iprule.c
index 744d6d88e343..60fd4c7e9f93 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -615,7 +615,7 @@ static int iprule_list_flush_or_save(int argc, char **argv, int action)
 		argc--; argv++;
 	}
 
-	if (rtnl_wilddump_request(&rth, af, RTM_GETRULE) < 0) {
+	if (rtnl_ruledump_req(&rth, af) < 0) {
 		perror("Cannot send dump request");
 		return 1;
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index e5cb275faf09..89e4d6a2a662 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/uio.h>
+#include <linux/fib_rules.h>
 #include <linux/if_addrlabel.h>
 #include <linux/if_bridge.h>
 
@@ -249,6 +250,22 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_ruledump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct fib_rule_hdr frh;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETRULE,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.frh.family = family
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
 {
 	struct {
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 03/11] libnetlink: Convert GETADDRLABEL dumps to use rtnl_addrlbldump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_addrlbldump_req for address label dumps using the proper
ifaddrlblmsg as the header. Convert existing RTM_GETADDRALBEL dumps
to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 ip/ipaddrlabel.c     |  4 ++--
 lib/libnetlink.c     | 17 +++++++++++++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index a60af316b505..bacaec8216f7 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -49,6 +49,8 @@ void rtnl_close(struct rtnl_handle *rth);
 
 int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 
diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c
index 2f79c56dcead..845fe4c5db27 100644
--- a/ip/ipaddrlabel.c
+++ b/ip/ipaddrlabel.c
@@ -118,7 +118,7 @@ static int ipaddrlabel_list(int argc, char **argv)
 		return -1;
 	}
 
-	if (rtnl_wilddump_request(&rth, af, RTM_GETADDRLABEL) < 0) {
+	if (rtnl_addrlbldump_req(&rth, af) < 0) {
 		perror("Cannot send dump request");
 		return 1;
 	}
@@ -237,7 +237,7 @@ static int ipaddrlabel_flush(int argc, char **argv)
 		return -1;
 	}
 
-	if (rtnl_wilddump_request(&rth, af, RTM_GETADDRLABEL) < 0) {
+	if (rtnl_addrlbldump_req(&rth, af) < 0) {
 		perror("Cannot send dump request");
 		return -1;
 	}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index fda5309ce44d..fb5f1714c2d8 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/uio.h>
+#include <linux/if_addrlabel.h>
 
 #include "libnetlink.h"
 
@@ -215,6 +216,22 @@ int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct ifaddrlblmsg ifal;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETADDRLABEL,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.ifal.ifal_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 {
 	struct {
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 01/11] libnetlink: Convert GETADDR dumps to use rtnl_addrdump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_addrdump_req for address dumps using the proper ifaddrmsg
as the header. Convert existing RTM_GETADDR dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  4 ++++
 ip/ipaddress.c       |  6 +++---
 lib/libnetlink.c     | 16 ++++++++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 9d9249e634dc..2d9f6190230c 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -46,6 +46,10 @@ int rtnl_open_byproto(struct rtnl_handle *rth, unsigned int subscriptions,
 	__attribute__((warn_unused_result));
 
 void rtnl_close(struct rtnl_handle *rth);
+
+int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
 	__attribute__((warn_unused_result));
 int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 8dc6c32fd6d9..f29480ce51d4 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1698,7 +1698,7 @@ static int ipaddr_flush(void)
 	filter.flushe = sizeof(flushb);
 
 	while ((max_flush_loops == 0) || (round < max_flush_loops)) {
-		if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
+		if (rtnl_addrdump_req(&rth, filter.family) < 0) {
 			perror("Cannot send dump request");
 			exit(1);
 		}
@@ -1790,7 +1790,7 @@ int ip_linkaddr_list(int family, req_filter_fn_t filter_fn,
 	}
 
 	if (ainfo) {
-		if (rtnl_wilddump_request(&rth, family, RTM_GETADDR) < 0) {
+		if (rtnl_addrdump_req(&rth, family) < 0) {
 			perror("Cannot send dump request");
 			return 1;
 		}
@@ -1915,7 +1915,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 		if (ipadd_save_prep())
 			exit(1);
 
-		if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETADDR) < 0) {
+		if (rtnl_addrdump_req(&rth, preferred_family) < 0) {
 			perror("Cannot send dump request");
 			exit(1);
 		}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index f18dceac2b5e..749cf4fbb88e 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -199,6 +199,22 @@ int rtnl_open(struct rtnl_handle *rth, unsigned int subscriptions)
 	return rtnl_open_byproto(rth, subscriptions, NETLINK_ROUTE);
 }
 
+int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct ifaddrmsg ifm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETADDR,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.ifm.ifa_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
 {
 	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 04/11] libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_mdbdump_req for mdb dumps using the proper br_port_msg as
the header. Convert existing RTM_GETMDB dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 bridge/mdb.c         |  2 +-
 include/libnetlink.h |  2 ++
 lib/libnetlink.c     | 17 +++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/bridge/mdb.c b/bridge/mdb.c
index 841a36123050..03fcc91f0219 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -293,7 +293,7 @@ static int mdb_show(int argc, char **argv)
 	new_json_obj(json);
 
 	/* get mdb entries*/
-	if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETMDB) < 0) {
+	if (rtnl_mdbdump_req(&rth, PF_BRIDGE) < 0) {
 		perror("Cannot send dump request");
 		return -1;
 	}
diff --git a/include/libnetlink.h b/include/libnetlink.h
index bacaec8216f7..8f2b2935074a 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -53,6 +53,8 @@ int rtnl_addrlbldump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
 int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 
 int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
 	__attribute__((warn_unused_result));
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index fb5f1714c2d8..51ea457cd31a 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -23,6 +23,7 @@
 #include <time.h>
 #include <sys/uio.h>
 #include <linux/if_addrlabel.h>
+#include <linux/if_bridge.h>
 
 #include "libnetlink.h"
 
@@ -248,6 +249,22 @@ int rtnl_routedump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_mdbdump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct br_port_msg bpm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETMDB,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.bpm.family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
 {
 	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 02/11] libnetlink: Convert GETROUTE dumps to use rtnl_routedump_req
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern
In-Reply-To: <20180929175931.18448-1-dsahern@kernel.org>

From: David Ahern <dsahern@gmail.com>

Add rtnl_routedump_req for route dumps using the proper rtmsg
as the header. Convert existing RTM_GETROUTE dumps to use it.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/libnetlink.h |  2 ++
 ip/ipmroute.c        |  2 +-
 ip/iproute.c         |  4 ++--
 lib/libnetlink.c     | 16 ++++++++++++++++
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 2d9f6190230c..a60af316b505 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -49,6 +49,8 @@ void rtnl_close(struct rtnl_handle *rth);
 
 int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
 	__attribute__((warn_unused_result));
+int rtnl_routedump_req(struct rtnl_handle *rth, int family)
+	__attribute__((warn_unused_result));
 
 int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
 	__attribute__((warn_unused_result));
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index bc23cfea7e8b..c5dfa9cb1538 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -283,7 +283,7 @@ static int mroute_list(int argc, char **argv)
 		filter.iif = idx;
 	}
 
-	if (rtnl_wilddump_request(&rth, filter.af, RTM_GETROUTE) < 0) {
+	if (rtnl_routedump_req(&rth, filter.af) < 0) {
 		perror("Cannot send dump request");
 		return 1;
 	}
diff --git a/ip/iproute.c b/ip/iproute.c
index 398322fd1f4f..699635923764 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -1645,7 +1645,7 @@ static int iproute_flush(int do_ipv6, rtnl_filter_t filter_fn)
 	filter.flushe = sizeof(flushb);
 
 	for (;;) {
-		if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) {
+		if (rtnl_routedump_req(&rth, do_ipv6) < 0) {
 			perror("Cannot send dump request");
 			return -2;
 		}
@@ -1891,7 +1891,7 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action)
 		return iproute_flush(do_ipv6, filter_fn);
 
 	if (!filter.cloned) {
-		if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) {
+		if (rtnl_routedump_req(&rth, do_ipv6) < 0) {
 			perror("Cannot send dump request");
 			return -2;
 		}
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 749cf4fbb88e..fda5309ce44d 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -215,6 +215,22 @@ int rtnl_addrdump_req(struct rtnl_handle *rth, int family)
 	return send(rth->fd, &req, sizeof(req), 0);
 }
 
+int rtnl_routedump_req(struct rtnl_handle *rth, int family)
+{
+	struct {
+		struct nlmsghdr nlh;
+		struct rtmsg rtm;
+	} req = {
+		.nlh.nlmsg_len = sizeof(req),
+		.nlh.nlmsg_type = RTM_GETROUTE,
+		.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
+		.nlh.nlmsg_seq = rth->dump = ++rth->seq,
+		.rtm.rtm_family = family,
+	};
+
+	return send(rth->fd, &req, sizeof(req), 0);
+}
+
 int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type)
 {
 	return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF);
-- 
2.11.0

^ permalink raw reply related

* [PATCH iproute2-next 00/11] Fix dump requests to use proper header for type
From: David Ahern @ 2018-09-29 17:59 UTC (permalink / raw)
  To: netdev; +Cc: stephen, christian, David Ahern

From: David Ahern <dsahern@gmail.com>

iproute2 currently uses ifinfomsg as the header for all dumps using the
wilddump headers. This is wrong as each message type actually has its own
header type. While the kernel has traditionally let it go as it for the
most part only uses the family entry, the use of kernel side filters is
increasing to alter what is returned on a request. The kernel side filters
really need to use the proper header type.

To that end, fix iproute2 to use the proper header struct for the GET type.

David Ahern (11):
  libnetlink: Convert GETADDR dumps to use rtnl_addrdump_req
  libnetlink: Convert GETROUTE dumps to use rtnl_routedump_req
  libnetlink: Convert GETADDRLABEL dumps to use rtnl_addrlbldump_req
  libnetlink: Convert GETMDB dumps to use rtnl_mdbdump_req
  libnetlink: Convert GETNETCONF dumps to use rtnl_netconfdump_req
  libnetlink: Convert GETRULE dumps to use rtnl_ruledump_req
  libnetlink: Convert GETNEIGH dumps to use rtnl_neighdump_req
  libnetlink: Convert GETNEIGHTBL dumps to use rtnl_neightbldump_req
  libnetlink: Convert GETNSID dumps to use rtnl_nsiddump_req
  libnetlink: Rename rtnl_wilddump_* to rtnl_linkdump_*
  libnetlink: Rename rtnl_wilddump_stats_req_filter to
    rtnl_statsdump_req_filter

 bridge/link.c        |   4 +-
 bridge/mdb.c         |   2 +-
 bridge/vlan.c        |  10 +---
 include/libnetlink.h |  30 ++++++++--
 ip/ipaddress.c       |  10 ++--
 ip/ipaddrlabel.c     |   4 +-
 ip/iplink.c          |   4 +-
 ip/iplink_xstats.c   |   4 +-
 ip/ipmroute.c        |   2 +-
 ip/ipnetconf.c       |   3 +-
 ip/ipnetns.c         |   2 +-
 ip/ipntable.c        |   2 +-
 ip/iproute.c         |   4 +-
 ip/iprule.c          |   2 +-
 ip/iptoken.c         |   2 +-
 ip/iptuntap.c        |   2 +-
 ip/rtmon.c           |   2 +-
 ip/tunnel.c          |   2 +-
 lib/libnetlink.c     | 164 ++++++++++++++++++++++++++++++++++++++++++++++++---
 lib/ll_map.c         |   2 +-
 misc/arpd.c          |   2 +-
 misc/ifstat.c        |   6 +-
 22 files changed, 210 insertions(+), 55 deletions(-)

-- 
2.11.0

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox