aboutsummaryrefslogtreecommitdiffstats
path: root/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-04-19 12:17:25 +0200
committerMartin Willi <martin@revosec.ch>2013-05-06 16:10:13 +0200
commit121783035cbc35c715beff92e28aa6d86d4cab70 (patch)
treede6af736a6e3126ded7ffd189948374304c321b4 /src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
parentf8646dd65ec1265263dc03d82f962c925509fcf7 (diff)
downloadstrongswan-121783035cbc35c715beff92e28aa6d86d4cab70.tar.bz2
strongswan-121783035cbc35c715beff92e28aa6d86d4cab70.tar.xz
kernel-pfroute: split /0 routes to avoid conflict with default route
Diffstat (limited to 'src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c')
-rw-r--r--src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
index 2fda4aebb..f8d3f2c44 100644
--- a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
+++ b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
@@ -897,6 +897,21 @@ static status_t manage_route(private_kernel_pfroute_net_t *this, int op,
host_t *dst;
int type;
+ if (prefixlen == 0 && dst_net.len)
+ {
+ status_t status;
+ chunk_t half;
+
+ half = chunk_clonea(dst_net);
+ half.ptr[0] |= 0x80;
+ prefixlen = 1;
+ status = manage_route(this, op, half, prefixlen, gateway, if_name);
+ if (status != SUCCESS)
+ {
+ return status;
+ }
+ }
+
dst = host_create_from_chunk(AF_UNSPEC, dst_net, 0);
if (!dst)
{