#include "netifd.h"
#include "ubus.h"
#include "config.h"
+#include "system.h"
#include "interface.h"
const char *main_path = ".";
return 1;
}
+ if (system_init()) {
+ fprintf(stderr, "Failed to initialize system control\n");
+ return 1;
+ }
+
config_init_interfaces(NULL);
uloop_run();
static int sock_ioctl = -1;
static struct nl_sock *sock_rtnl = NULL;
-static void __init system_init(void)
+int system_init(void)
{
sock_ioctl = socket(AF_LOCAL, SOCK_DGRAM, 0);
fcntl(sock_ioctl, F_SETFD, fcntl(sock_ioctl, F_GETFD) | FD_CLOEXEC);
sock_rtnl = NULL;
}
}
+
+ return -(sock_ioctl < 0 || !sock_rtnl);
}
static int system_rtnl_call(struct nl_msg *msg)
{
- return -!!(!sock_rtnl || nl_send_auto_complete(sock_rtnl, msg)
- || nl_wait_for_ack(sock_rtnl));
+ return -(nl_send_auto_complete(sock_rtnl, msg)
+ || nl_wait_for_ack(sock_rtnl));
}
int system_bridge_addbr(struct device *bridge)
#include "device.h"
#include "interface-ip.h"
+int system_init(void);
+
int system_bridge_addbr(struct device *bridge);
int system_bridge_delbr(struct device *bridge);
int system_bridge_addif(struct device *bridge, struct device *dev);