[strongSwan-dev] [PATCH] kernel-netlink: Support larger number of routing tables
Volker RĂ¼melin
vr_strongswan at t-online.de
Mon Sep 23 19:42:51 CEST 2019
Increase the maximum limit for configuration variable
charon.routing_table from 2^8-1 to 2^32-1.
---
.../plugins/kernel_netlink/kernel_netlink_net.c | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
index c22e37962..6fd522698 100644
--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
@@ -2653,7 +2653,22 @@ static status_t manage_srcroute(private_kernel_netlink_net_t *this,
msg = NLMSG_DATA(hdr);
msg->rtm_family = src_ip->get_family(src_ip);
msg->rtm_dst_len = prefixlen;
+#if defined(HAVE_RTA_TABLE) && defined(HAVE_LINUX_FIB_RULES_H)
+ if ((uint32_t)this->routing_table < 256)
+ {
+ msg->rtm_table = this->routing_table;
+ }
+ else
+ {
+ uint32_t table = this->routing_table;
+
+ msg->rtm_table = RT_TABLE_UNSPEC;
+ chunk = chunk_from_thing(table);
+ netlink_add_attribute(hdr, RTA_TABLE, chunk, sizeof(request));
+ }
+#else
msg->rtm_table = this->routing_table;
+#endif
msg->rtm_protocol = RTPROT_STATIC;
msg->rtm_type = RTN_UNICAST;
msg->rtm_scope = RT_SCOPE_UNIVERSE;
@@ -2953,7 +2968,20 @@ static status_t manage_rule(private_kernel_netlink_net_t *this, int nlmsg_type,
hdr->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
msg = NLMSG_DATA(hdr);
+#if defined(HAVE_LINUX_FIB_RULES_H) && defined(HAVE_RTA_TABLE)
+ if (table < 256)
+ {
+ msg->rtm_table = table;
+ }
+ else
+ {
+ msg->rtm_table = RT_TABLE_UNSPEC;
+ chunk = chunk_from_thing(table);
+ netlink_add_attribute(hdr, FRA_TABLE, chunk, sizeof(request));
+ }
+#else
msg->rtm_table = table;
+#endif
msg->rtm_family = family;
msg->rtm_protocol = RTPROT_BOOT;
msg->rtm_scope = RT_SCOPE_UNIVERSE;
--
2.16.4
More information about the Dev
mailing list