eab927705b21c1251a44037b9d706dffc1f9e60d
11 int system_bridge_addbr(struct device
*bridge
)
13 DPRINTF("brctl addbr %s\n", bridge
->ifname
);
17 int system_bridge_delbr(struct device
*bridge
)
19 DPRINTF("brctl delbr %s\n", bridge
->ifname
);
23 int system_bridge_addif(struct device
*bridge
, struct device
*dev
)
25 DPRINTF("brctl addif %s %s\n", bridge
->ifname
, dev
->ifname
);
29 int system_bridge_delif(struct device
*bridge
, struct device
*dev
)
31 DPRINTF("brctl delif %s %s\n", bridge
->ifname
, dev
->ifname
);
35 int system_vlan_add(struct device
*dev
, int id
)
37 DPRINTF("vconfig add %s %d\n", dev
->ifname
, id
);
41 int system_vlan_del(struct device
*dev
)
43 DPRINTF("vconfig rem %s\n", dev
->ifname
);
47 int system_if_up(struct device
*dev
)
49 DPRINTF("ifconfig %s up\n", dev
->ifname
);
53 int system_if_down(struct device
*dev
)
55 DPRINTF("ifconfig %s down\n", dev
->ifname
);
59 int system_if_check(struct device
*dev
)
63 if (!strcmp(dev
->ifname
, "eth0"))
64 device_set_present(dev
, true);
69 int system_add_address(struct device
*dev
, struct device_addr
*addr
)
71 uint8_t *a
= (uint8_t *) &addr
->addr
.in
;
73 if ((addr
->flags
& DEVADDR_FAMILY
) == DEVADDR_INET4
) {
74 DPRINTF("ifconfig %s add %d.%d.%d.%d/%d\n",
75 dev
->ifname
, a
[0], a
[1], a
[2], a
[3], addr
->mask
);
83 int system_del_address(struct device
*dev
, struct device_addr
*addr
)
85 uint8_t *a
= (uint8_t *) &addr
->addr
.in
;
87 if ((addr
->flags
& DEVADDR_FAMILY
) == DEVADDR_INET4
) {
88 DPRINTF("ifconfig %s del %d.%d.%d.%d\n",
89 dev
->ifname
, a
[0], a
[1], a
[2], a
[3]);
97 int system_add_route(struct device
*dev
, struct device_route
*route
)
99 uint8_t *a1
= (uint8_t *) &route
->addr
.in
;
100 uint8_t *a2
= (uint8_t *) &route
->nexthop
.in
;
101 char addr
[40], gw
[40] = "", devstr
[64] = "";
103 if ((route
->flags
& DEVADDR_FAMILY
) != DEVADDR_INET4
)
107 sprintf(addr
, "default");
109 sprintf(addr
, "%d.%d.%d.%d/%d",
110 a1
[0], a1
[1], a1
[2], a1
[3], route
->mask
);
112 if (memcmp(a2
, "\x00\x00\x00\x00", 4) != 0)
113 sprintf(gw
, " gw %d.%d.%d.%d",
114 a2
[0], a2
[1], a2
[2], a2
[3]);
116 if (route
->flags
& DEVADDR_DEVICE
)
117 sprintf(devstr
, " dev %s", dev
->ifname
);
119 DPRINTF("route add %s%s%s\n", addr
, gw
, devstr
);
123 int system_del_route(struct device
*dev
, struct device_route
*route
)
125 uint8_t *a1
= (uint8_t *) &route
->addr
.in
;
126 uint8_t *a2
= (uint8_t *) &route
->nexthop
.in
;
127 char addr
[40], gw
[40] = "", devstr
[64] = "";
129 if ((route
->flags
& DEVADDR_FAMILY
) != DEVADDR_INET4
)
133 sprintf(addr
, "default");
135 sprintf(addr
, "%d.%d.%d.%d/%d",
136 a1
[0], a1
[1], a1
[2], a1
[3], route
->mask
);
138 if (memcmp(a2
, "\x00\x00\x00\x00", 4) != 0)
139 sprintf(gw
, " gw %d.%d.%d.%d",
140 a2
[0], a2
[1], a2
[2], a2
[3]);
142 if (route
->flags
& DEVADDR_DEVICE
)
143 sprintf(devstr
, " dev %s", dev
->ifname
);
145 DPRINTF("route del %s%s%s\n", addr
, gw
, devstr
);