+ vnet_netlink_msg_t m;
+ struct ifinfomsg ifmsg = { 0 };
+
+ ifmsg.ifi_family = AF_UNSPEC;
+ ifmsg.ifi_index = ifindex;
+ ifmsg.ifi_change = 0xffffffff;
+ vnet_netlink_msg_init (&m, RTM_SETLINK, NLM_F_REQUEST,
+ &ifmsg, sizeof (struct ifinfomsg));
+ vnet_netlink_msg_add_rtattr (&m, IFLA_MASTER, &master_ifindex,
+ sizeof (int));
+ return vnet_netlink_msg_send (&m);
+}
+
+clib_error_t *
+vnet_netlink_set_if_mtu (int ifindex, int mtu)
+{
+ vnet_netlink_msg_t m;
+ struct ifinfomsg ifmsg = { 0 };
+
+ ifmsg.ifi_family = AF_UNSPEC;
+ ifmsg.ifi_index = ifindex;
+ ifmsg.ifi_change = 0xffffffff;
+ vnet_netlink_msg_init (&m, RTM_SETLINK, NLM_F_REQUEST,
+ &ifmsg, sizeof (struct ifinfomsg));
+ vnet_netlink_msg_add_rtattr (&m, IFLA_MTU, &mtu, sizeof (int));
+ return vnet_netlink_msg_send (&m);
+}
+
+clib_error_t *
+vnet_netlink_add_ip4_addr (int ifindex, void *addr, int pfx_len)
+{
+ vnet_netlink_msg_t m;
+ struct ifaddrmsg ifa = { 0 };
+
+ ifa.ifa_family = AF_INET;
+ ifa.ifa_prefixlen = pfx_len;
+ ifa.ifa_index = ifindex;
+
+ vnet_netlink_msg_init (&m, RTM_NEWADDR,
+ NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL,
+ &ifa, sizeof (struct ifaddrmsg));
+
+ vnet_netlink_msg_add_rtattr (&m, IFA_LOCAL, addr, 4);
+ vnet_netlink_msg_add_rtattr (&m, IFA_ADDRESS, addr, 4);
+ return vnet_netlink_msg_send (&m);
+}
+
+clib_error_t *
+vnet_netlink_add_ip6_addr (int ifindex, void *addr, int pfx_len)
+{
+ vnet_netlink_msg_t m;
+ struct ifaddrmsg ifa = { 0 };
+
+ ifa.ifa_family = AF_INET6;
+ ifa.ifa_prefixlen = pfx_len;
+ ifa.ifa_index = ifindex;
+
+ vnet_netlink_msg_init (&m, RTM_NEWADDR,
+ NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL,
+ &ifa, sizeof (struct ifaddrmsg));
+
+ vnet_netlink_msg_add_rtattr (&m, IFA_LOCAL, addr, 16);
+ vnet_netlink_msg_add_rtattr (&m, IFA_ADDRESS, addr, 16);
+ return vnet_netlink_msg_send (&m);