瀏覽代碼

sync update net. (#8333)

geniusgogo 1 年之前
父節點
當前提交
3bc29c7673

+ 4 - 0
components/net/lwip/Kconfig

@@ -210,6 +210,10 @@ if RT_USING_LWIP
         int "Enable netif link status callback"
         default 1
 
+    config RT_LWIP_NETIF_NAMESIZE
+        int "netif name length"
+        default 6
+
     config SO_REUSE
         int "Enable SO_REUSEADDR option"
         default 1

+ 24 - 16
components/net/lwip/lwip-1.4.1/src/include/lwip/netif.h

@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Adam Dunkels <adam@sics.se>
  *
  */
@@ -60,6 +60,14 @@ extern "C" {
     across all types of interfaces in use */
 #define NETIF_MAX_HWADDR_LEN 6U
 
+/** The size of a fully constructed netif name which the
+ * netif can be identified by in APIs. Composed of
+ * 2 chars, 3 (max) digits, and 1 \0
+ */
+#ifndef NETIF_NAMESIZE
+#define NETIF_NAMESIZE 6
+#endif
+
 /** Whether the network interface is 'up'. This is
  * a software flag used to control whether this network
  * interface is enabled and processes traffic.
@@ -191,7 +199,7 @@ struct netif {
   /** flags (see NETIF_FLAG_ above) */
   u8_t flags;
   /** descriptive abbreviation */
-  char name[2];
+  char name[NETIF_NAMESIZE];
   /** number of this interface */
   u8_t num;
 #if LWIP_SNMP
@@ -290,7 +298,7 @@ void netif_set_remove_callback(struct netif *netif, netif_status_callback_fn rem
 
 void netif_set_link_up(struct netif *netif);
 void netif_set_link_down(struct netif *netif);
-/** Ask if a link is up */ 
+/** Ask if a link is up */
 #define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
 
 #if LWIP_NETIF_LINK_CALLBACK

+ 9 - 1
components/net/lwip/lwip-2.0.3/src/include/lwip/netif.h

@@ -63,6 +63,14 @@ extern "C" {
 #define NETIF_MAX_HWADDR_LEN 6U
 #endif
 
+/** The size of a fully constructed netif name which the
+ * netif can be identified by in APIs. Composed of
+ * 2 chars, 3 (max) digits, and 1 \0
+ */
+#ifndef NETIF_NAMESIZE
+#define NETIF_NAMESIZE 6
+#endif
+
 /**
  * @defgroup netif_flags Flags
  * @ingroup netif
@@ -304,7 +312,7 @@ struct netif {
   /** flags (@see @ref netif_flags) */
   u8_t flags;
   /** descriptive abbreviation */
-  char name[2];
+  char name[NETIF_NAMESIZE];
   /** number of this interface */
   u8_t num;
 #if MIB2_STATS

+ 4 - 2
components/net/lwip/lwip-2.1.2/src/include/lwip/netif.h

@@ -67,7 +67,9 @@ extern "C" {
  * netif can be identified by in APIs. Composed of
  * 2 chars, 3 (max) digits, and 1 \0
  */
+#ifndef NETIF_NAMESIZE
 #define NETIF_NAMESIZE 6
+#endif
 
 /**
  * @defgroup netif_flags Flags
@@ -344,8 +346,8 @@ struct netif {
   /** flags (@see @ref netif_flags) */
   u8_t flags;
   /** descriptive abbreviation */
-  char name[2];
-  /** number of this interface. Used for @ref if_api and @ref netifapi_netif, 
+  char name[NETIF_NAMESIZE];
+  /** number of this interface. Used for @ref if_api and @ref netifapi_netif,
    * as well as for IPv6 zones */
   u8_t num;
 #if LWIP_IPV6_AUTOCONFIG

+ 20 - 19
components/net/lwip/port/ethernetif.c

@@ -72,6 +72,10 @@
 #include "lwip/ethip6.h"
 #endif /* LWIP_IPV6 */
 
+#if LWIP_NETIF_HOSTNAME
+#define LWIP_HOSTNAME_LEN 16
+#endif
+
 #define netifapi_netif_set_link_up(n)      netifapi_netif_common(n, netif_set_link_up, NULL)
 #define netifapi_netif_set_link_down(n)    netifapi_netif_common(n, netif_set_link_down, NULL)
 
@@ -202,7 +206,7 @@ extern int lwip_ping_recv(int s, int *ttl);
 extern err_t lwip_ping_send(int s, ip_addr_t *addr, int size);
 
 int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
-                        uint32_t timeout, struct netdev_ping_resp *ping_resp)
+                        uint32_t timeout, struct netdev_ping_resp *ping_resp, rt_bool_t isbind)
 {
     int s, ttl, recv_len, result = 0;
     int elapsed_time;
@@ -251,7 +255,9 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
 #else
     local.sin_addr.s_addr = (netif->ip_addr.u_addr.ip4.addr);
 #endif
-    lwip_bind(s, (struct sockaddr *)&local, sizeof(struct sockaddr_in));
+    if (isbind) {
+        lwip_bind(s, (struct sockaddr *)&local, sizeof(struct sockaddr_in));
+    }
 
     lwip_setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &recv_timeout, sizeof(recv_timeout));
 
@@ -385,10 +391,9 @@ static int netdev_flags_sync(struct netif *lwip_netif)
 
 static int netdev_add(struct netif *lwip_netif)
 {
-#define LWIP_NETIF_NAME_LEN 2
     int result = 0;
     struct netdev *netdev = RT_NULL;
-    char name[LWIP_NETIF_NAME_LEN + 1] = {0};
+    char name[NETIF_NAMESIZE] = {0};
 
     RT_ASSERT(lwip_netif);
 
@@ -404,7 +409,7 @@ static int netdev_add(struct netif *lwip_netif)
     sal_lwip_netdev_set_pf_info(netdev);
 #endif /* SAL_USING_LWIP */
 
-    rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN);
+    rt_strncpy(name, lwip_netif->name, NETIF_NAMESIZE);
     result = netdev_register(netdev, name, (void *)lwip_netif);
 
     /* Update netdev info after registered */
@@ -421,12 +426,12 @@ static int netdev_add(struct netif *lwip_netif)
 
 static void netdev_del(struct netif *lwip_netif)
 {
-    char name[LWIP_NETIF_NAME_LEN + 1];
+    char name[NETIF_NAMESIZE];
     struct netdev *netdev;
 
     RT_ASSERT(lwip_netif);
 
-    rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN);
+    rt_strncpy(name, lwip_netif->name, NETIF_NAMESIZE);
     netdev = netdev_get_by_name(name);
     netdev_unregister(netdev);
     rt_free(netdev);
@@ -520,20 +525,20 @@ static err_t eth_netif_device_init(struct netif *netif)
 
         /* set default netif */
         if (netif_default == RT_NULL)
-            netif_set_default(ethif->netif);
+            netif_set_default(netif);
 
         /* set interface up */
-        netif_set_up(ethif->netif);
+        netif_set_up(netif);
 
 #if LWIP_DHCP
         /* if this interface uses DHCP, start the DHCP client */
-        dhcp_start(ethif->netif);
+        dhcp_start(netif);
 #endif
 
         if (ethif->flags & ETHIF_LINK_PHYUP)
         {
             /* set link_up for this netif */
-            netif_set_link_up(ethif->netif);
+            netif_set_link_up(netif);
         }
 
 #ifdef RT_USING_NETDEV
@@ -552,7 +557,6 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
 {
     struct netif* netif;
 #if LWIP_NETIF_HOSTNAME
-#define LWIP_HOSTNAME_LEN 16
     char *hostname = RT_NULL;
     netif = (struct netif*) rt_calloc (1, sizeof(struct netif) + LWIP_HOSTNAME_LEN);
 #else
@@ -577,8 +581,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
     rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR);
 
     /* set name */
-    netif->name[0] = name[0];
-    netif->name[1] = name[1];
+    rt_strncpy(netif->name, name, NETIF_NAMESIZE);
 
     /* set hw address to 6 */
     netif->hwaddr_len   = 6;
@@ -710,16 +713,15 @@ static err_t af_unix_eth_netif_device_init(struct netif *netif)
 
         /* set default netif */
         if (netif_default == RT_NULL)
-            netif_set_default(ethif->netif);
+            netif_set_default(netif);
 
         /* set interface up */
-        netif_set_up(ethif->netif);
-
+        netif_set_up(netif);
 
         if (ethif->flags & ETHIF_LINK_PHYUP)
         {
             /* set link_up for this netif */
-            netif_set_link_up(ethif->netif);
+            netif_set_link_up(netif);
         }
 
 #ifdef RT_USING_NETDEV
@@ -738,7 +740,6 @@ rt_err_t af_unix_eth_device_init_with_flag(struct eth_device *dev, const char *n
 {
     struct netif* netif;
 #if LWIP_NETIF_HOSTNAME
-#define LWIP_HOSTNAME_LEN 16
     char *hostname = RT_NULL;
     netif = (struct netif*) rt_calloc (1, sizeof(struct netif) + LWIP_HOSTNAME_LEN);
 #else

+ 10 - 0
components/net/lwip/port/lwipopts.h

@@ -577,6 +577,16 @@
 #define LWIP_NETIF_HOSTNAME             1
 #endif
 
+/**
+ * RT_LWIP_NETIF_NAMESIZE support netif name length(in netif.c)
+ */
+#ifdef RT_LWIP_NETIF_NAMESIZE
+#if (RT_LWIP_NETIF_NAMESIZE < 2)
+#warning NETIF_NAMESIZE too small, the value must be greater than or equal to 6.
+#define NETIF_NAMESIZE                  RT_LWIP_NETIF_NAMESIZE
+#endif
+#endif /* RT_LWIP_NETIF_NAMESIZE */
+
 /**
  * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
  */

+ 1 - 1
components/net/netdev/include/netdev.h

@@ -137,7 +137,7 @@ struct netdev_ops
 
 #ifdef RT_USING_FINSH
     /* set network interface device common network interface device operations */
-    int (*ping)(struct netdev *netdev, const char *host, size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp);
+    int (*ping)(struct netdev *netdev, const char *host, size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp, rt_bool_t isbind);
     void (*netstat)(struct netdev *netdev);
 #endif
 

+ 45 - 5
components/net/netdev/src/netdev.c

@@ -27,6 +27,10 @@
 #define DBG_LVL              DBG_INFO
 #include <rtdbg.h>
 
+#if defined(SAL_USING_AF_NETLINK)
+#include <route_netlink.h>
+#endif
+
 /* The list of network interface device */
 struct netdev *netdev_list = RT_NULL;
 /* The default network interface device */
@@ -124,6 +128,10 @@ int netdev_register(struct netdev *netdev, const char *name, void *user_data)
         g_netdev_register_callback(netdev, NETDEV_CB_REGISTER);
     }
 
+#if defined(SAL_USING_AF_NETLINK)
+    rtnl_ip_notify(netdev, RTM_NEWLINK);
+#endif
+
     return RT_EOK;
 }
 
@@ -174,6 +182,10 @@ int netdev_unregister(struct netdev *netdev)
     }
     rt_spin_unlock_irqrestore(&_spinlock, level);
 
+#if defined(SAL_USING_AF_NETLINK)
+    rtnl_ip_notify(netdev, RTM_DELLINK);
+#endif
+
     if (netdev_default == RT_NULL)
     {
         netdev_set_default(netdev_list);
@@ -301,7 +313,7 @@ struct netdev *netdev_get_by_name(const char *name)
     for (node = &(netdev_list->list); node; node = rt_slist_next(node))
     {
         netdev = rt_slist_entry(node, struct netdev, list);
-        if (netdev && (rt_strncmp(netdev->name, name, rt_strlen(netdev->name) < RT_NAME_MAX ? rt_strlen(netdev->name) : RT_NAME_MAX) == 0))
+        if (netdev && (rt_strncmp(netdev->name, name, rt_strlen(name) < RT_NAME_MAX ? rt_strlen(name) : RT_NAME_MAX) == 0))
         {
             rt_spin_unlock_irqrestore(&_spinlock, level);
             return netdev;
@@ -427,6 +439,8 @@ void netdev_set_default_change_callback(netdev_callback_fn register_callback)
  */
 int netdev_set_up(struct netdev *netdev)
 {
+    int err = 0;
+
     RT_ASSERT(netdev);
 
     if (!netdev->ops || !netdev->ops->set_up)
@@ -442,7 +456,14 @@ int netdev_set_up(struct netdev *netdev)
     }
 
     /* execute enable network interface device operations by network interface device driver */
-    return netdev->ops->set_up(netdev);
+    err = netdev->ops->set_up(netdev);
+
+#if defined(SAL_USING_AF_NETLINK)
+    if (err)
+        rtnl_ip_notify(netdev, RTM_NEWLINK);
+#endif
+
+    return err;
 }
 /**
  * This function will disable network interface device.
@@ -454,6 +475,8 @@ int netdev_set_up(struct netdev *netdev)
  */
 int netdev_set_down(struct netdev *netdev)
 {
+    int err;
+
     RT_ASSERT(netdev);
 
     if (!netdev->ops || !netdev->ops->set_down)
@@ -469,7 +492,13 @@ int netdev_set_down(struct netdev *netdev)
     }
 
     /* execute disable network interface device operations by network interface driver */
-    return netdev->ops->set_down(netdev);
+    err = netdev->ops->set_down(netdev);
+#if defined(SAL_USING_AF_NETLINK)
+    if (err)
+        rtnl_ip_notify(netdev, RTM_NEWLINK);
+#endif
+
+    return err;
 }
 
 /**
@@ -512,6 +541,7 @@ int netdev_dhcp_enabled(struct netdev *netdev, rt_bool_t is_enabled)
  */
 int netdev_set_ipaddr(struct netdev *netdev, const ip_addr_t *ip_addr)
 {
+    int err;
     RT_ASSERT(netdev);
     RT_ASSERT(ip_addr);
 
@@ -528,7 +558,15 @@ int netdev_set_ipaddr(struct netdev *netdev, const ip_addr_t *ip_addr)
     }
 
      /* execute network interface device set IP address operations */
-    return netdev->ops->set_addr_info(netdev, (ip_addr_t *)ip_addr, RT_NULL, RT_NULL);
+    err = netdev->ops->set_addr_info(netdev, (ip_addr_t *)ip_addr, RT_NULL, RT_NULL);
+
+#if defined(SAL_USING_AF_NETLINK)
+    if (err == 0)
+        rtnl_ip_notify(netdev, RTM_SETLINK);
+#endif
+
+
+    return err;
 }
 
 /**
@@ -1172,6 +1210,7 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_
     struct netdev_ping_resp ping_resp;
     rt_uint32_t index;
     int ret = 0;
+    rt_bool_t isbind = RT_FALSE;
 
     if (size == 0)
     {
@@ -1181,6 +1220,7 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_
     if (netdev_name != RT_NULL)
     {
         netdev = netdev_get_by_name(netdev_name);
+        isbind = RT_TRUE;
     }
 
     if (netdev == RT_NULL)
@@ -1217,7 +1257,7 @@ int netdev_cmd_ping(char* target_name, char *netdev_name, rt_uint32_t times, rt_
 
         rt_memset(&ping_resp, 0x00, sizeof(struct netdev_ping_resp));
         start_tick = rt_tick_get();
-        ret = netdev->ops->ping(netdev, (const char *)target_name, size, NETDEV_PING_RECV_TIMEO, &ping_resp);
+        ret = netdev->ops->ping(netdev, (const char *)target_name, size, NETDEV_PING_RECV_TIMEO, &ping_resp, isbind);
         if (ret == -RT_ETIMEOUT)
         {
             rt_kprintf("ping: from %s icmp_seq=%d timeout\n",

+ 0 - 5
components/net/sal/Kconfig

@@ -34,11 +34,6 @@ if RT_USING_SAL
             Enable BSD socket operated by file system API
             Let BSD socket operated by file system API, such as read/write and involveed in select/poll POSIX APIs.
 
-    config SAL_USING_AF_UNIX
-        bool "Enable support AF_UNIX socket"
-        default n
-        default y if RT_USING_SMART
-
     config SAL_SOCKETS_NUM
         int "the maximum number of sockets"
         depends on !SAL_USING_POSIX

+ 17 - 14
components/net/sal/include/sal_socket.h

@@ -48,17 +48,17 @@ typedef uint16_t in_port_t;
 #define SO_KEEPALIVE    0x0008 /* keep connections alive */
 #define SO_BROADCAST    0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
 
-#define SO_PASSCRED	    16
-#define SO_PEERCRED	    17
+#define SO_PASSCRED     16
+#define SO_PEERCRED     17
 
-#define SO_BINDTODEVICE	    25
-#define SO_ATTACH_FILTER	26
-#define SO_DETACH_FILTER	27
+#define SO_BINDTODEVICE     25
+#define SO_ATTACH_FILTER    26
+#define SO_DETACH_FILTER    27
 
-#define SO_SNDBUFFORCE	32
-#define SO_RCVBUFFORCE	33
-#define SO_PROTOCOL		38
-#define SO_DOMAIN		39
+#define SO_SNDBUFFORCE  32
+#define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
 
 /* Additional options, not kept in so_options */
 #define SO_DEBUG        0x0001 /* Unimplemented: turn on debugging info recording */
@@ -81,18 +81,21 @@ typedef uint16_t in_port_t;
 #define SO_NO_CHECK     0x100a /* don't create UDP checksum */
 
 /* Level number for (get/set)sockopt() to apply to socket itself */
-#define  SOL_SOCKET     0xfff    /* options for socket level */
+#define SOL_SOCKET      0xfff  /* options for socket level */
+#define SOL_NETLINK     270
 
 #define AF_UNSPEC       0
 #define AF_UNIX         1
 #define AF_INET         2
 #define AF_INET6        10
+#define AF_NETLINK      16
 #define AF_CAN          29  /* Controller Area Network      */
 #define AF_AT           45  /* AT socket */
 #define AF_WIZ          46  /* WIZnet socket */
 #define PF_UNIX         AF_UNIX
 #define PF_INET         AF_INET
 #define PF_INET6        AF_INET6
+#define PF_NETLINK      AF_NETLINK
 #define PF_UNSPEC       AF_UNSPEC
 #define PF_CAN          AF_CAN
 #define PF_AT           AF_AT
@@ -165,9 +168,9 @@ typedef struct ip_mreq
 #define IPTOS_PREC_PRIORITY            0x20
 #define IPTOS_PREC_ROUTINE             0x00
 
-#define	SCM_RIGHTS	0x01		    /* rw: access rights (array of int) */
-#define SCM_CREDENTIALS 0x02		/* rw: struct ucred		*/
-#define SCM_SECURITY	0x03		/* rw: security label		*/
+#define SCM_RIGHTS      0x01        /* rw: access rights (array of int) */
+#define SCM_CREDENTIALS 0x02        /* rw: struct ucred */
+#define SCM_SECURITY    0x03        /* rw: security label */
 
 /* Options for shatdown type */
 #ifndef SHUT_RD
@@ -283,7 +286,7 @@ static inline struct cmsghdr *cmsg_nxthdr(struct msghdr *_msg, struct cmsghdr *_
     return __cmsg_nxthdr(_msg->msg_control, _msg->msg_controllen, _cmsg);
 }
 
-#define IFNAMSIZ	16
+#define IFNAMSIZ    16
 struct sal_ifmap
 {
     unsigned long int mem_start;

+ 5 - 1
components/net/sal/src/sal_socket.c

@@ -34,6 +34,10 @@
 #include <lwp_sys_socket.h>
 #endif
 
+#if defined(RT_USING_DFS_V2) && defined(SAL_USING_AF_UNIX)
+#include <af_unix.h>
+#endif
+
 /* check system workqueue stack size */
 #if defined(SAL_INTERNET_CHECK) && RT_SYSTEM_WORKQUEUE_STACKSIZE < 1536
 #error "The system workqueue stack size must more than 1536 bytes"
@@ -684,7 +688,7 @@ int sal_bind(int socket, const struct sockaddr *name, socklen_t namelen)
 
     addr_un = (struct sockaddr_un *)name;
 
-    if (addr_un->sa_family != AF_UNIX)
+    if ((addr_un->sa_family != AF_UNIX) && (addr_un->sa_family != AF_NETLINK))
     {
         /* bind network interface by ip address */
         sal_sockaddr_to_ipaddr(name, &input_ipaddr);