aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Erickson <erick205@umn.edu>2023-12-01 22:55:04 -0800
committerMarcel Holtmann <marcel@holtmann.org>2023-12-08 01:55:44 +0100
commit8f0038dce512322628d92778e89ffb8ba94a1ae5 (patch)
tree5b2614266b73257d6fa47ac58f170ddaec292de2
parent8cc2659149fcb6ac97c8e4e9a59db3d5fb353ef0 (diff)
downloadconnman-8f0038dce512322628d92778e89ffb8ba94a1ae5.tar.gz
ipconfig: Pass the rtnl table to '__connman_ipconfig_{new,del}route'.
This adds support for extracting and passing the Routing Netlink (rtnl) table identifier to '__connman_ipconfig_{new,del}route' from 'process_{new,del}route'.
-rw-r--r--src/connman.h6
-rw-r--r--src/ipconfig.c16
-rw-r--r--src/rtnl.c22
3 files changed, 28 insertions, 16 deletions
diff --git a/src/connman.h b/src/connman.h
index 19de86346..35f11e92a 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -367,9 +367,11 @@ int __connman_ipconfig_newaddr(int index, int family, const char *label,
void __connman_ipconfig_deladdr(int index, int family, const char *label,
unsigned char prefixlen, const char *address);
void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
- const char *dst, const char *gateway);
+ const char *dst, const char *gateway,
+ uint32_t table_id);
void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
- const char *dst, const char *gateway);
+ const char *dst, const char *gateway,
+ uint32_t table_id);
void __connman_ipconfig_foreach(void (*function) (int index, void *user_data),
void *user_data);
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 0f40ac207..011367ec6 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -1038,7 +1038,8 @@ out:
}
void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
- const char *dst, const char *gateway)
+ const char *dst, const char *gateway,
+ uint32_t table_id)
{
struct connman_ipdevice *ipdevice;
char *ifname;
@@ -1099,15 +1100,17 @@ void __connman_ipconfig_newroute(int index, int family, unsigned char scope,
}
}
- connman_info("%s {add} route %s gw %s scope %u <%s>",
- ifname, dst, gateway, scope, scope2str(scope));
+ connman_info("%s {add} route %s gw %s scope %u <%s> table %u <%s>",
+ ifname, dst, gateway, scope, scope2str(scope),
+ table_id, __connman_inet_table2string(table_id));
out:
g_free(ifname);
}
void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
- const char *dst, const char *gateway)
+ const char *dst, const char *gateway,
+ uint32_t table_id)
{
struct connman_ipdevice *ipdevice;
char *ifname;
@@ -1166,8 +1169,9 @@ void __connman_ipconfig_delroute(int index, int family, unsigned char scope,
}
}
- connman_info("%s {del} route %s gw %s scope %u <%s>",
- ifname, dst, gateway, scope, scope2str(scope));
+ connman_info("%s {del} route %s gw %s scope %u <%s> table %u <%s>",
+ ifname, dst, gateway, scope, scope2str(scope),
+ table_id, __connman_inet_table2string(table_id));
out:
g_free(ifname);
diff --git a/src/rtnl.c b/src/rtnl.c
index 056107831..eb0ba6396 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -735,18 +735,20 @@ static void process_newroute(unsigned char family, unsigned char scope,
GSList *list;
char dststr[INET6_ADDRSTRLEN], gatewaystr[INET6_ADDRSTRLEN];
int index = -1;
+ uint32_t table_id = RT_TABLE_UNSPEC;
if (family == AF_INET) {
struct in_addr dst = { INADDR_ANY }, gateway = { INADDR_ANY };
extract_ipv4_route(msg, bytes, &index, &dst, &gateway,
- NULL);
+ &table_id);
inet_ntop(family, &dst, dststr, sizeof(dststr));
inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
__connman_ipconfig_newroute(index, family, scope, dststr,
- gatewaystr);
+ gatewaystr,
+ table_id);
/* skip host specific routes */
if (scope != RT_SCOPE_UNIVERSE &&
@@ -761,13 +763,14 @@ static void process_newroute(unsigned char family, unsigned char scope,
gateway = IN6ADDR_ANY_INIT;
extract_ipv6_route(msg, bytes, &index, &dst, &gateway,
- NULL);
+ &table_id);
inet_ntop(family, &dst, dststr, sizeof(dststr));
inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
__connman_ipconfig_newroute(index, family, scope, dststr,
- gatewaystr);
+ gatewaystr,
+ table_id);
/* skip host specific routes */
if (scope != RT_SCOPE_UNIVERSE &&
@@ -794,18 +797,20 @@ static void process_delroute(unsigned char family, unsigned char scope,
GSList *list;
char dststr[INET6_ADDRSTRLEN], gatewaystr[INET6_ADDRSTRLEN];
int index = -1;
+ uint32_t table_id = RT_TABLE_UNSPEC;
if (family == AF_INET) {
struct in_addr dst = { INADDR_ANY }, gateway = { INADDR_ANY };
extract_ipv4_route(msg, bytes, &index, &dst, &gateway,
- NULL);
+ &table_id);
inet_ntop(family, &dst, dststr, sizeof(dststr));
inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
__connman_ipconfig_delroute(index, family, scope, dststr,
- gatewaystr);
+ gatewaystr,
+ table_id);
/* skip host specific routes */
if (scope != RT_SCOPE_UNIVERSE &&
@@ -820,13 +825,14 @@ static void process_delroute(unsigned char family, unsigned char scope,
gateway = IN6ADDR_ANY_INIT;
extract_ipv6_route(msg, bytes, &index, &dst, &gateway,
- NULL);
+ &table_id);
inet_ntop(family, &dst, dststr, sizeof(dststr));
inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
__connman_ipconfig_delroute(index, family, scope, dststr,
- gatewaystr);
+ gatewaystr,
+ table_id);
/* skip host specific routes */
if (scope != RT_SCOPE_UNIVERSE &&