Fix 'ip addr show proto NAME'

- Add support for proto by name in ip addr show
 - Add missing static protos, needed for show

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-05-21 09:00:10 +02:00
parent f1e7fda956
commit 2f4cdd0d9c
3 changed files with 55 additions and 0 deletions
@@ -1,3 +1,7 @@
0 unspec
1 kernel_lo
2 kernel_ra
3 kernel_ll
4 static
5 dhcp
6 random
@@ -1,3 +1,20 @@
From 50fafdc63dc3d6152e2494cc693871e9bd04bfe5 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 5 Mar 2024 09:41:46 +0100
Subject: [PATCH 1/2] iplink_bridge: add mcast_flood_always bridge option
Organization: Addiva Elektronik
- Break out boolopt handling to simplify parsing and setting
- Add set/get support for mcast_flood_always
- Add get support for mst_enabled
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
include/uapi/linux/if_bridge.h | 1 +
ip/iplink_bridge.c | 75 +++++++++++++++++++++++++---------
man/man8/ip-link.8.in | 12 ++++++
3 files changed, 68 insertions(+), 20 deletions(-)
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index adb75f7d..611ab413 100644
--- a/include/uapi/linux/if_bridge.h
@@ -153,3 +170,6 @@ index 6764a9ad..8f77c5ad 100644
.BI mcast_snooping " MULTICAST_SNOOPING "
- turn multicast snooping on
.RI ( MULTICAST_SNOOPING " > 0) "
--
2.34.1
@@ -0,0 +1,31 @@
From 226a8b532fc074165ba76d71c4488629daed2625 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 20 May 2024 21:35:11 +0200
Subject: [PATCH 2/2] ipaddress: accept symbolic names also for show
Organization: Addiva Elektronik
This is a follow-up to 709063e, which in turn was a follow-up to
bdb8d85, to add support for 'ip addr show proto static', where
'static' is defined in /etc/iproute2/rt_addrprotos.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
ip/ipaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index e536912f..19900157 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -2217,7 +2217,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
__u8 proto;
NEXT_ARG();
- if (get_u8(&proto, *argv, 0))
+ if (rtnl_addrprot_a2n(&proto, *argv))
invarg("\"proto\" value is invalid\n", *argv);
filter.have_proto = true;
filter.proto = proto;
--
2.34.1