12 int system_bridge_addbr(struct device *bridge)
14 DPRINTF("brctl addbr %s\n", bridge->ifname);
18 int system_bridge_delbr(struct device *bridge)
20 DPRINTF("brctl delbr %s\n", bridge->ifname);
24 int system_bridge_addif(struct device *bridge, struct device *dev)
26 DPRINTF("brctl addif %s %s\n", bridge->ifname, dev->ifname);
30 int system_bridge_delif(struct device *bridge, struct device *dev)
32 DPRINTF("brctl delif %s %s\n", bridge->ifname, dev->ifname);
36 int system_vlan_add(struct device *dev, int id)
38 DPRINTF("vconfig add %s %d\n", dev->ifname, id);
42 int system_vlan_del(struct device *dev)
44 DPRINTF("vconfig rem %s\n", dev->ifname);
48 int system_if_up(struct device *dev)
50 DPRINTF("ifconfig %s up\n", dev->ifname);
54 int system_if_down(struct device *dev)
56 DPRINTF("ifconfig %s down\n", dev->ifname);
60 int system_if_check(struct device *dev)
64 if (!strcmp(dev->ifname, "eth0"))
65 device_set_present(dev, true);
70 int system_add_address(struct device *dev, struct device_addr *addr)
72 uint8_t *a = (uint8_t *) &addr->addr.in;
74 if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET4) {
75 DPRINTF("ifconfig %s add %d.%d.%d.%d/%d\n",
76 dev->ifname, a[0], a[1], a[2], a[3], addr->mask);
84 int system_del_address(struct device *dev, struct device_addr *addr)
86 uint8_t *a = (uint8_t *) &addr->addr.in;
88 if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET4) {
89 DPRINTF("ifconfig %s del %d.%d.%d.%d\n",
90 dev->ifname, a[0], a[1], a[2], a[3]);
98 int system_add_route(struct device *dev, struct device_route *route)
100 uint8_t *a1 = (uint8_t *) &route->addr.in;
101 uint8_t *a2 = (uint8_t *) &route->nexthop.in;
102 char addr[40], gw[40] = "", devstr[64] = "";
104 if ((route->flags & DEVADDR_FAMILY) != DEVADDR_INET4)
108 sprintf(addr, "default");
110 sprintf(addr, "%d.%d.%d.%d/%d",
111 a1[0], a1[1], a1[2], a1[3], route->mask);
113 if (memcmp(a2, "\x00\x00\x00\x00", 4) != 0)
114 sprintf(gw, " gw %d.%d.%d.%d",
115 a2[0], a2[1], a2[2], a2[3]);
117 if (route->flags & DEVADDR_DEVICE)
118 sprintf(devstr, " dev %s", dev->ifname);
120 DPRINTF("route add %s%s%s\n", addr, gw, devstr);
124 int system_del_route(struct device *dev, struct device_route *route)
126 uint8_t *a1 = (uint8_t *) &route->addr.in;
127 uint8_t *a2 = (uint8_t *) &route->nexthop.in;
128 char addr[40], gw[40] = "", devstr[64] = "";
130 if ((route->flags & DEVADDR_FAMILY) != DEVADDR_INET4)
134 sprintf(addr, "default");
136 sprintf(addr, "%d.%d.%d.%d/%d",
137 a1[0], a1[1], a1[2], a1[3], route->mask);
139 if (memcmp(a2, "\x00\x00\x00\x00", 4) != 0)
140 sprintf(gw, " gw %d.%d.%d.%d",
141 a2[0], a2[1], a2[2], a2[3]);
143 if (route->flags & DEVADDR_DEVICE)
144 sprintf(devstr, " dev %s", dev->ifname);
146 DPRINTF("route del %s%s%s\n", addr, gw, devstr);