+static int system_vlan(struct device *dev, int id)
+{
+ struct vlan_ioctl_args ifr = {
+ .cmd = SET_VLAN_NAME_TYPE_CMD,
+ .u.name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD,
+ };
+
+ ioctl(sock_ioctl, SIOCSIFVLAN, &ifr);
+
+ if (id < 0) {
+ ifr.cmd = DEL_VLAN_CMD;
+ ifr.u.VID = 0;
+ } else {
+ ifr.cmd = ADD_VLAN_CMD;
+ ifr.u.VID = id;
+ }
+ strncpy(ifr.device1, dev->ifname, sizeof(ifr.device1));
+ return ioctl(sock_ioctl, SIOCSIFVLAN, &ifr);
+}
+
+int system_vlan_add(struct device *dev, int id)
+{
+ return system_vlan(dev, id);
+}
+
+int system_vlan_del(struct device *dev)
+{
+ return system_vlan(dev, -1);
+}
+
+int system_if_up(struct device *dev)
+{
+ dev->ifindex = system_if_resolve(dev);
+ return system_if_flags(dev->ifname, IFF_UP, 0);
+}
+
+int system_if_down(struct device *dev)
+{
+ return system_if_flags(dev->ifname, 0, IFF_UP);
+}
+
+int system_if_check(struct device *dev)
+{
+ device_set_present(dev, (system_if_resolve(dev) >= 0));