From 058e82cb2f4896903358f03e4b895670906a91df Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 12 Sep 2024 10:12:21 -0700 Subject: [PATCH 1/9] replace use of term 'Sanity check' The term "sanity check" is on the Tier2 word list (should replace). See https://inclusivenaming.org/word-lists/tier-2/sanity-check/ Signed-off-by: Stephen Hemminger --- misc/arpd.c | 3 +-- tipc/node.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/misc/arpd.c b/misc/arpd.c index 3185620f..e77ef539 100644 --- a/misc/arpd.c +++ b/misc/arpd.c @@ -494,8 +494,7 @@ static void get_arp_pkt(void) if (ifnum && !handle_if(sll.sll_ifindex)) return; - /* Sanity checks */ - + /* Validate packet */ if (n < sizeof(*a) || (a->ar_op != htons(ARPOP_REQUEST) && a->ar_op != htons(ARPOP_REPLY)) || diff --git a/tipc/node.c b/tipc/node.c index e645d374..b84a3fa1 100644 --- a/tipc/node.c +++ b/tipc/node.c @@ -252,7 +252,7 @@ get_ops: /* Get master key indication */ opt_master = get_opt(opts, "master"); - /* Sanity check if wrong option */ + /* Validate node key */ if (opt_nodeid && opt_master) { fprintf(stderr, "error, per-node key cannot be master\n"); return -EINVAL; From c70ccb476dcb90e14a5a5b90541943082d0dc0c5 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 12 Sep 2024 10:17:58 -0700 Subject: [PATCH 2/9] man: replace use of word segregate The term segregate carries a lot of racist baggage in the US. It is on the Inclusive Naming word list. See: https://inclusivenaming.org/word-lists/tier-3/segregate/ Signed-off-by: Stephen Hemminger --- man/man8/ip-rule.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man8/ip-rule.8 b/man/man8/ip-rule.8 index d10b8b21..48f8222f 100644 --- a/man/man8/ip-rule.8 +++ b/man/man8/ip-rule.8 @@ -220,7 +220,7 @@ select the destination prefix to match. select the incoming device to match. If the interface is loopback, the rule only matches packets originating from this host. This means that you may create separate routing tables for forwarded and local -packets and, hence, completely segregate them. +packets and, hence, completely separate them. .TP .BI oif " NAME" From 9ced13212ceb05c1334c5bfc6a144c97a6a9b362 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 12 Sep 2024 10:20:17 -0700 Subject: [PATCH 3/9] man: replace use of term whitelist Avoid use of term whitelist because it propgates white == good assumptions. Not really neede on the man page. See: https://inclusivenaming.org/word-lists/tier-1/whitelist/ Signed-off-by: Stephen Hemminger --- man/man8/tc-ife.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man8/tc-ife.8 b/man/man8/tc-ife.8 index fd2df6c3..bca18d2b 100644 --- a/man/man8/tc-ife.8 +++ b/man/man8/tc-ife.8 @@ -120,8 +120,8 @@ Match with skb mark of 17: Configure the sending side to encode for the filters above. Use a destination IP address of 192.168.122.237/24, then tag with skb mark of decimal 17. Encode -the packaet with ethertype 0xdead, add skb->mark to whitelist of metadatum to -send, and rewrite the destination MAC address to 02:15:15:15:15:15. +the packet with ethertype 0xdead, add skb->mark to allowed list of meta +datum to send, and rewrite the destination MAC address to 02:15:15:15:15:15. .RS .EX From b19d4d6eef2f97e55d03eb7f1f2e528def72296d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 15 Sep 2024 12:42:26 -0700 Subject: [PATCH 4/9] v6.11.0 --- include/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/version.h b/include/version.h index 2390be48..b210af1e 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -static const char version[] = "6.10.0"; +static const char version[] = "6.11.0"; From 6a77abab92516e65f07f8657fc4e384c4541ce0e Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sun, 22 Sep 2024 16:50:10 +0200 Subject: [PATCH 5/9] bridge: mst: fix a musl build issue This patch fixes a compilation error raised by the bump to version 6.11.0 in Buildroot using musl as the C library for the cross-compilation toolchain. After setting the CFLGAS ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) IPROUTE2_CFLAGS += -D__UAPI_DEF_IN6_ADDR=0 -D__UAPI_DEF_SOCKADDR_IN6=0 \ -D__UAPI_DEF_IPV6_MREQ=0 endif to fix the following errors: In file included from ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/arpa/inet.h:9, from ../include/libnetlink.h:14, from mst.c:10: ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:23:8: error: redefinition of 'struct in6_addr' 23 | struct in6_addr { | ^~~~~~~~ In file included from ../include/uapi/linux/if_bridge.h:19, from mst.c:7: ../include/uapi/linux/in6.h:33:8: note: originally defined here 33 | struct in6_addr { | ^~~~~~~~ ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:34:8: error: redefinition of 'struct sockaddr_in6' 34 | struct sockaddr_in6 { | ^~~~~~~~~~~~ ../include/uapi/linux/in6.h:50:8: note: originally defined here 50 | struct sockaddr_in6 { | ^~~~~~~~~~~~ ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:42:8: error: redefinition of 'struct ipv6_mreq' 42 | struct ipv6_mreq { | ^~~~~~~~~ ../include/uapi/linux/in6.h:60:8: note: originally defined here 60 | struct ipv6_mreq { I got this further errors ../include/uapi/linux/in6.h:72:25: error: field 'flr_dst' has incomplete type 72 | struct in6_addr flr_dst; | ^~~~~~~ ../include/uapi/linux/if_bridge.h:711:41: error: field 'ip6' has incomplete type 711 | struct in6_addr ip6; | ^~~ fixed by including the netinet/in.h header. Signed-off-by: Dario Binacchi Signed-off-by: Stephen Hemminger --- bridge/mst.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge/mst.c b/bridge/mst.c index 873ca536..c8f7e660 100644 --- a/bridge/mst.c +++ b/bridge/mst.c @@ -4,6 +4,7 @@ */ #include +#include #include #include From 043ef90e2fa94397eb5c85330889ca4146a6d58a Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sun, 22 Sep 2024 16:50:11 +0200 Subject: [PATCH 6/9] bridge: mst: fix a further musl build issue This patch fixes the following build errors: In file included from mst.c:11: ../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration 80 | _PRINT_FUNC(tv, const struct timeval *) | ^~~~~~~ ../include/json_print.h:50:37: note: in definition of macro '_PRINT_FUNC' 50 | type value); \ | ^~~~ ../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration 80 | _PRINT_FUNC(tv, const struct timeval *) | ^~~~~~~ ../include/json_print.h:55:45: note: in definition of macro '_PRINT_FUNC' 55 | type value) \ | ^~~~ ../include/json_print.h: In function 'print_tv': ../include/json_print.h:58:48: error: passing argument 5 of 'print_color_tv' from incompatible pointer type [-Wincompatible-pointer-types] 58 | value); \ | ^~~~~ | | | const struct timeval * ../include/json_print.h:80:1: note: in expansion of macro '_PRINT_FUNC' 80 | _PRINT_FUNC(tv, const struct timeval *) | ^~~~~~~~~~~ ../include/json_print.h:50:42: note: expected 'const struct timeval *' but argument is of type 'const struct timeval *' 50 | type value); \ | ^ ../include/json_print.h:80:1: note: in expansion of macro '_PRINT_FUNC' 80 | _PRINT_FUNC(tv, const struct timeval *) Signed-off-by: Dario Binacchi Signed-off-by: Stephen Hemminger --- bridge/mst.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge/mst.c b/bridge/mst.c index c8f7e660..fccb7fd6 100644 --- a/bridge/mst.c +++ b/bridge/mst.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include From 9c9824bcaf092cb99988d59717674b73b5d0d19c Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Sat, 28 Sep 2024 11:03:11 +0200 Subject: [PATCH 7/9] arpd: use designated initializers for msghdr structure This patch fixes the following error: arpd.c:442:17: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion] 442 | NULL, 0, raised by Buildroot autobuilder [1]. In the case in question, the analysis of socket.h [2] containing the msghdr structure shows that it has been modified with the addition of padding fields, which cause the compilation error. The use of designated initializers allows the issue to be fixed. struct msghdr { void *msg_name; socklen_t msg_namelen; struct iovec *msg_iov; int __pad1; int msg_iovlen; int __pad1; void *msg_control; int __pad2; socklen_t msg_controllen; int __pad2; int msg_flags; }; [1] http://autobuild.buildroot.org/results/e4cdfa38ae9578992f1c0ff5c4edae3cc0836e3c/ [2] iproute2/host/mips64-buildroot-linux-musl/sysroot/usr/include/sys/socket.h Signed-off-by: Dario Binacchi Signed-off-by: Stephen Hemminger --- misc/arpd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/arpd.c b/misc/arpd.c index e77ef539..a42603f6 100644 --- a/misc/arpd.c +++ b/misc/arpd.c @@ -437,10 +437,10 @@ static void get_kern_msg(void) struct iovec iov; char buf[8192]; struct msghdr msg = { - (void *)&nladdr, sizeof(nladdr), - &iov, 1, - NULL, 0, - 0 + .msg_name = &nladdr, + .msg_namelen = sizeof(nladdr), + .msg_iov = &iov, + .msg_iovlen = 1, }; iov.iov_base = buf; From 57daf8ff8c6c357a5a083657e5b03d2883cbc4f9 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Wed, 18 Sep 2024 18:49:41 +0200 Subject: [PATCH 8/9] iplink: fix fd leak when playing with netns The command 'ip link set foo netns mynetns' opens a file descriptor to fill the netlink attribute IFLA_NET_NS_FD. This file descriptor is never closed. When batch mode is used, the number of file descriptor may grow greatly and reach the maximum file descriptor number that can be opened. This fd can be closed only after the netlink answer. Moreover, a second fd could be opened because some (struct link_util)->parse_opt() handlers call iplink_parse(). Let's add a helper to manage these fds: - open_fds_add() stores a fd, up to 5 (arbitrary choice, it seems enough); - open_fds_close() closes all stored fds. Fixes: 0dc34c7713bb ("iproute2: Add processless network namespace support") Reported-by: Alexandre Ferrieux Signed-off-by: Nicolas Dichtel Signed-off-by: Stephen Hemminger --- include/utils.h | 3 +++ ip/iplink.c | 6 +++++- lib/utils.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/utils.h b/include/utils.h index a2a98b9b..f044b340 100644 --- a/include/utils.h +++ b/include/utils.h @@ -395,4 +395,7 @@ const char *proto_n2a(unsigned short id, char *buf, int len, FILE *generic_proc_open(const char *env, const char *name); +int open_fds_add(int fd); +void open_fds_close(void); + #endif /* __UTILS_H__ */ diff --git a/ip/iplink.c b/ip/iplink.c index 3bc75d24..0dd83ff4 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -622,9 +622,11 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type) if (netns != -1) duparg("netns", *argv); netns = netns_get_fd(*argv); - if (netns >= 0) + if (netns >= 0) { + open_fds_add(netns); addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_FD, &netns, 4); + } else if (get_integer(&netns, *argv, 0) == 0) addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID, &netns, 4); @@ -1088,6 +1090,8 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) else ret = rtnl_talk(&rth, &req.n, NULL); + open_fds_close(); + if (ret) return -2; diff --git a/lib/utils.c b/lib/utils.c index deb7654a..98c06ab6 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -40,6 +40,9 @@ int timestamp_short; int pretty; const char *_SL_ = "\n"; +static int open_fds[5]; +static int open_fds_cnt; + static int af_byte_len(int af); static void print_time(char *buf, int len, __u32 time); static void print_time64(char *buf, int len, __s64 time); @@ -2017,3 +2020,23 @@ FILE *generic_proc_open(const char *env, const char *name) return fopen(p, "r"); } + +int open_fds_add(int fd) +{ + if (open_fds_cnt >= ARRAY_SIZE(open_fds)) + return -1; + + open_fds[open_fds_cnt++] = fd; + return 0; +} + + +void open_fds_close(void) +{ + int i; + + for (i = 0; i < open_fds_cnt; i++) + close(open_fds[i]); + + open_fds_cnt = 0; +} From b32ac38cc49d377715f28b58cbeeb4086cbb9f7b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 5 Oct 2024 09:05:28 -0700 Subject: [PATCH 9/9] uapi: update headers Current headers from 6.12-rc1 Signed-off-by: Stephen Hemminger --- include/uapi/linux/bpf.h | 18 +++++++++++--- include/uapi/linux/const.h | 17 +++++++++++++ include/uapi/linux/fib_rules.h | 1 + include/uapi/linux/libc-compat.h | 36 --------------------------- rdma/include/uapi/rdma/rdma_netlink.h | 16 ++++++++++++ vdpa/include/uapi/linux/vdpa.h | 1 + 6 files changed, 49 insertions(+), 40 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index a825d165..b9139231 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -5519,11 +5519,12 @@ union bpf_attr { * **-EOPNOTSUPP** if the hash calculation failed or **-EINVAL** if * invalid arguments are passed. * - * void *bpf_kptr_xchg(void *map_value, void *ptr) + * void *bpf_kptr_xchg(void *dst, void *ptr) * Description - * Exchange kptr at pointer *map_value* with *ptr*, and return the - * old value. *ptr* can be NULL, otherwise it must be a referenced - * pointer which will be released when this helper is called. + * Exchange kptr at pointer *dst* with *ptr*, and return the old value. + * *dst* can be map value or local kptr. *ptr* can be NULL, otherwise + * it must be a referenced pointer which will be released when this helper + * is called. * Return * The old value of kptr (which can be NULL). The returned pointer * if not NULL, is a reference which must be released using its @@ -7513,4 +7514,13 @@ struct bpf_iter_num { __u64 __opaque[1]; } __attribute__((aligned(8))); +/* + * Flags to control BPF kfunc behaviour. + * - BPF_F_PAD_ZEROS: Pad destination buffer with zeros. (See the respective + * helper documentation for details.) + */ +enum bpf_kfunc_flags { + BPF_F_PAD_ZEROS = (1ULL << 0), +}; + #endif /* __LINUX_BPF_H__ */ diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h index 1eb84b50..2122610d 100644 --- a/include/uapi/linux/const.h +++ b/include/uapi/linux/const.h @@ -28,6 +28,23 @@ #define _BITUL(x) (_UL(1) << (x)) #define _BITULL(x) (_ULL(1) << (x)) +#if !defined(__ASSEMBLY__) +/* + * Missing __asm__ support + * + * __BIT128() would not work in the __asm__ code, as it shifts an + * 'unsigned __init128' data type as direct representation of + * 128 bit constants is not supported in the gcc compiler, as + * they get silently truncated. + * + * TODO: Please revisit this implementation when gcc compiler + * starts representing 128 bit constants directly like long + * and unsigned long etc. Subsequently drop the comment for + * GENMASK_U128() which would then start supporting __asm__ code. + */ +#define _BIT128(x) ((unsigned __int128)(1) << (x)) +#endif + #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1) #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h index 232df14e..a6924dd3 100644 --- a/include/uapi/linux/fib_rules.h +++ b/include/uapi/linux/fib_rules.h @@ -67,6 +67,7 @@ enum { FRA_IP_PROTO, /* ip proto */ FRA_SPORT_RANGE, /* sport */ FRA_DPORT_RANGE, /* dport */ + FRA_DSCP, /* dscp */ __FRA_MAX }; diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index a1599911..e25cd3f4 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h @@ -140,25 +140,6 @@ #endif /* _NETINET_IN_H */ -/* Coordinate with glibc netipx/ipx.h header. */ -#if defined(__NETIPX_IPX_H) - -#define __UAPI_DEF_SOCKADDR_IPX 0 -#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 -#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 -#define __UAPI_DEF_IPX_CONFIG_DATA 0 -#define __UAPI_DEF_IPX_ROUTE_DEF 0 - -#else /* defined(__NETIPX_IPX_H) */ - -#define __UAPI_DEF_SOCKADDR_IPX 1 -#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 -#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 -#define __UAPI_DEF_IPX_CONFIG_DATA 1 -#define __UAPI_DEF_IPX_ROUTE_DEF 1 - -#endif /* defined(__NETIPX_IPX_H) */ - /* Definitions for xattr.h */ #if defined(_SYS_XATTR_H) #define __UAPI_DEF_XATTR 0 @@ -240,23 +221,6 @@ #define __UAPI_DEF_IP6_MTUINFO 1 #endif -/* Definitions for ipx.h */ -#ifndef __UAPI_DEF_SOCKADDR_IPX -#define __UAPI_DEF_SOCKADDR_IPX 1 -#endif -#ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION -#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 -#endif -#ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION -#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 -#endif -#ifndef __UAPI_DEF_IPX_CONFIG_DATA -#define __UAPI_DEF_IPX_CONFIG_DATA 1 -#endif -#ifndef __UAPI_DEF_IPX_ROUTE_DEF -#define __UAPI_DEF_IPX_ROUTE_DEF 1 -#endif - /* Definitions for xattr.h */ #ifndef __UAPI_DEF_XATTR #define __UAPI_DEF_XATTR 1 diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h index a6aadb1e..aaa78e93 100644 --- a/rdma/include/uapi/rdma/rdma_netlink.h +++ b/rdma/include/uapi/rdma/rdma_netlink.h @@ -15,6 +15,7 @@ enum { enum { RDMA_NL_GROUP_IWPM = 2, RDMA_NL_GROUP_LS, + RDMA_NL_GROUP_NOTIFY, RDMA_NL_NUM_GROUPS }; @@ -305,6 +306,8 @@ enum rdma_nldev_command { RDMA_NLDEV_CMD_DELDEV, + RDMA_NLDEV_CMD_MONITOR, + RDMA_NLDEV_NUM_OPS }; @@ -574,6 +577,9 @@ enum rdma_nldev_attr { RDMA_NLDEV_ATTR_NAME_ASSIGN_TYPE, /* u8 */ + RDMA_NLDEV_ATTR_EVENT_TYPE, /* u8 */ + + RDMA_NLDEV_SYS_ATTR_MONITOR_MODE, /* u8 */ /* * Always the end */ @@ -624,4 +630,14 @@ enum rdma_nl_name_assign_type { RDMA_NAME_ASSIGN_TYPE_USER = 1, /* Provided by user-space */ }; +/* + * Supported rdma monitoring event types. + */ +enum rdma_nl_notify_event_type { + RDMA_REGISTER_EVENT, + RDMA_UNREGISTER_EVENT, + RDMA_NETDEV_ATTACH_EVENT, + RDMA_NETDEV_DETACH_EVENT, +}; + #endif /* _RDMA_NETLINK_H */ diff --git a/vdpa/include/uapi/linux/vdpa.h b/vdpa/include/uapi/linux/vdpa.h index 265347b9..3983c07f 100644 --- a/vdpa/include/uapi/linux/vdpa.h +++ b/vdpa/include/uapi/linux/vdpa.h @@ -19,6 +19,7 @@ enum vdpa_command { VDPA_CMD_DEV_GET, /* can dump */ VDPA_CMD_DEV_CONFIG_GET, /* can dump */ VDPA_CMD_DEV_VSTATS_GET, + VDPA_CMD_DEV_ATTR_SET, }; enum vdpa_attr {