args[1] = args[2] = 0;
err = ioctl(sk, SIOCGIFBR, &args);
close(sk);
- if (err == -1)
+ if (err == -1) {
+ connman_error("Missing support for 802.1d ethernet bridging");
return NULL;
+ }
return BRIDGE_NAME;
}
return;
err = __connman_bridge_create(BRIDGE_NAME);
- if (err < 0)
+ if (err < 0) {
+ __sync_fetch_and_sub(&tethering_enabled, 1);
return;
+ }
index = connman_inet_ifindex(BRIDGE_NAME);
dhcp_ippool = __connman_ippool_create(index, 2, 252,
tethering_restart, NULL);
if (dhcp_ippool == NULL) {
connman_error("Fail to create IP pool");
+ __connman_bridge_remove(BRIDGE_NAME);
+ __sync_fetch_and_sub(&tethering_enabled, 1);
return;
}
err = __connman_bridge_enable(BRIDGE_NAME, gateway, broadcast);
if (err < 0 && err != -EALREADY) {
+ __connman_ippool_unref(dhcp_ippool);
__connman_bridge_remove(BRIDGE_NAME);
+ __sync_fetch_and_sub(&tethering_enabled, 1);
return;
}
24 * 3600, dns);
if (tethering_dhcp_server == NULL) {
__connman_bridge_disable(BRIDGE_NAME);
+ __connman_ippool_unref(dhcp_ippool);
__connman_bridge_remove(BRIDGE_NAME);
+ __sync_fetch_and_sub(&tethering_enabled, 1);
return;
}