[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH 1/2] iplink: implement support for creating vrf interfaces
From: Jan Luebbe <jluebbe () debian ! org>
Date: 2018-02-14 13:05:26
Message-ID: 20180214130527.20071-1-jluebbe () debian ! org
[Download RAW message or body]
VRF interfaces have a mandatory table parameter, which needs to be
specified using a RTNL attribute.
function old new delta
do_add_or_delete 1228 1340 +112
.rodata 149329 149338 +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 121/0) Total: 121 bytes
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
---
networking/libiproute/iplink.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index f38fba055..61b18231d 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -525,6 +525,18 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size)
addattr_l(n, size, IFLA_VLAN_FLAGS, &flags, sizeof(flags));
}
+static void vrf_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size)
+{
+ uint32_t table;
+
+ if (strcmp(*argv, "table") != 0)
+ invarg_1_to_2(*argv, "type vrf");
+
+ NEXT_ARG();
+ table = get_u32(*argv, "table");
+ addattr_l(n, size, IFLA_VRF_TABLE, &table, sizeof(table));
+}
+
#ifndef NLMSG_TAIL
#define NLMSG_TAIL(nmsg) \
((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
@@ -609,6 +621,8 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
if (strcmp(type_str, "vlan") == 0)
vlan_parse_opt(argv, &req.n, sizeof(req));
+ else if (strcmp(type_str, "vrf") == 0)
+ vrf_parse_opt(argv, &req.n, sizeof(req));
data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data;
}
--
2.11.0
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic