7 int system_bridge_addbr(struct device
*bridge
)
9 DPRINTF("brctl addbr %s\n", bridge
->ifname
);
13 int system_bridge_delbr(struct device
*bridge
)
15 DPRINTF("brctl delbr %s\n", bridge
->ifname
);
19 int system_bridge_addif(struct device
*bridge
, struct device
*dev
)
21 DPRINTF("brctl addif %s %s\n", bridge
->ifname
, dev
->ifname
);
25 int system_bridge_delif(struct device
*bridge
, struct device
*dev
)
27 DPRINTF("brctl delif %s %s\n", bridge
->ifname
, dev
->ifname
);
31 int system_vlan_add(struct device
*dev
, int id
)
33 DPRINTF("vconfig add %s %d\n", dev
->ifname
, id
);
37 int system_vlan_del(struct device
*dev
)
39 DPRINTF("vconfig rem %s\n", dev
->ifname
);
43 int system_if_up(struct device
*dev
)
45 DPRINTF("ifconfig %s up\n", dev
->ifname
);
49 int system_if_down(struct device
*dev
)
51 DPRINTF("ifconfig %s down\n", dev
->ifname
);
55 int system_if_check(struct device
*dev
)
59 if (!strcmp(dev
->ifname
, "eth0"))
60 device_set_present(dev
, true);
65 int system_add_address(struct device
*dev
, struct device_addr
*addr
)
67 uint8_t *a
= (uint8_t *) &addr
->addr
.in
;
69 if ((addr
->flags
& DEVADDR_FAMILY
) == DEVADDR_INET4
) {
70 DPRINTF("ifconfig %s add %d.%d.%d.%d/%d\n",
71 dev
->ifname
, a
[0], a
[1], a
[2], a
[3], addr
->mask
);
79 int system_del_address(struct device
*dev
, struct device_addr
*addr
)
81 uint8_t *a
= (uint8_t *) &addr
->addr
.in
;
83 if ((addr
->flags
& DEVADDR_FAMILY
) == DEVADDR_INET4
) {
84 DPRINTF("ifconfig %s del %d.%d.%d.%d\n",
85 dev
->ifname
, a
[0], a
[1], a
[2], a
[3]);
93 int system_add_route(struct device
*dev
, struct device_route
*route
)
95 uint8_t *a1
= (uint8_t *) &route
->addr
.in
;
96 uint8_t *a2
= (uint8_t *) &route
->nexthop
.in
;
97 char addr
[40], gw
[40] = "", devstr
[64] = "";
99 if ((route
->flags
& DEVADDR_FAMILY
) != DEVADDR_INET4
)
103 sprintf(addr
, "default");
105 sprintf(addr
, "%d.%d.%d.%d/%d",
106 a1
[0], a1
[1], a1
[2], a1
[3], route
->mask
);
108 if (memcmp(a2
, "\x00\x00\x00\x00", 4) != 0)
109 sprintf(gw
, " gw %d.%d.%d.%d",
110 a2
[0], a2
[1], a2
[2], a2
[3]);
112 if (route
->flags
& DEVADDR_DEVICE
)
113 sprintf(devstr
, " dev %s", dev
->ifname
);
115 DPRINTF("route add %s%s%s\n", addr
, gw
, devstr
);
119 int system_del_route(struct device
*dev
, struct device_route
*route
)
121 uint8_t *a1
= (uint8_t *) &route
->addr
.in
;
122 uint8_t *a2
= (uint8_t *) &route
->nexthop
.in
;
123 char addr
[40], gw
[40] = "", devstr
[64] = "";
125 if ((route
->flags
& DEVADDR_FAMILY
) != DEVADDR_INET4
)
129 sprintf(addr
, "default");
131 sprintf(addr
, "%d.%d.%d.%d/%d",
132 a1
[0], a1
[1], a1
[2], a1
[3], route
->mask
);
134 if (memcmp(a2
, "\x00\x00\x00\x00", 4) != 0)
135 sprintf(gw
, " gw %d.%d.%d.%d",
136 a2
[0], a2
[1], a2
[2], a2
[3]);
138 if (route
->flags
& DEVADDR_DEVICE
)
139 sprintf(devstr
, " dev %s", dev
->ifname
);
141 DPRINTF("route del %s%s%s\n", addr
, gw
, devstr
);