Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH v1 06/11] inet: Add source address to RS callback
(Daniel Wagner)
2. [PATCH v1 08/11] dhcpv6: Do not clear gateway address when setting IP
(Daniel Wagner)
3. [PATCH v1 09/11] network: Add IPv6 gateway when setting the IPv6 address
(Daniel Wagner)
4. [PATCH v1 05/11] ipconfig: Disable accept_ra on managed interfaces
(Daniel Wagner)
----------------------------------------------------------------------
Date: Sun, 29 Nov 2020 16:29:15 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v1 06/11] inet: Add source address to RS callback
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
The source IP address (aka gateway) needs to be added to the
connection information.
---
src/6to4.c | 3 ++-
src/connman.h | 3 ++-
src/inet.c | 6 +++---
src/network.c | 6 ++++--
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/6to4.c b/src/6to4.c
index 71a288277104..1ff070a81cda 100644
--- a/src/6to4.c
+++ b/src/6to4.c
@@ -375,7 +375,8 @@ static int init_6to4(struct in_addr *ip4addr)
return -1;
}
-static void receive_rs_reply(struct nd_router_advert *reply,
+static void receive_rs_reply(struct in6_addr *src_addr,
+ struct nd_router_advert *reply,
unsigned int length, void *user_data)
{
char *address = user_data;
diff --git a/src/connman.h b/src/connman.h
index 3bdc0dc7512a..e9ee73e15e96 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -169,7 +169,8 @@ bool __connman_inet_is_any_addr(const char *address, int
family);
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
-typedef void (*__connman_inet_rs_cb_t) (struct nd_router_advert *reply,
+typedef void (*__connman_inet_rs_cb_t) (struct in6_addr *src_addr,
+ struct nd_router_advert *reply,
unsigned int length, void *user_data);
int __connman_inet_ipv6_send_rs(int index, int timeout,
diff --git a/src/inet.c b/src/inet.c
index 584d67f3ca8c..7d41e84ec4ea 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -1389,7 +1389,7 @@ static gboolean rs_timeout_cb(gpointer user_data)
if (data->callback) {
__connman_inet_rs_cb_t cb = data->callback;
- cb(NULL, 0, data->user_data);
+ cb(NULL, NULL, 0, data->user_data);
}
data->timeout = 0;
@@ -1423,7 +1423,7 @@ static int icmpv6_recv(int fd, struct xs_cb_data *data)
len = recvmsg(fd, &mhdr, 0);
if (len < 0) {
- cb(NULL, 0, data->user_data);
+ cb(NULL, NULL, 0, data->user_data);
return -errno;
}
@@ -1433,7 +1433,7 @@ static int icmpv6_recv(int fd, struct xs_cb_data *data)
if (hdr->nd_ra_code != 0)
return 0;
- cb(hdr, len, data->user_data);
+ cb(&saddr.sin6_addr, hdr, len, data->user_data);
return len;
}
diff --git a/src/network.c b/src/network.c
index 256e3b5f1c12..f3f096c071ac 100644
--- a/src/network.c
+++ b/src/network.c
@@ -741,7 +741,8 @@ static void dhcpv6_callback(struct connman_network *network,
stop_dhcpv6(network);
}
-static void check_dhcpv6(struct nd_router_advert *reply,
+static void check_dhcpv6(struct in6_addr *src_addr,
+ struct nd_router_advert *reply,
unsigned int length, void *user_data)
{
struct connman_network *network = user_data;
@@ -816,7 +817,8 @@ static void check_dhcpv6(struct nd_router_advert *reply,
connman_network_unref(network);
}
-static void receive_refresh_rs_reply(struct nd_router_advert *reply,
+static void receive_refresh_rs_reply(struct in6_addr *src_addr,
+ struct nd_router_advert *reply,
unsigned int length, void *user_data)
{
struct connman_network *network = user_data;
--
2.29.2
------------------------------
Date: Sun, 29 Nov 2020 16:29:17 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v1 08/11] dhcpv6: Do not clear gateway address when
setting IP
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
The gateway address is part of the ipconfig object. When setting the
IPv6 address, first thing happens is to remove the IP address. This
call ends up clearing the complete ipconfig object including the
gateway address. Thus restore the gateway after the
__connman_ipconfig_address_remove() call.
---
src/dhcpv6.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 2d5f8f6a601e..5abd45614006 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -634,15 +634,23 @@ static void set_address(int ifindex, struct
connman_ipconfig *ipconfig,
if (address && ((c_address && g_strcmp0(address, c_address) != 0) ||
!c_address)) {
int prefix_len;
+ char *gw;
/* Is this prefix part of the subnet we are suppose to use? */
prefix_len = check_ipv6_addr_prefix(prefixes, address);
+ gw = (char *)__connman_ipconfig_get_gateway(ipconfig);
+ if (gw)
+ gw = g_strdup(gw);
+
__connman_ipconfig_address_remove(ipconfig);
__connman_ipconfig_set_local(ipconfig, address);
__connman_ipconfig_set_prefixlen(ipconfig, prefix_len);
+ __connman_ipconfig_set_gateway(ipconfig, gw);
+
+ DBG("new address %s/%d gw %s", address, prefix_len, gw);
- DBG("new address %s/%d", address, prefix_len);
+ g_free(gw);
__connman_ipconfig_set_dhcp_address(ipconfig, address);
__connman_service_save(
--
2.29.2
------------------------------
Date: Sun, 29 Nov 2020 16:29:18 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v1 09/11] network: Add IPv6 gateway when setting the
IPv6 address
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
Register the IPv6 gateway to the connection core.
---
src/network.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/network.c b/src/network.c
index c3a13d3d549a..019d4ae00cc2 100644
--- a/src/network.c
+++ b/src/network.c
@@ -680,6 +680,10 @@ static int dhcpv6_set_addresses(struct connman_network
*network)
if (err < 0)
goto err;
+ err = __connman_ipconfig_gateway_add(ipconfig_ipv6);
+ if (err < 0)
+ goto err;
+
return 0;
err:
--
2.29.2
------------------------------
Date: Sun, 29 Nov 2020 16:29:14 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v1 05/11] ipconfig: Disable accept_ra on managed
interfaces
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
All interfaces managed by ConnMan should disable the auto
configuration by the kernel which includes the route settings via IPv6
RA.
---
src/ipconfig.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/ipconfig.c b/src/ipconfig.c
index aa67f9d55679..4579982ce3a0 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -83,6 +83,7 @@ struct connman_ipdevice {
bool ipv6_enabled;
int ipv6_privacy;
+ bool ipv6_accept_ra;
};
struct ipconfig_store {
@@ -358,6 +359,23 @@ static void set_ipv6_privacy(char *ifname, int value)
"use_tempaddr", value);
}
+static int get_ipv6_accept_ra(char *ifname)
+{
+ int value;
+
+ if (sys_ifname_get_int(SYS_IPV6_PATH, ifname,
+ "accept_ra", &value) < 0)
+ return 0;
+
+ return value;
+}
+
+static void set_ipv6_accept_ra(char *ifname, int value)
+{
+ sys_ifname_set_int(SYS_IPV6_PATH, ifname,
+ "accept_ra", value);
+}
+
static int get_rp_filter(void)
{
int value = -EINVAL, tmp;
@@ -453,6 +471,7 @@ static void free_ipdevice(gpointer data)
if (ifname) {
set_ipv6_state(ifname, ipdevice->ipv6_enabled);
set_ipv6_privacy(ifname, ipdevice->ipv6_privacy);
+ set_ipv6_accept_ra(ifname, ipdevice->ipv6_accept_ra);
}
g_free(ifname);
@@ -530,6 +549,7 @@ void __connman_ipconfig_newlink(int index, unsigned short
type,
ipdevice->ipv6_enabled = get_ipv6_state(ifname);
ipdevice->ipv6_privacy = get_ipv6_privacy(ifname);
+ ipdevice->ipv6_accept_ra = get_ipv6_accept_ra(ifname);
ipdevice->address = g_strdup(address);
@@ -1537,6 +1557,7 @@ static void enable_ipv6(struct connman_ipconfig *ipconfig)
set_ipv6_privacy(ifname, ipconfig->ipv6_privacy_config);
set_ipv6_state(ifname, true);
+ set_ipv6_accept_ra(ifname, false);
g_free(ifname);
}
--
2.29.2
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list -- [email protected]
To unsubscribe send an email to [email protected]
------------------------------
End of connman Digest, Vol 61, Issue 17
***************************************