[PATCH 1/6] netconfig: Use CamelCase for IPv4 address settings
by Tim Kourt
---
src/netconfig.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 9d32c37a..df9d7ce4 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -131,15 +131,24 @@ static struct netconfig_ifaddr *netconfig_ipv4_get_ifaddr(
case RTPROT_STATIC:
ip = l_settings_get_string(netconfig->active_settings, "IPv4",
- "ip");
- if (!ip)
- return NULL;
+ "Address");
+ if (!ip) {
+ ip = l_settings_get_string(netconfig->active_settings,
+ "IPv4", "ip");
+ if (!ip)
+ return NULL;
+ }
ifaddr = l_new(struct netconfig_ifaddr, 1);
ifaddr->ip = ip;
netmask = l_settings_get_string(netconfig->active_settings,
- "IPv4", "netmask");
+ "IPv4", "Netmask");
+ if (!netmask)
+ netmask = l_settings_get_string(
+ netconfig->active_settings,
+ "IPv4", "netmask");
+
if (netmask && inet_pton(AF_INET, netmask, &in_addr) > 0)
ifaddr->prefix_len = __builtin_popcountl(
L_BE32_TO_CPU(in_addr.s_addr));
@@ -150,7 +159,13 @@ static struct netconfig_ifaddr *netconfig_ipv4_get_ifaddr(
ifaddr->broadcast =
l_settings_get_string(netconfig->active_settings,
- "IPv4", "broadcast");
+ "IPv4", "Broadcast");
+ if (!ifaddr->broadcast)
+ ifaddr->broadcast =
+ l_settings_get_string(
+ netconfig->active_settings,
+ "IPv4", "broadcast");
+
ifaddr->family = AF_INET;
return ifaddr;
--
2.13.6
2 years, 5 months
[PATCH v2 1/2] netconfig: Add IPv4 domain name helper and installer
by Tim Kourt
The provided domain name helper allows to override the DHCP lease
option value with the static one from network configuration file.
---
src/netconfig.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 9d32c37a..e7176444 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -251,6 +251,28 @@ static char **netconfig_ipv4_get_dns(struct netconfig *netconfig, uint8_t proto)
return NULL;
}
+static char *netconfig_ipv4_get_domain_name(struct netconfig *netconfig,
+ uint8_t proto)
+{
+ const struct l_dhcp_lease *lease;
+ char *domain_name;
+
+ domain_name = l_settings_get_string(netconfig->active_settings,
+ "IPv4", "DomainName");
+ if (domain_name)
+ /* Allow to override the DHCP domain name with setting entry. */
+ return domain_name;
+
+ if (proto != RTPROT_DHCP)
+ return NULL;
+
+ lease = l_dhcp_client_get_lease(netconfig->dhcp_client);
+ if (!lease)
+ return NULL;
+
+ return l_dhcp_lease_get_domain_name(lease);
+}
+
static struct netconfig_ifaddr *netconfig_ipv6_get_ifaddr(
struct netconfig *netconfig,
uint8_t proto)
@@ -685,6 +707,7 @@ static void netconfig_ipv4_ifaddr_add_cmd_cb(int error, uint16_t type,
struct netconfig *netconfig = user_data;
struct netconfig_ifaddr *ifaddr;
char **dns;
+ char *domain_name;
if (error && error != -EEXIST) {
l_error("netconfig: Failed to add IP address. "
@@ -709,12 +732,21 @@ static void netconfig_ipv4_ifaddr_add_cmd_cb(int error, uint16_t type,
dns = netconfig_ipv4_get_dns(netconfig, netconfig->rtm_protocol);
if (!dns) {
l_error("netconfig: Failed to obtain DNS addresses.");
- goto done;
+ goto domain_name;
}
resolve_add_dns(netconfig->ifindex, ifaddr->family, dns);
l_strv_free(dns);
+domain_name:
+ domain_name = netconfig_ipv4_get_domain_name(netconfig,
+ netconfig->rtm_protocol);
+ if (!domain_name)
+ goto done;
+
+ resolve_add_domain_name(netconfig->ifindex, domain_name);
+ l_free(domain_name);
+
done:
netconfig_ifaddr_destroy(ifaddr);
}
--
2.13.6
2 years, 5 months
[PATCH 1/2] netconfig: Add IPv4 domain name helper and installer
by Tim Kourt
The provided domain name helper allows to override the DHCP lease
option value with the static one from network configuration file.
---
src/netconfig.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 9d32c37a..9f0127ac 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -251,6 +251,28 @@ static char **netconfig_ipv4_get_dns(struct netconfig *netconfig, uint8_t proto)
return NULL;
}
+static char *netconfig_ipv4_get_domain_name(struct netconfig *netconfig,
+ uint8_t proto)
+{
+ const struct l_dhcp_lease *lease;
+ char *domain_name;
+
+ domain_name = l_settings_get_string(netconfig->active_settings,
+ "IPv4", "domain_name");
+ if (domain_name)
+ /* Allow to override the DHCP domain name with setting entry. */
+ return domain_name;
+
+ if (proto != RTPROT_DHCP)
+ return NULL;
+
+ lease = l_dhcp_client_get_lease(netconfig->dhcp_client);
+ if (!lease)
+ return NULL;
+
+ return l_dhcp_lease_get_domain_name(lease);
+}
+
static struct netconfig_ifaddr *netconfig_ipv6_get_ifaddr(
struct netconfig *netconfig,
uint8_t proto)
@@ -685,6 +707,7 @@ static void netconfig_ipv4_ifaddr_add_cmd_cb(int error, uint16_t type,
struct netconfig *netconfig = user_data;
struct netconfig_ifaddr *ifaddr;
char **dns;
+ char *domain_name;
if (error && error != -EEXIST) {
l_error("netconfig: Failed to add IP address. "
@@ -709,12 +732,21 @@ static void netconfig_ipv4_ifaddr_add_cmd_cb(int error, uint16_t type,
dns = netconfig_ipv4_get_dns(netconfig, netconfig->rtm_protocol);
if (!dns) {
l_error("netconfig: Failed to obtain DNS addresses.");
- goto done;
+ goto domain_name;
}
resolve_add_dns(netconfig->ifindex, ifaddr->family, dns);
l_strv_free(dns);
+domain_name:
+ domain_name = netconfig_ipv4_get_domain_name(netconfig,
+ netconfig->rtm_protocol);
+ if (!domain_name)
+ goto done;
+
+ resolve_add_domain_name(netconfig->ifindex, domain_name);
+ l_free(domain_name);
+
done:
netconfig_ifaddr_destroy(ifaddr);
}
--
2.13.6
2 years, 5 months
[PATCH 1/6] peap: Introduce PEAP state
by Tim Kourt
Introduction of the state struct will allow to hold the additional
state variables related to the implementation of PEAP.
---
src/eap-peap.c | 44 +++++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 13 deletions(-)
diff --git a/src/eap-peap.c b/src/eap-peap.c
index 16ab0319..c400ddee 100644
--- a/src/eap-peap.c
+++ b/src/eap-peap.c
@@ -41,6 +41,10 @@
* PEAPv1: draft-josefsson-pppext-eap-tls-eap-05
*/
+struct peap_state {
+ struct eap_state *phase2;
+};
+
static void eap_peap_phase2_send_response(const uint8_t *pdu, size_t pdu_len,
void *user_data)
{
@@ -116,6 +120,7 @@ static int eap_extensions_handle_result_avp(struct eap_state *eap,
size_t data_len,
uint8_t *response)
{
+ struct peap_state *peap_state;
uint16_t type;
uint16_t len;
uint16_t result;
@@ -143,8 +148,9 @@ static int eap_extensions_handle_result_avp(struct eap_state *eap,
switch (result) {
case EAP_EXTENSIONS_RESULT_SUCCCESS:
- result = eap_method_is_success(
- eap_tls_common_get_variant_data(eap)) ?
+ peap_state = eap_tls_common_get_variant_data(eap);
+
+ result = eap_method_is_success(peap_state->phase2) ?
EAP_EXTENSIONS_RESULT_SUCCCESS :
EAP_EXTENSIONS_RESULT_FAILURE;
/* fall through */
@@ -225,6 +231,7 @@ static bool eap_peap_tunnel_handle_request(struct eap_state *eap,
const uint8_t *pkt,
size_t len)
{
+ struct peap_state *peap_state;
uint8_t id;
if (len > 4 && pkt[4] == EAP_TYPE_EXTENSIONS) {
@@ -247,6 +254,8 @@ static bool eap_peap_tunnel_handle_request(struct eap_state *eap,
return true;
}
+ peap_state = eap_tls_common_get_variant_data(eap);
+
if (eap_tls_common_get_negotiated_version(eap) == EAP_TLS_VERSION_0) {
if (len < 1)
return false;
@@ -259,32 +268,37 @@ static bool eap_peap_tunnel_handle_request(struct eap_state *eap,
*/
eap_save_last_id(eap, &id);
- __eap_handle_request(eap_tls_common_get_variant_data(eap), id,
- pkt, len);
+ __eap_handle_request(peap_state->phase2, id, pkt, len);
return true;
}
- eap_rx_packet(eap_tls_common_get_variant_data(eap), pkt, len);
+ eap_rx_packet(peap_state->phase2, pkt, len);
return true;
}
-static void eap_peap_state_reset(void *phase2)
+static void eap_peap_state_reset(void *variant_data)
{
- if (!phase2)
+ struct peap_state *peap_state = variant_data;
+
+ if (!peap_state)
return;
- eap_reset(phase2);
+ eap_reset(peap_state->phase2);
}
-static void eap_peap_state_destroy(void *phase2)
+static void eap_peap_state_destroy(void *variant_data)
{
- if (!phase2)
+ struct peap_state *peap_state = variant_data;
+
+ if (!peap_state)
return;
- eap_reset(phase2);
- eap_free(phase2);
+ eap_reset(peap_state->phase2);
+ eap_free(peap_state->phase2);
+
+ l_free(peap_state);
}
static int eap_peap_settings_check(struct l_settings *settings,
@@ -323,6 +337,7 @@ static bool eap_peap_settings_load(struct eap_state *eap,
const char *prefix)
{
char setting_key_prefix[72];
+ struct peap_state *peap_state;
void *phase2;
phase2 = eap_new(eap_peap_phase2_send_response,
@@ -343,11 +358,14 @@ static bool eap_peap_settings_load(struct eap_state *eap,
return false;
}
+ peap_state = l_new(struct peap_state, 1);
+ peap_state->phase2 = phase2;
+
snprintf(setting_key_prefix, sizeof(setting_key_prefix), "%sPEAP-",
prefix);
if (!eap_tls_common_settings_load(eap, settings, setting_key_prefix,
- &eap_ttls_ops, phase2))
+ &eap_ttls_ops, peap_state))
return false;
return true;
--
2.13.6
2 years, 5 months
[PATCH] station: add dependency to device
by Shuai Wang
scan_periodic_start triggered by station requires scan_wdev_add to be
called first from device.
---
src/station.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/station.c b/src/station.c
index c6029423..fd346194 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3225,3 +3225,4 @@ static void station_exit(void)
IWD_MODULE(station, station_init, station_exit)
IWD_MODULE_DEPENDS(station, netconfig)
+IWD_MODULE_DEPENDS(station, device)
--
2.24.0
2 years, 5 months
[PATCH 1/4] client: Extend client proxy object's API
by Tim Kourt
Add Start/Stop operations to the client proxy objects. The framework
invokes these operations right after the proxy objects are created
or just before the are destroyed, so proxy objects can perform the
needed actions like start/stop a service, etc. if they choose to
implement these ops.
---
client/dbus-proxy.c | 16 ++++++++++++++++
client/dbus-proxy.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index badd36a3..70b63686 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -555,6 +555,19 @@ static void proxy_interface_create(const char *path,
}
l_queue_push_tail(proxy_interfaces, proxy);
+
+ if (!interface_type->ops || !interface_type->ops->start)
+ continue;
+
+ if (interface_type->ops->start(proxy))
+ continue;
+
+ if (!command_is_interactive_mode())
+ command_set_exit_status(EXIT_FAILURE);
+
+ l_main_quit();
+
+ return;
}
}
@@ -562,6 +575,9 @@ static void proxy_interface_destroy(void *data)
{
struct proxy_interface *proxy = data;
+ if (proxy->type->ops && proxy->type->ops->stop)
+ proxy->type->ops->stop(proxy);
+
l_free(proxy->path);
if (proxy->type->ops && proxy->type->ops->destroy)
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
index a3304848..e6b6f8c0 100644
--- a/client/dbus-proxy.h
+++ b/client/dbus-proxy.h
@@ -50,6 +50,8 @@ struct proxy_interface_property {
struct proxy_interface_type_ops {
void *(*create)(void);
void (*destroy)(void *data);
+ bool (*start)(const struct proxy_interface *proxy);
+ void (*stop)(const struct proxy_interface *proxy);
const char *(*identity)(void *data);
void (*display)(const char *margin, const void *data);
};
--
2.13.6
2 years, 5 months
iwd crashing when run in different network namespace
by Toke Høiland-Jørgensen
Hi
I have been periodically trying out iwd, but haven't managed to get it
to work yet. After the 1.0 release I thought I'd give it another try,
and finally got around to it now, with my distribution-provided package
(Arch Linux, iwd 1.1-2).
Now, my setup is a bit unusual: I move my physical network adapter to a
separate network namespace, and run the WiFi configuration daemon (thus
far wpa_supplicant) in there. Thus, I want to do the same with iwd,
which doesn't seem to be working.
I added an override file to move the systemd service:
$ cat /etc/systemd/system/iwd.service.d/override.conf
[Unit]
JoinsNamespaceOf=netns(a)physical.service
[Service]
PrivateNetwork=yes
$ sudo ip netns exec physical iw phy | head -n 1
Wiphy phy1
However, when I try to start iwd, all I get is an error message and a
crash:
Dec 03 16:02:45 my-laptop systemd[1]: Starting Wireless service...
Dec 03 16:02:45 my-laptop iwd[159840]: Wireless daemon version 1.1
Dec 03 16:02:45 my-laptop iwd[159840]: Loaded configuration from /etc/iwd/main.conf
Dec 03 16:02:45 my-laptop systemd[1]: Started Wireless service.
Dec 03 16:02:45 my-laptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 ms
g='unit=iwd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Dec 03 16:02:45 my-laptop iwd[159840]: Can't read /sys/class/ieee80211/phy1/device/driver: No such file or directory
Dec 03 16:02:45 my-laptop audit[159840]: ANOM_ABEND auid=4294967295 uid=0 gid=0 ses=4294967295 pid=159840 comm="iwd" exe="/usr/lib/iwd/iwd" sig=11 res=1
Dec 03 16:02:45 my-laptop systemd[1]: Started Process Core Dump (PID 159841/UID 0).
Dec 03 16:02:45 my-laptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@25-159841-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Dec 03 16:02:45 my-laptop systemd[1]: iwd.service: Main process exited, code=dumped, status=11/SEGV
Dec 03 16:02:45 my-laptop systemd[1]: iwd.service: Failed with result 'core-dump'.
Dec 03 16:02:45 my-laptop audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=iwd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Dec 03 16:02:45 my-laptop systemd-coredump[159842]: Process 159840 (iwd) of user 0 dumped core.
Stack trace of thread 159840:
#0 0x00006a95dc9ee6f5 __strlen_avx2 (libc.so.6)
#1 0x00006a95dc961c34 fnmatch@@GLIBC_2.2.5 (libc.so.6)
#2 0x0000074127bc397b n/a (iwd)
#3 0x0000074127bf2f30 n/a (iwd)
#4 0x0000074127bef804 n/a (iwd)
#5 0x0000074127bee9ed n/a (iwd)
#6 0x0000074127beeabe n/a (iwd)
#7 0x0000074127beece0 n/a (iwd)
#8 0x0000074127b946c2 n/a (iwd)
#9 0x00006a95dc8b4153 __libc_start_main (libc.so.6)
#10 0x0000074127b94e4e n/a (iwd)
Dec 03 16:02:45 my-laptop systemd[1]: systemd-coredump(a)25-159841-0.service: Succeeded.
The file referenced in the error message does exist:
$ sudo ip netns exec physical ls /sys/class/ieee80211/phy1/device/driver -l
lrwxrwxrwx 1 root root 0 Dec 3 16:21 /sys/class/ieee80211/phy1/device/driver -> ../../../../bus/pci/drivers/iwlwifi
Any chance someone could take a look at this?
Thanks!
-Toke
2 years, 5 months
[PATCH] build: Make ln usage POSIX-compatible
by Michael Forney
Not all ln(1) implementations support the -t option.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 1d572db5..54656c76 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -614,7 +614,7 @@ ell/internal: Makefile
$(AM_V_at)$(MKDIR_P) ell
$(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \
if [ ! -f $$f ] ; then \
- $(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
+ $(LN_S) -f $(abs_srcdir)/../ell/$$f $$f ; \
fi \
done > $@
--
2.20.1
2 years, 5 months