return -ENOMEM;
}
-int system_macvlan_del(struct device *macvlan)
+static int system_link_del(struct device *dev)
{
struct nl_msg *msg;
struct ifinfomsg iim = {
return -1;
nlmsg_append(msg, &iim, sizeof(iim), 0);
+ nla_put_string(msg, IFLA_IFNAME, dev->ifname);
+ return system_rtnl_call(msg);
+}
- nla_put_string(msg, IFLA_IFNAME, macvlan->ifname);
-
- system_rtnl_call(msg);
-
- return 0;
+int system_macvlan_del(struct device *macvlan)
+{
+ return system_link_del(macvlan);
}
static int system_vlan(struct device *dev, int id)
int system_vlandev_del(struct device *vlandev)
{
- struct nl_msg *msg;
- struct ifinfomsg iim = {
- .ifi_family = AF_UNSPEC,
- .ifi_index = 0,
- };
-
- msg = nlmsg_alloc_simple(RTM_DELLINK, NLM_F_REQUEST);
-
- if (!msg)
- return -1;
-
- nlmsg_append(msg, &iim, sizeof(iim), 0);
-
- nla_put_string(msg, IFLA_IFNAME, vlandev->ifname);
-
- system_rtnl_call(msg);
-
- return 0;
+ return system_link_del(vlandev);
}
static void
if (table == RT_TABLE_UNSPEC)
return false;
- /* do not consider main table special */
- if (table == RT_TABLE_MAIN)
- table = RT_TABLE_UNSPEC;
-
*id = table;
return true;
}
+bool system_is_default_rt_table(unsigned int id)
+{
+ return (id == RT_TABLE_MAIN);
+}
+
static int system_iprule(struct iprule *rule, int cmd)
{
int alen = ((rule->flags & IPRULE_FAMILY) == IPRULE_INET4) ? 4 : 16;