19 int system_bridge_addbr(struct device *bridge)
21 DPRINTF("brctl addbr %s\n", bridge->ifname);
25 int system_bridge_delbr(struct device *bridge)
27 DPRINTF("brctl delbr %s\n", bridge->ifname);
31 int system_bridge_addif(struct device *bridge, struct device *dev)
33 DPRINTF("brctl addif %s %s\n", bridge->ifname, dev->ifname);
37 int system_bridge_delif(struct device *bridge, struct device *dev)
39 DPRINTF("brctl delif %s %s\n", bridge->ifname, dev->ifname);
43 int system_vlan_add(struct device *dev, int id)
45 DPRINTF("vconfig add %s %d\n", dev->ifname, id);
49 int system_vlan_del(struct device *dev)
51 DPRINTF("vconfig rem %s\n", dev->ifname);
55 int system_if_up(struct device *dev)
57 DPRINTF("ifconfig %s up\n", dev->ifname);
61 int system_if_down(struct device *dev)
63 DPRINTF("ifconfig %s down\n", dev->ifname);
67 int system_if_check(struct device *dev)
71 if (!strcmp(dev->ifname, "eth0"))
72 device_set_present(dev, true);
77 int system_add_address(struct device *dev, struct device_addr *addr)
79 uint8_t *a = (uint8_t *) &addr->addr.in;
82 if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET4) {
83 DPRINTF("ifconfig %s add %d.%d.%d.%d/%d\n",
84 dev->ifname, a[0], a[1], a[2], a[3], addr->mask);
86 inet_ntop(AF_INET6, &addr->addr.in6, ipaddr, sizeof(struct in6_addr));
87 DPRINTF("ifconfig %s add %s/%d\n",
88 dev->ifname, ipaddr, addr->mask);
95 int system_del_address(struct device *dev, struct device_addr *addr)
97 uint8_t *a = (uint8_t *) &addr->addr.in;
100 if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET4) {
101 DPRINTF("ifconfig %s del %d.%d.%d.%d\n",
102 dev->ifname, a[0], a[1], a[2], a[3]);
104 inet_ntop(AF_INET6, &addr->addr.in6, ipaddr, sizeof(struct in6_addr));
105 DPRINTF("ifconfig %s del %s/%d\n",
106 dev->ifname, ipaddr, addr->mask);
113 int system_add_route(struct device *dev, struct device_route *route)
115 uint8_t *a1 = (uint8_t *) &route->addr.in;
116 uint8_t *a2 = (uint8_t *) &route->nexthop.in;
117 char addr[40], gw[40] = "", devstr[64] = "";
119 if ((route->flags & DEVADDR_FAMILY) != DEVADDR_INET4)
123 sprintf(addr, "default");
125 sprintf(addr, "%d.%d.%d.%d/%d",
126 a1[0], a1[1], a1[2], a1[3], route->mask);
128 if (memcmp(a2, "\x00\x00\x00\x00", 4) != 0)
129 sprintf(gw, " gw %d.%d.%d.%d",
130 a2[0], a2[1], a2[2], a2[3]);
132 if (route->flags & DEVADDR_DEVICE)
133 sprintf(devstr, " dev %s", dev->ifname);
135 DPRINTF("route add %s%s%s\n", addr, gw, devstr);
139 int system_del_route(struct device *dev, struct device_route *route)
141 uint8_t *a1 = (uint8_t *) &route->addr.in;
142 uint8_t *a2 = (uint8_t *) &route->nexthop.in;
143 char addr[40], gw[40] = "", devstr[64] = "";
145 if ((route->flags & DEVADDR_FAMILY) != DEVADDR_INET4)
149 sprintf(addr, "default");
151 sprintf(addr, "%d.%d.%d.%d/%d",
152 a1[0], a1[1], a1[2], a1[3], route->mask);
154 if (memcmp(a2, "\x00\x00\x00\x00", 4) != 0)
155 sprintf(gw, " gw %d.%d.%d.%d",
156 a2[0], a2[1], a2[2], a2[3]);
158 if (route->flags & DEVADDR_DEVICE)
159 sprintf(devstr, " dev %s", dev->ifname);
161 DPRINTF("route del %s%s%s\n", addr, gw, devstr);