From 7951dea20911969287878e6897b3eca348721ade Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 12 May 2014 10:48:24 +0530 Subject: networkd: introduce ipip tunnel This patch enables basic ipip tunnel support. It works with kernel module ipip example conf: file: ipip.netdev [NetDev] Name=ipip-tun Kind=ipip MTUBytes=1480 [Tunnel] Local=192.168.223.238 Remote=192.169.224.239 TTL=64 file: ipip.network [Match] Name=em1 [Network] Tunnel=ipip-tun [tomegun: - drop unused variable - take ref when enslaving] --- src/network/networkd-network.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/network/networkd-network.c') diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 5d7ce1ced2..d6b06e8a97 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -331,3 +331,42 @@ int config_parse_netdev(const char *unit, return 0; } + +int config_parse_tunnel(const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + Network *network = userdata; + NetDev *netdev; + int r; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + r = netdev_get(network->manager, rvalue, &netdev); + if (r < 0) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Tunnel is invalid, ignoring assignment: %s", rvalue); + return 0; + } + + if (netdev->kind != NETDEV_KIND_IPIP && + netdev->kind != NETDEV_KIND_SIT && + netdev->kind != NETDEV_KIND_GRE) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "NetDev is not a tunnel, ignoring assignment: %s", rvalue); + return 0; + } + + network->tunnel = netdev; + + return 0; +} -- cgit v1.2.3-54-g00ecf