diff --git a/src/core/nm-firewall-utils.c b/src/core/nm-firewall-utils.c index ac12d3e432..45dab09308 100644 --- a/src/core/nm-firewall-utils.c +++ b/src/core/nm-firewall-utils.c @@ -74,7 +74,7 @@ _nft_ifname_valid(const char *str) return NULL; } } - if (i >= NMP_IFNAMSIZ) + if (i >= NM_IFNAMSIZ) return NULL; return str; @@ -154,10 +154,10 @@ _share_iptables_get_name(gboolean is_iptables_chain, const char *prefix, const c nm_str_buf_append(&strbuf, prefix); ip_iface_len = strlen(ip_iface); - G_STATIC_ASSERT_EXPR(NMP_IFNAMSIZ == 16); - if (ip_iface_len >= NMP_IFNAMSIZ) { + G_STATIC_ASSERT_EXPR(NM_IFNAMSIZ == 16); + if (ip_iface_len >= NM_IFNAMSIZ) { nm_assert_not_reached(); - ip_iface_len = NMP_IFNAMSIZ - 1; + ip_iface_len = NM_IFNAMSIZ - 1; } if (NM_STRCHAR_ALL(ip_iface, diff --git a/src/core/nm-test-utils-core.h b/src/core/nm-test-utils-core.h index e341d62f13..176f432059 100644 --- a/src/core/nm-test-utils-core.h +++ b/src/core/nm-test-utils-core.h @@ -49,8 +49,8 @@ nmtst_platform_ip4_address_full(const char *address, { NMPlatformIP4Address *addr = nmtst_platform_ip4_address(address, peer_address, plen); - G_STATIC_ASSERT(NMP_IFNAMSIZ == sizeof(addr->label)); - g_assert(!label || strlen(label) < NMP_IFNAMSIZ); + G_STATIC_ASSERT(NM_IFNAMSIZ == sizeof(addr->label)); + g_assert(!label || strlen(label) < NM_IFNAMSIZ); addr->ifindex = ifindex; addr->addr_source = source; diff --git a/src/core/supplicant/nm-supplicant-manager.c b/src/core/supplicant/nm-supplicant-manager.c index f6927500dd..3b805693aa 100644 --- a/src/core/supplicant/nm-supplicant-manager.c +++ b/src/core/supplicant/nm-supplicant-manager.c @@ -447,7 +447,7 @@ _create_iface_dbus_call_get_interface_cb(GObject *source, GAsyncResult *result, nm_assert(handle->name_owner == priv->name_owner); if (!res) { - char ifname[NMP_IFNAMSIZ]; + char ifname[NM_IFNAMSIZ]; if (handle->create_iface_try_count < CREATE_IFACE_TRY_COUNT_MAX && nm_dbus_error_is(error, NM_WPAS_ERROR_UNKNOWN_IFACE) @@ -489,7 +489,7 @@ _create_iface_dbus_call_create_interface_cb(GObject *source, gs_unref_variant GVariant *res = NULL; gs_free_error GError *error = NULL; const char *iface_path_str; - char ifname[NMP_IFNAMSIZ]; + char ifname[NM_IFNAMSIZ]; res = g_dbus_connection_call_finish(dbus_connection, result, &error); @@ -619,7 +619,7 @@ static void _create_iface_dbus_start(NMSupplicantManager *self, NMSupplMgrCreateIfaceHandle *handle) { NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE(self); - char ifname[NMP_IFNAMSIZ]; + char ifname[NM_IFNAMSIZ]; nm_assert(priv->name_owner); nm_assert(!handle->cancellable); diff --git a/src/libnm-core-impl/nm-setting-infiniband.c b/src/libnm-core-impl/nm-setting-infiniband.c index 605def1fcd..1761d5413e 100644 --- a/src/libnm-core-impl/nm-setting-infiniband.c +++ b/src/libnm-core-impl/nm-setting-infiniband.c @@ -151,8 +151,8 @@ nm_setting_infiniband_create_virtual_interface_name(const char *parent, int p_ke char *s; s = g_strdup_printf("%s.%04x", parent, (guint) p_key); - if (strlen(s) >= NMP_IFNAMSIZ) - s[NMP_IFNAMSIZ - 1] = '\0'; + if (strlen(s) >= NM_IFNAMSIZ) + s[NM_IFNAMSIZ - 1] = '\0'; return s; } diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index d987287c74..8480ef1ca3 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -181,7 +181,7 @@ typedef union { struct _NMPlatformLink { __NMPlatformObjWithIfindex_COMMON; - char name[NMP_IFNAMSIZ]; + char name[NM_IFNAMSIZ]; NMLinkType type; /* rtnl_link_get_type(), IFLA_INFO_KIND. */ @@ -545,8 +545,8 @@ typedef struct { NMFibRuleUidRange uid_range; /* FRA_UID_RANGE */ NMFibRulePortRange sport_range; /* FRA_SPORT_RANGE */ NMFibRulePortRange dport_range; /* FRA_DPORT_RANGE */ - char iifname[NMP_IFNAMSIZ]; /* FRA_IIFNAME */ - char oifname[NMP_IFNAMSIZ]; /* FRA_OIFNAME */ + char iifname[NM_IFNAMSIZ]; /* FRA_IIFNAME */ + char oifname[NM_IFNAMSIZ]; /* FRA_OIFNAME */ guint8 addr_family; /* (struct fib_rule_hdr).family */ guint8 action; /* (struct fib_rule_hdr).action */ guint8 tos; /* (struct fib_rule_hdr).tos */ @@ -1534,23 +1534,23 @@ const char *nm_link_type_to_string(NMLinkType link_type); #define NMP_SYSCTL_PATHID_ABSOLUTE(path) ((const char *) NULL), -1, (path) -#define NMP_SYSCTL_PATHID_NETDIR_unsafe(dirfd, ifname, path) \ - nm_sprintf_buf_unsafe_a(NM_STRLEN("net:/sys/class/net//\0") + NMP_IFNAMSIZ + ({ \ - const gsize _l = strlen(path); \ - \ - nm_assert(_l < 200); \ - _l; \ - }), \ - "net:/sys/class/net/%s/%s", \ - (ifname), \ - (path)), \ +#define NMP_SYSCTL_PATHID_NETDIR_unsafe(dirfd, ifname, path) \ + nm_sprintf_buf_unsafe_a(NM_STRLEN("net:/sys/class/net//\0") + NM_IFNAMSIZ + ({ \ + const gsize _l = strlen(path); \ + \ + nm_assert(_l < 200); \ + _l; \ + }), \ + "net:/sys/class/net/%s/%s", \ + (ifname), \ + (path)), \ (dirfd), (path) -#define NMP_SYSCTL_PATHID_NETDIR(dirfd, ifname, path) \ - nm_sprintf_bufa(NM_STRLEN("net:/sys/class/net//" path "/\0") + NMP_IFNAMSIZ, \ - "net:/sys/class/net/%s/%s", \ - (ifname), \ - path), \ +#define NMP_SYSCTL_PATHID_NETDIR(dirfd, ifname, path) \ + nm_sprintf_bufa(NM_STRLEN("net:/sys/class/net//" path "/\0") + NM_IFNAMSIZ, \ + "net:/sys/class/net/%s/%s", \ + (ifname), \ + path), \ (dirfd), ("" path "") int nm_platform_sysctl_open_netdir(NMPlatform *self, int ifindex, char *out_ifname); diff --git a/src/libnm-platform/nmp-base.h b/src/libnm-platform/nmp-base.h index 4802b03553..ffe5936300 100644 --- a/src/libnm-platform/nmp-base.h +++ b/src/libnm-platform/nmp-base.h @@ -11,12 +11,6 @@ /*****************************************************************************/ -/* IFNAMSIZ is both defined in and . In the past, these - * headers conflicted, so we cannot simply include either of them in a header-file.*/ -#define NMP_IFNAMSIZ 16 - -/*****************************************************************************/ - /* Define of the IN6_ADDR_GEN_MODE_* values to workaround old kernel headers * that don't define it. */ #define NM_IN6_ADDR_GEN_MODE_UNKNOWN 255 /* no corresponding value. */ diff --git a/src/libnm-platform/nmp-plobj.h b/src/libnm-platform/nmp-plobj.h index 833167f678..35c81509c1 100644 --- a/src/libnm-platform/nmp-plobj.h +++ b/src/libnm-platform/nmp-plobj.h @@ -113,7 +113,7 @@ struct _NMPlatformIP4Address { * See nm_platform_ip4_broadcast_address_from_addr(). */ in_addr_t broadcast_address; - char label[NMP_IFNAMSIZ]; + char label[NM_IFNAMSIZ]; /* Whether the address is ready to be configured. By default, an address is, but this * flag may indicate that the address is just for tracking purpose only, but the ACD