make interface_socket_setup static
authorFelix Fietkau <nbd@openwrt.org>
Mon, 9 Jun 2014 20:20:33 +0000 (22:20 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 9 Jun 2014 20:20:33 +0000 (22:20 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
interface.c
interface.h

index b5022a724b8ba608fdb970c85daea75ea68c6dc3..01aeaa707734e91cd479caf9faebfbce773513ca 100644 (file)
@@ -110,57 +110,8 @@ read_socket(struct uloop_fd *u, unsigned int events)
        dns_handle_packet(iface, buffer, len);
 }
 
-static void
-reconnect_socket(struct uloop_timeout *timeout)
-{
-       struct interface *iface = container_of(timeout, struct interface, reconnect);
-
-       iface->fd.fd = usock(USOCK_UDP | USOCK_SERVER | USOCK_NONBLOCK, MCAST_ADDR, "5353");
-       if (iface->fd.fd < 0) {
-               fprintf(stderr, "failed to add listener: %s\n", strerror(errno));
-               goto retry;
-       }
-
-       if (interface_socket_setup(iface)) {
-               iface->fd.fd = -1;
-               goto retry;
-       }
-
-       uloop_fd_add(&iface->fd, ULOOP_READ);
-       dns_send_question(iface, "_services._dns-sd._udp.local", TYPE_PTR);
-       announce_init(iface);
-       return;
-
-retry:
-       uloop_timeout_set(timeout, 1000);
-}
-
-
-static void interface_start(struct interface *iface)
-{
-       iface->fd.cb = read_socket;
-       iface->reconnect.cb = reconnect_socket;
-       uloop_timeout_set(&iface->reconnect, 100);
-}
-
-static void
-iface_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
-               struct vlist_node *node_old)
-{
-       struct interface *iface;
-
-       if (node_old) {
-               iface = container_of(node_old, struct interface, node);
-               interface_free(iface);
-       }
-
-       if (node_new) {
-               iface = container_of(node_new, struct interface, node);
-               interface_start(iface);
-       }
-}
-
-int interface_socket_setup(struct interface *iface)
+static int
+interface_socket_setup(struct interface *iface)
 {
        struct ip_mreqn mreq;
        uint8_t ttl = 255;
@@ -213,6 +164,56 @@ int interface_socket_setup(struct interface *iface)
        return 0;
 }
 
+static void
+reconnect_socket(struct uloop_timeout *timeout)
+{
+       struct interface *iface = container_of(timeout, struct interface, reconnect);
+
+       iface->fd.fd = usock(USOCK_UDP | USOCK_SERVER | USOCK_NONBLOCK, MCAST_ADDR, "5353");
+       if (iface->fd.fd < 0) {
+               fprintf(stderr, "failed to add listener: %s\n", strerror(errno));
+               goto retry;
+       }
+
+       if (interface_socket_setup(iface)) {
+               iface->fd.fd = -1;
+               goto retry;
+       }
+
+       uloop_fd_add(&iface->fd, ULOOP_READ);
+       dns_send_question(iface, "_services._dns-sd._udp.local", TYPE_PTR);
+       announce_init(iface);
+       return;
+
+retry:
+       uloop_timeout_set(timeout, 1000);
+}
+
+
+static void interface_start(struct interface *iface)
+{
+       iface->fd.cb = read_socket;
+       iface->reconnect.cb = reconnect_socket;
+       uloop_timeout_set(&iface->reconnect, 100);
+}
+
+static void
+iface_update_cb(struct vlist_tree *tree, struct vlist_node *node_new,
+               struct vlist_node *node_old)
+{
+       struct interface *iface;
+
+       if (node_old) {
+               iface = container_of(node_old, struct interface, node);
+               interface_free(iface);
+       }
+
+       if (node_new) {
+               iface = container_of(node_new, struct interface, node);
+               interface_start(iface);
+       }
+}
+
 static const char*
 get_iface_ipv4(const char *ifname)
 {
index b9ecd8aec82ebdd40fa6ca4a533ec53f067d0633..5250e96d333034b71886250e4de18048e32d7172 100644 (file)
@@ -39,6 +39,5 @@ struct interface {
 
 int interface_add(const char *name);
 int interface_send_packet(struct interface *iface, struct iovec *iov, int iov_len);
-int interface_socket_setup(struct interface *iface);
 
 #endif