3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

station: check support for all sysfs settings

If IPv6 is disabled or not supported at the kernel level writing the
sysfs settings will fail. A few of them had a support check but this
patch adds a supported bool to the remainder so we done get errors
like:

Unable to write drop_unsolicited_na to /proc/sys/net/ipv6/conf/wlan0/drop_unsolicited_na
This commit is contained in:
James Prestwood 2024-10-24 06:16:28 -07:00 committed by Denis Kenzior
parent ca9b7ccaf6
commit a2b2f66c4c

View File

@ -74,6 +74,10 @@ static uint32_t roam_retry_interval;
static bool anqp_disabled; static bool anqp_disabled;
static bool supports_arp_evict_nocarrier; static bool supports_arp_evict_nocarrier;
static bool supports_ndisc_evict_nocarrier; static bool supports_ndisc_evict_nocarrier;
static bool supports_drop_gratuitous_arp;
static bool supports_drop_unsolicited_na;
static bool supports_ipv4_drop_unicast_in_l2_multicast;
static bool supports_ipv6_drop_unicast_in_l2_multicast;
static struct watchlist event_watches; static struct watchlist event_watches;
static uint32_t known_networks_watch; static uint32_t known_networks_watch;
static uint32_t allowed_bands; static uint32_t allowed_bands;
@ -1641,8 +1645,11 @@ static void station_set_drop_neighbor_discovery(struct station *station,
{ {
char *v = value ? "1" : "0"; char *v = value ? "1" : "0";
if (supports_drop_gratuitous_arp)
sysfs_write_ipv4_setting(netdev_get_name(station->netdev), sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
"drop_gratuitous_arp", v); "drop_gratuitous_arp", v);
if (supports_drop_unsolicited_na)
sysfs_write_ipv6_setting(netdev_get_name(station->netdev), sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
"drop_unsolicited_na", v); "drop_unsolicited_na", v);
} }
@ -1652,8 +1659,11 @@ static void station_set_drop_unicast_l2_multicast(struct station *station,
{ {
char *v = value ? "1" : "0"; char *v = value ? "1" : "0";
if (supports_ipv4_drop_unicast_in_l2_multicast)
sysfs_write_ipv4_setting(netdev_get_name(station->netdev), sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
"drop_unicast_in_l2_multicast", v); "drop_unicast_in_l2_multicast", v);
if (supports_ipv6_drop_unicast_in_l2_multicast)
sysfs_write_ipv6_setting(netdev_get_name(station->netdev), sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
"drop_unicast_in_l2_multicast", v); "drop_unicast_in_l2_multicast", v);
} }
@ -5798,6 +5808,16 @@ static int station_init(void)
"arp_evict_nocarrier"); "arp_evict_nocarrier");
supports_ndisc_evict_nocarrier = sysfs_supports_ipv6_setting("all", supports_ndisc_evict_nocarrier = sysfs_supports_ipv6_setting("all",
"ndisc_evict_nocarrier"); "ndisc_evict_nocarrier");
supports_drop_gratuitous_arp = sysfs_supports_ipv4_setting("all",
"drop_gratuitous_arp");
supports_drop_unsolicited_na = sysfs_supports_ipv6_setting("all",
"drop_unsolicited_na");
supports_ipv4_drop_unicast_in_l2_multicast =
sysfs_supports_ipv4_setting("all",
"drop_unicast_in_l2_multicast");
supports_ipv6_drop_unicast_in_l2_multicast =
sysfs_supports_ipv6_setting("all",
"drop_unicast_in_l2_multicast");
watchlist_init(&event_watches, NULL); watchlist_init(&event_watches, NULL);