From: Topi Miettinen Date: Sun, 10 Jul 2022 09:17:32 +0000 (+0300) Subject: sd-netlink: add sizes for some IP and Ethernet addresses X-Git-Tag: v252-rc1~683 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3295d0d8962640ce3793b716bb9c1d0a9669f793;p=thirdparty%2Fsystemd.git sd-netlink: add sizes for some IP and Ethernet addresses Add sizes for some uses of NETLINK_TYPE_IN_ADDR and NETLINK_TYPE_ETHER_ADDR types. --- diff --git a/src/libsystemd/sd-netlink/netlink-types-genl.c b/src/libsystemd/sd-netlink/netlink-types-genl.c index bdd5700c6e2..15becad30df 100644 --- a/src/libsystemd/sd-netlink/netlink-types-genl.c +++ b/src/libsystemd/sd-netlink/netlink-types-genl.c @@ -116,10 +116,10 @@ static const NLType genl_fou_types[] = { [FOU_ATTR_IPPROTO] = { .type = NETLINK_TYPE_U8 }, [FOU_ATTR_TYPE] = { .type = NETLINK_TYPE_U8 }, [FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NETLINK_TYPE_FLAG }, - [FOU_ATTR_LOCAL_V4] = { .type = NETLINK_TYPE_IN_ADDR }, - [FOU_ATTR_PEER_V4] = { .type = NETLINK_TYPE_IN_ADDR }, - [FOU_ATTR_LOCAL_V6] = { .type = NETLINK_TYPE_IN_ADDR }, - [FOU_ATTR_PEER_V6] = { .type = NETLINK_TYPE_IN_ADDR }, + [FOU_ATTR_LOCAL_V4] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in_addr) }, + [FOU_ATTR_PEER_V4] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in_addr) }, + [FOU_ATTR_LOCAL_V6] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in6_addr) }, + [FOU_ATTR_PEER_V6] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in6_addr) }, [FOU_ATTR_PEER_PORT] = { .type = NETLINK_TYPE_U16 }, [FOU_ATTR_IFINDEX] = { .type = NETLINK_TYPE_U32 }, }; @@ -145,12 +145,12 @@ static const NLType genl_l2tp_types[] = { [L2TP_ATTR_LNS_MODE] = { .type = NETLINK_TYPE_U8 }, [L2TP_ATTR_USING_IPSEC] = { .type = NETLINK_TYPE_U8 }, [L2TP_ATTR_FD] = { .type = NETLINK_TYPE_U32 }, - [L2TP_ATTR_IP_SADDR] = { .type = NETLINK_TYPE_IN_ADDR }, - [L2TP_ATTR_IP_DADDR] = { .type = NETLINK_TYPE_IN_ADDR }, + [L2TP_ATTR_IP_SADDR] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in_addr) }, + [L2TP_ATTR_IP_DADDR] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in_addr) }, [L2TP_ATTR_UDP_SPORT] = { .type = NETLINK_TYPE_U16 }, [L2TP_ATTR_UDP_DPORT] = { .type = NETLINK_TYPE_U16 }, - [L2TP_ATTR_IP6_SADDR] = { .type = NETLINK_TYPE_IN_ADDR }, - [L2TP_ATTR_IP6_DADDR] = { .type = NETLINK_TYPE_IN_ADDR }, + [L2TP_ATTR_IP6_SADDR] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in6_addr) }, + [L2TP_ATTR_IP6_DADDR] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in6_addr) }, [L2TP_ATTR_UDP_ZERO_CSUM6_TX] = { .type = NETLINK_TYPE_FLAG }, [L2TP_ATTR_UDP_ZERO_CSUM6_RX] = { .type = NETLINK_TYPE_FLAG }, }; diff --git a/src/libsystemd/sd-netlink/netlink-types-rtnl.c b/src/libsystemd/sd-netlink/netlink-types-rtnl.c index 167bbc5ccfc..c98be6da54b 100644 --- a/src/libsystemd/sd-netlink/netlink-types-rtnl.c +++ b/src/libsystemd/sd-netlink/netlink-types-rtnl.c @@ -663,7 +663,7 @@ DEFINE_TYPE_SYSTEM(rtnl_bridge_cfm_mep_delete); static const NLType rtnl_bridge_cfm_mep_config_types[] = { [IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE] = { .type = NETLINK_TYPE_U32 }, - [IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC] = { .type = NETLINK_TYPE_ETHER_ADDR }, + [IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN }, [IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL] = { .type = NETLINK_TYPE_U32 }, [IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID] = { .type = NETLINK_TYPE_U32 }, }; @@ -695,7 +695,7 @@ DEFINE_TYPE_SYSTEM(rtnl_bridge_cfm_cc_rdi); static const NLType rtnl_bridge_cfm_cc_ccm_tx_types[] = { [IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE] = { .type = NETLINK_TYPE_U32 }, - [IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC] = { .type = NETLINK_TYPE_ETHER_ADDR }, + [IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC] = { .type = NETLINK_TYPE_ETHER_ADDR, .size = ETH_ALEN }, [IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE] = { .type = NETLINK_TYPE_U32 }, [IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD] = { .type = NETLINK_TYPE_U32 }, [IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV] = { .type = NETLINK_TYPE_U32 }, @@ -906,9 +906,9 @@ static const NLType rtnl_address_types[] = { [IFA_LOCAL] = { .type = NETLINK_TYPE_IN_ADDR }, [IFA_LABEL] = { .type = NETLINK_TYPE_STRING, .size = IFNAMSIZ - 1 }, [IFA_BROADCAST] = { .type = NETLINK_TYPE_IN_ADDR }, - [IFA_ANYCAST] = { .type = NETLINK_TYPE_IN_ADDR }, + [IFA_ANYCAST] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in6_addr) }, [IFA_CACHEINFO] = { .type = NETLINK_TYPE_CACHE_INFO, .size = sizeof(struct ifa_cacheinfo) }, - [IFA_MULTICAST] = { .type = NETLINK_TYPE_IN_ADDR }, + [IFA_MULTICAST] = { .type = NETLINK_TYPE_IN_ADDR, .size = sizeof(struct in6_addr) }, [IFA_FLAGS] = { .type = NETLINK_TYPE_U32 }, [IFA_RT_PRIORITY] = { .type = NETLINK_TYPE_U32 }, [IFA_TARGET_NETNSID] = { .type = NETLINK_TYPE_S32 },