summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2015-04-22 14:14:55 +0530
committerTom Gundersen <teg@jklm.no>2015-04-29 21:54:00 +0200
commit9011ce771f149ba45e8ffdb2ae4f0950cdbc6b8b (patch)
tree2b08be97c22a449051a1213d05ae47351f4b375b /src/network
parent5289f3ff0773bd6d0ce584a06aacb834ffa56fb9 (diff)
networkd: introduce vti6 tunnel
This patch add support to create vti6 tunnel test: vt6.network [Match] Name=wlan0 [Network] Tunnel=ip6vti vti6.netdev [NetDev] Name=ip6vti Kind=vti6 [Tunnel] Local=2a00:ffde:4567:edde::4987 Remote=2001:473:fece:cafe::5179 ip link 11: ip6_vti0@NONE: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default link/tunnel6 :: brd :: 12: ip6vti@wlan0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default link/tunnel6 2a00:ffde:4567:edde::4987 peer 2001:473:fece:cafe::5179
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-netdev-tunnel.c43
-rw-r--r--src/network/networkd-netdev-tunnel.h1
-rw-r--r--src/network/networkd-netdev.c2
-rw-r--r--src/network/networkd-netdev.h2
-rw-r--r--src/network/networkd-network.c1
5 files changed, 49 insertions, 0 deletions
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index 7aa9317a18..aef2ef4fef 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -212,6 +212,31 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
return r;
}
+static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+ Tunnel *t = VTI6(netdev);
+ int r;
+
+ assert(netdev);
+ assert(link);
+ assert(m);
+ assert(t);
+ assert(t->family == AF_INET6);
+
+ r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
+
+ r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
+
+ r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
+
+ return r;
+}
+
static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
Tunnel *t = IP6TNL(netdev);
uint8_t proto;
@@ -287,6 +312,9 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
case NETDEV_KIND_VTI:
t = VTI(netdev);
break;
+ case NETDEV_KIND_VTI6:
+ t = VTI6(netdev);
+ break;
case NETDEV_KIND_IP6TNL:
t = IP6TNL(netdev);
break;
@@ -374,6 +402,12 @@ static void vti_init(NetDev *n) {
Tunnel *t = VTI(n);
assert(n);
+
+ if (n->kind == NETDEV_KIND_VTI)
+ t = VTI(n);
+ else
+ t = VTI6(n);
+
assert(t);
t->pmtudisc = true;
@@ -447,6 +481,15 @@ const NetDevVTable vti_vtable = {
.config_verify = netdev_tunnel_verify,
};
+const NetDevVTable vti6_vtable = {
+ .object_size = sizeof(Tunnel),
+ .init = vti_init,
+ .sections = "Match\0NetDev\0Tunnel\0",
+ .fill_message_create = netdev_vti6_fill_message_create,
+ .create_type = NETDEV_CREATE_STACKED,
+ .config_verify = netdev_tunnel_verify,
+};
+
const NetDevVTable gre_vtable = {
.object_size = sizeof(Tunnel),
.init = gre_init,
diff --git a/src/network/networkd-netdev-tunnel.h b/src/network/networkd-netdev-tunnel.h
index 453d73c596..88f57ac105 100644
--- a/src/network/networkd-netdev-tunnel.h
+++ b/src/network/networkd-netdev-tunnel.h
@@ -55,6 +55,7 @@ struct Tunnel {
extern const NetDevVTable ipip_vtable;
extern const NetDevVTable sit_vtable;
extern const NetDevVTable vti_vtable;
+extern const NetDevVTable vti6_vtable;
extern const NetDevVTable gre_vtable;
extern const NetDevVTable gretap_vtable;
extern const NetDevVTable ip6gre_vtable;
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 78f7c4059f..66fd0fac0a 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -43,6 +43,7 @@ const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = {
[NETDEV_KIND_IP6GRETAP] = &ip6gretap_vtable,
[NETDEV_KIND_SIT] = &sit_vtable,
[NETDEV_KIND_VTI] = &vti_vtable,
+ [NETDEV_KIND_VTI6] = &vti6_vtable,
[NETDEV_KIND_VETH] = &veth_vtable,
[NETDEV_KIND_DUMMY] = &dummy_vtable,
[NETDEV_KIND_TUN] = &tun_vtable,
@@ -65,6 +66,7 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = {
[NETDEV_KIND_SIT] = "sit",
[NETDEV_KIND_VETH] = "veth",
[NETDEV_KIND_VTI] = "vti",
+ [NETDEV_KIND_VTI6] = "vti6",
[NETDEV_KIND_DUMMY] = "dummy",
[NETDEV_KIND_TUN] = "tun",
[NETDEV_KIND_TAP] = "tap",
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
index ff0606715f..8382606f1c 100644
--- a/src/network/networkd-netdev.h
+++ b/src/network/networkd-netdev.h
@@ -50,6 +50,7 @@ typedef enum NetDevKind {
NETDEV_KIND_SIT,
NETDEV_KIND_VETH,
NETDEV_KIND_VTI,
+ NETDEV_KIND_VTI6,
NETDEV_KIND_IP6TNL,
NETDEV_KIND_DUMMY,
NETDEV_KIND_TUN,
@@ -169,6 +170,7 @@ DEFINE_CAST(IP6GRE, Tunnel);
DEFINE_CAST(IP6GRETAP, Tunnel);
DEFINE_CAST(SIT, Tunnel);
DEFINE_CAST(VTI, Tunnel);
+DEFINE_CAST(VTI6, Tunnel);
DEFINE_CAST(IP6TNL, Tunnel);
DEFINE_CAST(VETH, Veth);
DEFINE_CAST(DUMMY, Dummy);
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 64c1b9cce1..4d4972e5d6 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -513,6 +513,7 @@ int config_parse_tunnel(const char *unit,
netdev->kind != NETDEV_KIND_IP6GRE &&
netdev->kind != NETDEV_KIND_IP6GRETAP &&
netdev->kind != NETDEV_KIND_VTI &&
+ netdev->kind != NETDEV_KIND_VTI6 &&
netdev->kind != NETDEV_KIND_IP6TNL
) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,