aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-07-29 12:16:18 +0200
committerTobias Brunner <tobias@strongswan.org>2011-07-29 12:16:18 +0200
commit2e370a300d639366547796b55cac37000464bebb (patch)
tree47227316257e82c434af4313059866d6862cb41f
parent50937e8b803a89783fef1e4f85a11470c206f345 (diff)
downloadstrongswan-2e370a300d639366547796b55cac37000464bebb.tar.bz2
strongswan-2e370a300d639366547796b55cac37000464bebb.tar.xz
Allow routing table IDs > 255 when filtering them.
-rw-r--r--src/include/linux/rtnetlink.h1
-rw-r--r--src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/src/include/linux/rtnetlink.h b/src/include/linux/rtnetlink.h
index 131822c0f..56835d8bd 100644
--- a/src/include/linux/rtnetlink.h
+++ b/src/include/linux/rtnetlink.h
@@ -263,6 +263,7 @@ enum rtattr_type_t
RTA_CACHEINFO,
RTA_SESSION,
RTA_MP_ALGO,
+ RTA_TABLE,
__RTA_MAX
};
diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c b/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
index 9161be73d..9d67a6007 100644
--- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
@@ -904,7 +904,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
struct rtattr *rta;
size_t rtasize;
chunk_t rta_gtw, rta_src, rta_dst;
- u_int32_t rta_oif = 0;
+ u_int32_t rta_oif = 0, rta_table;
host_t *new_src, *new_gtw;
bool cont = FALSE;
uintptr_t table;
@@ -913,6 +913,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
msg = (struct rtmsg*)(NLMSG_DATA(current));
rta = RTM_RTA(msg);
rtasize = RTM_PAYLOAD(current);
+ rta_table = msg->rtm_table;
while (RTA_OK(rta, rtasize))
{
switch (rta->rta_type)
@@ -932,6 +933,12 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
rta_oif = *(u_int32_t*)RTA_DATA(rta);
}
break;
+ case RTA_TABLE:
+ if (RTA_PAYLOAD(rta) == sizeof(rta_table))
+ {
+ rta_table = *(u_int32_t*)RTA_DATA(rta);
+ }
+ break;
}
rta = RTA_NEXT(rta, rtasize);
}
@@ -942,7 +949,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
enumerator = this->rt_exclude->create_enumerator(this->rt_exclude);
while (enumerator->enumerate(enumerator, &table))
{
- if (table == msg->rtm_table)
+ if (table == rta_table)
{
cont = TRUE;
break;
@@ -954,7 +961,7 @@ static host_t *get_route(private_kernel_netlink_net_t *this, host_t *dest,
continue;
}
if (this->routing_table != 0 &&
- msg->rtm_table == this->routing_table)
+ rta_table == this->routing_table)
{ /* route is from our own ipsec routing table */
continue;
}