network,udev/net: add Kind= settings in [Match] section
This may be useful for writing .network or .link files matching with virtual interfaces. Closes #22541.
This commit is contained in:
@@ -22,6 +22,7 @@ void net_match_clear(NetMatch *match) {
|
||||
match->path = strv_free(match->path);
|
||||
match->driver = strv_free(match->driver);
|
||||
match->iftype = strv_free(match->iftype);
|
||||
match->kind = strv_free(match->kind);
|
||||
match->ifname = strv_free(match->ifname);
|
||||
match->property = strv_free(match->property);
|
||||
match->wlan_iftype = strv_free(match->wlan_iftype);
|
||||
@@ -38,6 +39,7 @@ bool net_match_is_empty(const NetMatch *match) {
|
||||
strv_isempty(match->path) &&
|
||||
strv_isempty(match->driver) &&
|
||||
strv_isempty(match->iftype) &&
|
||||
strv_isempty(match->kind) &&
|
||||
strv_isempty(match->ifname) &&
|
||||
strv_isempty(match->property) &&
|
||||
strv_isempty(match->wlan_iftype) &&
|
||||
@@ -126,6 +128,7 @@ int net_match_config(
|
||||
const struct hw_addr_data *permanent_hw_addr,
|
||||
const char *driver,
|
||||
unsigned short iftype,
|
||||
const char *kind,
|
||||
const char *ifname,
|
||||
char * const *alternative_names,
|
||||
enum nl80211_iftype wlan_iftype,
|
||||
@@ -160,6 +163,9 @@ int net_match_config(
|
||||
if (!net_condition_test_strv(match->iftype, iftype_str))
|
||||
return false;
|
||||
|
||||
if (!net_condition_test_strv(match->kind, kind))
|
||||
return false;
|
||||
|
||||
if (!net_condition_test_ifname(match->ifname, ifname, alternative_names))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ typedef struct NetMatch {
|
||||
Set *permanent_hw_addr;
|
||||
char **path;
|
||||
char **driver;
|
||||
char **iftype;
|
||||
char **iftype; /* udev's DEVTYPE field or ARPHRD_XXX, e.g. ether, wlan. */
|
||||
char **kind; /* IFLA_INFO_KIND attribute, e.g. gre, gretap, erspan. */
|
||||
char **ifname;
|
||||
char **property;
|
||||
char **wlan_iftype;
|
||||
@@ -33,6 +34,7 @@ int net_match_config(
|
||||
const struct hw_addr_data *permanent_hw_addr,
|
||||
const char *driver,
|
||||
unsigned short iftype,
|
||||
const char *kind,
|
||||
const char *ifname,
|
||||
char * const *alternative_names,
|
||||
enum nl80211_iftype wlan_iftype,
|
||||
|
||||
Reference in New Issue
Block a user