From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH] station: check support for all sysfs settings
Date: Thu, 24 Oct 2024 06:16:28 -0700 [thread overview]
Message-ID: <20241024131628.152607-1-prestwoj@gmail.com> (raw)
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
---
src/station.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/station.c b/src/station.c
index cef6c66a..34537b26 100644
--- a/src/station.c
+++ b/src/station.c
@@ -74,6 +74,10 @@ static uint32_t roam_retry_interval;
static bool anqp_disabled;
static bool supports_arp_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 uint32_t known_networks_watch;
static uint32_t allowed_bands;
@@ -1641,10 +1645,13 @@ static void station_set_drop_neighbor_discovery(struct station *station,
{
char *v = value ? "1" : "0";
- sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
- "drop_gratuitous_arp", v);
- sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
- "drop_unsolicited_na", v);
+ if (supports_drop_gratuitous_arp)
+ sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+ "drop_gratuitous_arp", v);
+
+ if (supports_drop_unsolicited_na)
+ sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+ "drop_unsolicited_na", v);
}
static void station_set_drop_unicast_l2_multicast(struct station *station,
@@ -1652,10 +1659,13 @@ static void station_set_drop_unicast_l2_multicast(struct station *station,
{
char *v = value ? "1" : "0";
- sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
- "drop_unicast_in_l2_multicast", v);
- sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
- "drop_unicast_in_l2_multicast", v);
+ if (supports_ipv4_drop_unicast_in_l2_multicast)
+ sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+ "drop_unicast_in_l2_multicast", v);
+
+ if (supports_ipv6_drop_unicast_in_l2_multicast)
+ sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+ "drop_unicast_in_l2_multicast", v);
}
static void station_signal_agent_notify(struct station *station);
@@ -5813,6 +5823,16 @@ static int station_init(void)
"arp_evict_nocarrier");
supports_ndisc_evict_nocarrier = sysfs_supports_ipv6_setting("all",
"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);
--
2.34.1
next reply other threads:[~2024-10-24 13:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 13:16 James Prestwood [this message]
2024-10-24 14:16 ` [PATCH] station: check support for all sysfs settings Denis Kenzior
2024-10-25 11:14 ` Martin Petzold
2024-10-25 11:37 ` James Prestwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241024131628.152607-1-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox