]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-netlink: add sizes for some IP and Ethernet addresses
authorTopi Miettinen <toiwoton@gmail.com>
Sun, 10 Jul 2022 09:17:32 +0000 (12:17 +0300)
committerTopi Miettinen <topimiettinen@users.noreply.github.com>
Mon, 11 Jul 2022 18:37:38 +0000 (18:37 +0000)
Add sizes for some uses of NETLINK_TYPE_IN_ADDR and NETLINK_TYPE_ETHER_ADDR
types.

src/libsystemd/sd-netlink/netlink-types-genl.c
src/libsystemd/sd-netlink/netlink-types-rtnl.c

index bdd5700c6e2c32a6c794673cea5631e6ea8e10de..15becad30df96596401429b74548ca2da5ff45ad 100644 (file)
@@ -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 },
 };
index 167bbc5ccfc67d9d2e71a3ebcf2692d3ff9227d9..c98be6da54bc5f2aad691b36c4c121bdcd65a248 100644 (file)
@@ -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 },