aboutsummaryrefslogtreecommitdiffstats
path: root/src/libhydra/plugins/kernel_netlink
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-08-04 15:35:18 +0200
committerTobias Brunner <tobias@strongswan.org>2014-09-12 10:13:30 +0200
commitc1adf7e0c46140704650a840d2e1319946f3e8c0 (patch)
tree569f6acbb1fdbe0242fcf2fac958cd7861157651 /src/libhydra/plugins/kernel_netlink
parentc6e8b5dc2c005a1aa48fd725f3204c83cd817525 (diff)
downloadstrongswan-c1adf7e0c46140704650a840d2e1319946f3e8c0.tar.bz2
strongswan-c1adf7e0c46140704650a840d2e1319946f3e8c0.tar.xz
kernel-netlink: Add global option to set MTU on installed routes
Diffstat (limited to 'src/libhydra/plugins/kernel_netlink')
-rw-r--r--src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c b/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
index 82b637d1e..1b9dd8410 100644
--- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
@@ -478,6 +478,11 @@ struct private_kernel_netlink_net_t {
* list with routing tables to be excluded from route lookup
*/
linked_list_t *rt_exclude;
+
+ /**
+ * MTU to set on installed routes
+ */
+ u_int32_t mtu;
};
/**
@@ -2055,6 +2060,7 @@ static status_t manage_srcroute(private_kernel_netlink_net_t *this,
netlink_buf_t request;
struct nlmsghdr *hdr;
struct rtmsg *msg;
+ struct rtattr *rta;
int ifindex;
chunk_t chunk;
@@ -2107,6 +2113,17 @@ static status_t manage_srcroute(private_kernel_netlink_net_t *this,
chunk.len = sizeof(ifindex);
netlink_add_attribute(hdr, RTA_OIF, chunk, sizeof(request));
+ if (this->mtu)
+ {
+ chunk = chunk_alloca(RTA_LENGTH(sizeof(struct rtattr) +
+ sizeof(u_int32_t)));
+ rta = (struct rtattr*)chunk.ptr;
+ rta->rta_type = RTAX_MTU;
+ rta->rta_len = chunk.len;
+ memcpy(RTA_DATA(rta), &this->mtu, sizeof(u_int32_t));
+ netlink_add_attribute(hdr, RTA_METRICS, chunk, sizeof(request));
+ }
+
return this->socket->send_ack(this->socket, hdr);
}
@@ -2466,6 +2483,8 @@ kernel_netlink_net_t *kernel_netlink_net_create()
"%s.prefer_temporary_addrs", FALSE, lib->ns),
.roam_events = lib->settings->get_bool(lib->settings,
"%s.plugins.kernel-netlink.roam_events", TRUE, lib->ns),
+ .mtu = lib->settings->get_int(lib->settings,
+ "%s.plugins.kernel-netlink.mtu", 0, lib->ns),
);
timerclear(&this->last_route_reinstall);
timerclear(&this->next_roam);