#include "sd-ndisc.h"
#include "alloc-util.h"
-#include "arphrd-list.h"
#include "condition.h"
#include "conf-parser.h"
#include "device-util.h"
#include "hexdecoct.h"
#include "log.h"
#include "network-internal.h"
+#include "network-util.h"
#include "parse-util.h"
#include "siphash24.h"
#include "socket-util.h"
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(wifi_iftype, enum nl80211_iftype);
-char *link_get_type_string(unsigned short iftype, sd_device *device) {
- const char *t, *devtype;
- char *p;
-
- if (device &&
- sd_device_get_devtype(device, &devtype) >= 0 &&
- !isempty(devtype))
- return strdup(devtype);
-
- t = arphrd_to_name(iftype);
- if (!t)
- return NULL;
-
- p = strdup(t);
- if (!p)
- return NULL;
-
- ascii_strlower(p);
- return p;
-}
-
bool net_match_config(Set *match_mac,
Set *match_permanent_mac,
char * const *match_paths,
_cleanup_free_ char *dev_iftype_str;
const char *dev_path = NULL;
- dev_iftype_str = link_get_type_string(dev_iftype, device);
+ dev_iftype_str = link_get_type_string(device, dev_iftype);
if (device) {
const char *mac_str;
#include "set.h"
#include "strv.h"
-char *link_get_type_string(unsigned short iftype, sd_device *device);
bool net_match_config(Set *match_mac,
Set *match_permanent_mac,
char * const *match_paths,
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "alloc-util.h"
+#include "arphrd-list.h"
#include "fd-util.h"
#include "network-util.h"
#include "string-table.h"
return 0;
}
+
+char *link_get_type_string(sd_device *device, unsigned short iftype) {
+ const char *t;
+ char *p;
+
+ if (device &&
+ sd_device_get_devtype(device, &t) >= 0 &&
+ !isempty(t))
+ return strdup(t);
+
+ t = arphrd_to_name(iftype);
+ if (!t)
+ return NULL;
+
+ p = strdup(t);
+ if (!p)
+ return NULL;
+
+ return ascii_strlower(p);
+}
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
+#include "sd-device.h"
#include "sd-network.h"
#include "macro.h"
LINK_OPERSTATE_ROUTABLE }
int parse_operational_state_range(const char *str, LinkOperationalStateRange *out);
+
+char *link_get_type_string(sd_device *device, unsigned short iftype);
#include "main-func.h"
#include "netlink-util.h"
#include "network-internal.h"
+#include "network-util.h"
#include "pager.h"
#include "parse-util.h"
#include "pretty-print.h"
setup_state = strdup("unmanaged");
setup_state_to_color(setup_state, &on_color_setup, &off_color_setup);
- t = link_get_type_string(links[i].iftype, links[i].sd_device);
+ t = link_get_type_string(links[i].sd_device, links[i].iftype);
r = table_add_many(table,
TABLE_INT, links[i].ifindex,
(void) sd_device_get_property_value(info->sd_device, "ID_MODEL", &model);
}
- t = link_get_type_string(info->iftype, info->sd_device);
+ t = link_get_type_string(info->sd_device, info->iftype);
(void) sd_network_link_get_network_file(info->ifindex, &network);