diff options
Diffstat (limited to 'src/rtnl.c')
-rw-r--r-- | src/rtnl.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -1586,8 +1586,15 @@ static gboolean netlink_event(GIOChannel *chan, GIOCondition cond, gpointer data ssize_t status; int fd; +#if defined TIZEN_EXT + if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) { + __connman_rtnl_init(GIO_SOCKET_RETRY_COUNT); + return FALSE; + } +#else /* TIZEN_EXT */ if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) return FALSE; +#endif /* TIZEN_EXT */ memset(buf, 0, sizeof(buf)); memset(&nladdr, 0, sizeof(nladdr)); @@ -1600,11 +1607,21 @@ static gboolean netlink_event(GIOChannel *chan, GIOCondition cond, gpointer data if (errno == EINTR || errno == EAGAIN) return TRUE; +#if defined TIZEN_EXT + __connman_rtnl_init(GIO_SOCKET_RETRY_COUNT); +#endif /* TIZEN_EXT */ return FALSE; } +#if defined TIZEN_EXT + if (status == 0) { + __connman_rtnl_init(GIO_SOCKET_RETRY_COUNT); + return FALSE; + } +#else /* TIZEN_EXT */ if (status == 0) return FALSE; +#endif /* TIZEN_EXT */ if (nladdr.nl_pid != 0) { /* not sent by kernel, ignore */ DBG("Received msg from %u, ignoring it", nladdr.nl_pid); @@ -1748,19 +1765,34 @@ int __connman_rtnl_request_update(void) return send_getlink(); } +#if defined TIZEN_EXT +int __connman_rtnl_init(int retry_count) +#else /* TIZEN_EXT */ int __connman_rtnl_init(void) +#endif /* TIZEN_EXT */ { struct sockaddr_nl addr; int sk; +#if defined TIZEN_EXT + if (retry_count < 0) + return -1; + + DBG("retry_count %d", retry_count); +#else /* TIZEN_EXT */ DBG(""); +#endif /* TIZEN_EXT */ interface_list = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_interface); sk = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_ROUTE); if (sk < 0) +#if defined TIZEN_EXT + return __connman_rtnl_init(retry_count - 1); +#else /* TIZEN_EXT */ return -1; +#endif /* TIZEN_EXT */ memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; @@ -1770,7 +1802,11 @@ int __connman_rtnl_init(void) if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(sk); +#if defined TIZEN_EXT + return __connman_rtnl_init(retry_count - 1); +#else /* TIZEN_EXT */ return -1; +#endif /* TIZEN_EXT */ } channel = g_io_channel_unix_new(sk); |