mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 18:07:52 +00:00
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#define RAD_PROX_BUFLEN (4 * 1024)
|
#define RAD_PROX_BUFLEN (4 * 1024)
|
||||||
|
|
||||||
|
#define TLV_NAS_IP 4
|
||||||
#define TLV_PROXY_STATE 33
|
#define TLV_PROXY_STATE 33
|
||||||
|
|
||||||
struct radius_socket {
|
struct radius_socket {
|
||||||
@@ -57,6 +58,7 @@ struct radius_proxy_state {
|
|||||||
|
|
||||||
static struct radius_socket *sock_auth;
|
static struct radius_socket *sock_auth;
|
||||||
static struct radius_socket *sock_acct;
|
static struct radius_socket *sock_acct;
|
||||||
|
static struct radius_socket *sock_dae;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
avl_memcmp(const void *k1, const void *k2, void *ptr)
|
avl_memcmp(const void *k1, const void *k2, void *ptr)
|
||||||
@@ -134,6 +136,9 @@ radius_forward_gw(char *buf, enum socket_type type)
|
|||||||
case RADIUS_ACCT:
|
case RADIUS_ACCT:
|
||||||
blobmsg_add_string(&b, "radius", "acct");
|
blobmsg_add_string(&b, "radius", "acct");
|
||||||
break;
|
break;
|
||||||
|
case RADIUS_DAS:
|
||||||
|
blobmsg_add_string(&b, "radius", "coa");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -154,6 +159,7 @@ radius_parse(char *buf, int len, int port, enum socket_type type, int tx)
|
|||||||
char proxy_state_str[256] = {};
|
char proxy_state_str[256] = {};
|
||||||
void *avp = hdr->avp;
|
void *avp = hdr->avp;
|
||||||
int len_orig = ntohs(hdr->len);
|
int len_orig = ntohs(hdr->len);
|
||||||
|
uint8_t localhost[] = { 0x7f, 0, 0, 1 };
|
||||||
|
|
||||||
if (len_orig != len) {
|
if (len_orig != len) {
|
||||||
ULOG_ERR("invalid header length, %d %d\n", len_orig, len);
|
ULOG_ERR("invalid header length, %d %d\n", len_orig, len);
|
||||||
@@ -175,11 +181,32 @@ radius_parse(char *buf, int len, int port, enum socket_type type, int tx)
|
|||||||
if (tlv->id == TLV_PROXY_STATE)
|
if (tlv->id == TLV_PROXY_STATE)
|
||||||
proxy_state = tlv;
|
proxy_state = tlv;
|
||||||
|
|
||||||
|
if (type == RADIUS_DAS && tlv->id == TLV_NAS_IP && tlv->len == 6)
|
||||||
|
memcpy(tlv->data, &localhost, 4);
|
||||||
|
|
||||||
printf("\tID:%d, len:%d\n", tlv->id, tlv->len);
|
printf("\tID:%d, len:%d\n", tlv->id, tlv->len);
|
||||||
avp += tlv->len;
|
avp += tlv->len;
|
||||||
len -= tlv->len;
|
len -= tlv->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == RADIUS_DAS) {
|
||||||
|
if (tx) {
|
||||||
|
radius_forward_gw(buf, type);
|
||||||
|
} else {
|
||||||
|
struct sockaddr_in dest;
|
||||||
|
|
||||||
|
memset(&dest, 0, sizeof(dest));
|
||||||
|
dest.sin_family = AF_INET;
|
||||||
|
dest.sin_port = htons(3799);
|
||||||
|
inet_pton(AF_INET, "127.0.0.1", &(dest.sin_addr.s_addr));
|
||||||
|
|
||||||
|
if (sendto(sock_dae->fd.fd, buf, len_orig,
|
||||||
|
MSG_DONTWAIT, (struct sockaddr*)&dest, sizeof(dest)) < 0)
|
||||||
|
ULOG_ERR("failed to deliver DAS frame to localhost\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!proxy_state) {
|
if (!proxy_state) {
|
||||||
ULOG_ERR("no proxy_state found\n");
|
ULOG_ERR("no proxy_state found\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -326,6 +353,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
sock_auth = sock_open("1812", RADIUS_AUTH);
|
sock_auth = sock_open("1812", RADIUS_AUTH);
|
||||||
sock_acct = sock_open("1813", RADIUS_ACCT);
|
sock_acct = sock_open("1813", RADIUS_ACCT);
|
||||||
|
sock_dae = sock_open("1814", RADIUS_DAS);
|
||||||
|
|
||||||
uloop_run();
|
uloop_run();
|
||||||
uloop_end();
|
uloop_end();
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ static int ubus_frame_cb(struct ubus_context *ctx,
|
|||||||
type = RADIUS_AUTH;
|
type = RADIUS_AUTH;
|
||||||
else if (!strcmp(radius, "acct"))
|
else if (!strcmp(radius, "acct"))
|
||||||
type = RADIUS_ACCT;
|
type = RADIUS_ACCT;
|
||||||
|
else if (!strcmp(radius, "coa"))
|
||||||
|
type = RADIUS_DAS;
|
||||||
else
|
else
|
||||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ PKG_NAME:=ucentral-schema
|
|||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git
|
PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git
|
||||||
PKG_MIRROR_HASH:=7ec098910bf4969da8ceb0f04aacd8af1cb0657dfb105bc8a499b98407a2c406
|
PKG_MIRROR_HASH:=3603ddd26026d3a5b0febe7fbae22fd28fd6d7370793ecf979561d8886be2af4
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_DATE:=2022-05-29
|
PKG_SOURCE_DATE:=2022-05-29
|
||||||
PKG_SOURCE_VERSION:=fc8fdcfed71e31e6def4d57d57acb2fa38d70253
|
PKG_SOURCE_VERSION:=9691cc6860c25ba7d62142846da44bd09c17acc0
|
||||||
|
|
||||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
|
|||||||
@@ -355,6 +355,7 @@ hostapd_common_add_bss_config() {
|
|||||||
config_add_int sae_pwe
|
config_add_int sae_pwe
|
||||||
|
|
||||||
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
|
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
|
||||||
|
config_add_string owe_transition_ifname
|
||||||
|
|
||||||
config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
|
config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
|
||||||
config_add_int iw_access_network_type iw_venue_group iw_venue_type
|
config_add_int iw_access_network_type iw_venue_group iw_venue_type
|
||||||
@@ -718,10 +719,11 @@ hostapd_set_bss_options() {
|
|||||||
|
|
||||||
case "$auth_type" in
|
case "$auth_type" in
|
||||||
none|owe)
|
none|owe)
|
||||||
json_get_vars owe_transition_bssid owe_transition_ssid
|
json_get_vars owe_transition_bssid owe_transition_ssid owe_transition_ifname
|
||||||
|
|
||||||
[ -n "$owe_transition_ssid" ] && append bss_conf "owe_transition_ssid=\"$owe_transition_ssid\"" "$N"
|
[ -n "$owe_transition_ssid" ] && append bss_conf "owe_transition_ssid=\"$owe_transition_ssid\"" "$N"
|
||||||
[ -n "$owe_transition_bssid" ] && append bss_conf "owe_transition_bssid=$owe_transition_bssid" "$N"
|
[ -n "$owe_transition_bssid" ] && append bss_conf "owe_transition_bssid=$owe_transition_bssid" "$N"
|
||||||
|
[ -n "$owe_transition_ifname" ] && append bss_conf "owe_transition_ifname=$owe_transition_ifname" "$N"
|
||||||
|
|
||||||
wps_possible=1
|
wps_possible=1
|
||||||
# Here we make the assumption that if we're in open mode
|
# Here we make the assumption that if we're in open mode
|
||||||
|
|||||||
24
feeds/wifi-ax/hostapd/patches/900-coa.patch
Normal file
24
feeds/wifi-ax/hostapd/patches/900-coa.patch
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
Index: hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
|
||||||
|
===================================================================
|
||||||
|
--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius_das.c
|
||||||
|
+++ hostapd-2021-02-20-59e9794c/src/radius/radius_das.c
|
||||||
|
@@ -48,6 +48,8 @@ static struct radius_msg * radius_das_di
|
||||||
|
RADIUS_ATTR_EVENT_TIMESTAMP,
|
||||||
|
RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
|
||||||
|
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
|
||||||
|
+ RADIUS_ATTR_VENDOR_SPECIFIC,
|
||||||
|
+ RADIUS_ATTR_CALLED_STATION_ID,
|
||||||
|
#ifdef CONFIG_IPV6
|
||||||
|
RADIUS_ATTR_NAS_IPV6_ADDRESS,
|
||||||
|
#endif /* CONFIG_IPV6 */
|
||||||
|
@@ -205,9 +207,8 @@ static struct radius_msg * radius_das_co
|
||||||
|
RADIUS_ATTR_EVENT_TIMESTAMP,
|
||||||
|
RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
|
||||||
|
RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
|
||||||
|
-#ifdef CONFIG_HS20
|
||||||
|
RADIUS_ATTR_VENDOR_SPECIFIC,
|
||||||
|
-#endif /* CONFIG_HS20 */
|
||||||
|
+ RADIUS_ATTR_CALLED_STATION_ID,
|
||||||
|
#ifdef CONFIG_IPV6
|
||||||
|
RADIUS_ATTR_NAS_IPV6_ADDRESS,
|
||||||
|
#endif /* CONFIG_IPV6 */
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
From 574539ee2cdbb3dd54086423c6dfdd19bb1c06a6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Bauer <mail@david-bauer.net>
|
||||||
|
Date: Thu, 16 Jun 2022 01:55:26 +0200
|
||||||
|
Subject: [PATCH] hostapd: add owe_transition_ifname
|
||||||
|
|
||||||
|
Add the owe_transition_ifname config option to wifi-ifaces.
|
||||||
|
|
||||||
|
This allows to configure OWE transition VAPs without adding SSID / BSSID
|
||||||
|
to the uci conifg but instead autodiscovering these parameters from
|
||||||
|
other networks on the same PHY.
|
||||||
|
|
||||||
|
The following configuration creates a OWE transition mode network
|
||||||
|
constellation.
|
||||||
|
|
||||||
|
config wifi-iface 'open0'
|
||||||
|
option device 'radio0'
|
||||||
|
option ifname 'open0'
|
||||||
|
option network 'lan'
|
||||||
|
option mode 'ap'
|
||||||
|
option ssid 'FreeNet'
|
||||||
|
option encryption 'none'
|
||||||
|
option owe_transition_ifname 'owe0'
|
||||||
|
|
||||||
|
config wifi-iface 'owe0'
|
||||||
|
option device 'radio0'
|
||||||
|
option ifname 'owe0'
|
||||||
|
option network 'lan'
|
||||||
|
option mode 'ap'
|
||||||
|
option ssid 'owe_tm.FreeNet'
|
||||||
|
option encryption 'owe'
|
||||||
|
option hidden '1'
|
||||||
|
option owe_transition_ifname 'open0'
|
||||||
|
|
||||||
|
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||||
|
---
|
||||||
|
package/network/services/hostapd/files/hostapd.sh | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
|
||||||
|
index e5f816a55b..fa344bd2dd 100644
|
||||||
|
--- a/package/network/services/hostapd/files/hostapd.sh
|
||||||
|
+++ b/package/network/services/hostapd/files/hostapd.sh
|
||||||
|
@@ -335,6 +335,7 @@ hostapd_common_add_bss_config() {
|
||||||
|
config_add_int sae_pwe
|
||||||
|
|
||||||
|
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
|
||||||
|
+ config_add_string owe_transition_ifname
|
||||||
|
|
||||||
|
config_add_boolean iw_enabled iw_internet iw_asra iw_esr iw_uesa
|
||||||
|
config_add_int iw_access_network_type iw_venue_group iw_venue_type
|
||||||
|
@@ -635,10 +636,11 @@ hostapd_set_bss_options() {
|
||||||
|
|
||||||
|
case "$auth_type" in
|
||||||
|
none|owe)
|
||||||
|
- json_get_vars owe_transition_bssid owe_transition_ssid
|
||||||
|
+ json_get_vars owe_transition_bssid owe_transition_ssid owe_transition_ifname
|
||||||
|
|
||||||
|
[ -n "$owe_transition_ssid" ] && append bss_conf "owe_transition_ssid=\"$owe_transition_ssid\"" "$N"
|
||||||
|
[ -n "$owe_transition_bssid" ] && append bss_conf "owe_transition_bssid=$owe_transition_bssid" "$N"
|
||||||
|
+ [ -n "$owe_transition_ifname" ] && append bss_conf "owe_transition_ifname=$owe_transition_ifname" "$N"
|
||||||
|
|
||||||
|
wps_possible=1
|
||||||
|
# Here we make the assumption that if we're in open mode
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ packages:
|
|||||||
- atfpolicy
|
- atfpolicy
|
||||||
- kmod-batman-adv
|
- kmod-batman-adv
|
||||||
- batctl-default
|
- batctl-default
|
||||||
|
- bind-dig
|
||||||
- cJSON
|
- cJSON
|
||||||
- curl
|
- curl
|
||||||
- dnsmasq-full
|
- dnsmasq-full
|
||||||
@@ -52,6 +53,7 @@ packages:
|
|||||||
- libustream-openssl
|
- libustream-openssl
|
||||||
- udevmand
|
- udevmand
|
||||||
- umdns
|
- umdns
|
||||||
|
- oping
|
||||||
- vxlan
|
- vxlan
|
||||||
- wpad-openssl
|
- wpad-openssl
|
||||||
diffconfig: |
|
diffconfig: |
|
||||||
|
|||||||
Reference in New Issue
Block a user