Files
wlan-ap/feeds/hostapd/hostapd/patches/t00-012-hostapd-Fix-DVLAN-802.1x-issue.patch
2024-09-22 13:45:23 +02:00

54 lines
1.8 KiB
Diff

From 98b6503b87bb36bf2f5ae16e52e230e8870c867f Mon Sep 17 00:00:00 2001
From: Venkat Chimata <venkata@shasta.cloud>
Date: Fri, 28 Jun 2024 14:39:31 +0530
Subject: [PATCH] hostapd: Fix DVLAN + 802.1x issue
In case of swconfig switches, the basename of the interface should be based on the last dot.
Earlier it was done based on the first dot, which would result in incorrect basename.
For example if the interface name is eth0.4087 then the vlan->ifname would be eth0.4087. (A dot at the end) .
Before this patch, the basename was returned as eth0. It should be eth0.4087
Also fixed the return code by adding a default value of 0 and removed an unncessary check
for if_add before ubus add call.
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
---
src/ap/vlan_init.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 3e27671..cfeb1e5 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -23,7 +23,8 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
int existsok)
{
bool vlan_exists = iface_exists(vlan->ifname);
- int ret;
+ int ret = 0;
+
#ifdef CONFIG_WEP
int i;
@@ -38,7 +39,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
#endif /* CONFIG_WEP */
if (!hapd->driver || !hapd->driver->if_add) {
- char *dot = strstr(vlan->ifname, ".");
+ char *dot = strrchr(vlan->ifname, '.');
if (dot)
*dot = '\0';
ret = 0;
@@ -59,7 +60,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
if (hapd->wpa_auth)
ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id);
- if (!ret && !vlan_exists && hapd->driver->if_add)
+ if (!ret && !vlan_exists)
hostapd_ubus_add_vlan(hapd, vlan);
if (ret == 0)
--
2.34.1