net/: Lots of build problems introduced into multiple NIC support. Many places where conditional logic based on CONFIG_NETDEV_MULTINIC is confused with CONFIG_NET_MULTILINK. Lots of code changed with IPv6 that was never compiled with MULTINIC enabled. Still some problem with parameter passing.

This commit is contained in:
Gregory Nutt 2015-02-09 18:15:34 -06:00
parent 85d83108ed
commit b756df982d
18 changed files with 56 additions and 49 deletions

View File

@ -222,7 +222,7 @@ int arp_send(in_addr_t ipaddr)
/* Get the device that can route this request */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
dev = netdev_findby_ipv4addr(g_ipv4_allzeroaddr, ipaddr);
#else
dev = netdev_findby_ipv4addr(ipaddr);

View File

@ -369,7 +369,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
/* Notify the device driver of the availability of TX data */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_txnotify(g_ipv4_allzeroaddr, state.png_addr);
#else
netdev_ipv4_txnotify(state.png_addr);

View File

@ -354,6 +354,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
return -ENOSYS;
}
#endif
/* The interface should be in the down state */
save = net_lock();

View File

@ -225,7 +225,7 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
/* Get the device that can route this request */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
dev = netdev_findby_ipv6addr(g_ipv6_allzeroaddr, ipaddr);
#else
dev = netdev_findby_ipv6addr(ipaddr);

View File

@ -439,7 +439,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
/* Notify the device driver of the availability of TX data */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(g_ipv6_allzeroaddr, state.png_addr);
#else
netdev_ipv6_txnotify(state.png_addr);

View File

@ -159,7 +159,7 @@ static void icmpv6_setaddresses(FAR struct net_driver_s *dev,
void icmpv6_rwait_setup(FAR struct net_driver_s *dev,
FAR struct icmpv6_rnotify_s *notify)
{
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
irqstate_t flags;
/* Initialize the wait structure */
@ -206,7 +206,7 @@ void icmpv6_rwait_setup(FAR struct net_driver_s *dev,
int icmpv6_rwait_cancel(FAR struct icmpv6_rnotify_s *notify)
{
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct icmpv6_rnotify_s *curr;
FAR struct icmpv6_rnotify_s *prev;
irqstate_t flags;
@ -332,7 +332,7 @@ int icmpv6_rwait(FAR struct icmpv6_rnotify_s *notify,
void icmpv6_rnotify(FAR struct net_driver_s *dev, const net_ipv6addr_t draddr,
const net_ipv6addr_t prefix, unsigned int preflen)
{
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct icmpv6_rnotify_s *curr;
nvdbg("Notified\n");

View File

@ -100,7 +100,7 @@ FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname);
#if CONFIG_NSOCKET_DESCRIPTORS > 0
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t lipaddr,
in_addr_t ripaddr);
#else
@ -109,7 +109,7 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr);
#endif
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t lipaddr,
const net_ipv6addr_t ripaddr);
#else
@ -128,7 +128,7 @@ FAR struct net_driver_s *netdev_default(void);
#if CONFIG_NSOCKET_DESCRIPTORS > 0
#ifdef CONFIG_NET_IPv4
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr);
# else
void netdev_ipv4_txnotify(in_addr_t ripaddr);
@ -136,7 +136,7 @@ void netdev_ipv4_txnotify(in_addr_t ripaddr);
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
FAR const net_ipv6addr_t ripaddr);
# else
@ -150,7 +150,7 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr);
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL)
#ifdef CONFIG_NET_IPv4
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv4_rxnotify(in_addr_t lipaddr, in_addr_t ripaddr);
# else
void netdev_ipv4_rxnotify(in_addr_t ripaddr);
@ -158,7 +158,7 @@ void netdev_ipv4_rxnotify(in_addr_t ripaddr);
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t lipaddr,
FAR const net_ipv6addr_t ripaddr);
# else
@ -168,7 +168,7 @@ void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t ripaddr);
#else
#ifdef CONFIG_NET_IPv4
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
# define netdev_ipv4_rxnotify(lipaddr,ripaddr)
# else
# define netdev_ipv4_rxnotify(ripaddr)
@ -176,7 +176,7 @@ void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t ripaddr);
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
# define netdev_ipv6_rxnotify(lipaddr,ripaddr)
# else
# define netdev_ipv6_rxnotify(ripaddr)

View File

@ -192,7 +192,7 @@ netdev_finddevice_ipv6addr(const net_ipv6addr_t ripaddr)
*
* Parameters:
* lipaddr - Local, bound address of a connection. Used only if ripaddr
* is the broadcast address. Used only if CONFIG_NET_MULTILINK.
* is the broadcast address. Used only if CONFIG_NETDEV_MULTINIC.
* ripaddr - Remote address of a connection to use in the lookup
*
* Returned Value:
@ -204,7 +204,7 @@ netdev_finddevice_ipv6addr(const net_ipv6addr_t ripaddr)
****************************************************************************/
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t lipaddr,
in_addr_t ripaddr)
#else
@ -221,7 +221,7 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr)
if (net_ipv4addr_cmp(ripaddr, g_ipv4_alloneaddr))
{
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
/* Yes.. Check the local, bound address. Is it INADDR_ANY? */
if (net_ipv4addr_cmp(lipaddr, g_ipv4_allzeroaddr))
@ -283,7 +283,7 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr)
* out subnet to a router and there is no routing information.
*/
#ifndef CONFIG_NET_MULTILINK
#ifndef CONFIG_NETDEV_MULTINIC
/* If there is only a single, registered network interface, then the
* decision is pretty easy. Use that device and its default router
* address.
@ -310,7 +310,7 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr)
*
* Parameters:
* lipaddr - Local, bound address of a connection. Used only if ripaddr
* is the broadcast address. Used only if CONFIG_NET_MULTILINK.
* is the broadcast address. Used only if CONFIG_NETDEV_MULTINIC.
* ripaddr - Remote address of a connection to use in the lookup
*
* Returned Value:
@ -322,7 +322,7 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr)
****************************************************************************/
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t lipaddr,
const net_ipv6addr_t ripaddr)
#else
@ -339,7 +339,7 @@ FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t ripaddr)
if (net_ipv6addr_cmp(ripaddr, g_ipv6_alloneaddr))
{
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
/* Yes.. Check the local, bound address. Is it INADDR_ANY? */
if (net_ipv6addr_cmp(lipaddr, g_ipv6_allzeroaddr))
@ -401,7 +401,7 @@ FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t ripaddr)
* out subnet to a router and there is no routing information.
*/
#ifndef CONFIG_NET_MULTILINK
#ifndef CONFIG_NETDEV_MULTINIC
/* If there is only a single, registered network interface, then the
* decision is pretty easy. Use that device and its default router
* address.

View File

@ -94,7 +94,7 @@
****************************************************************************/
#ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv4_rxnotify(in_addr_t lipaddr, in_addr_t ripaddr)
#else
void netdev_ipv4_rxnotify(in_addr_t ripaddr)
@ -104,7 +104,7 @@ void netdev_ipv4_rxnotify(in_addr_t ripaddr)
/* Find the device driver that serves the subnet of the remote address */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
dev = netdev_findby_ipv4addr(lipaddr, ripaddr);
#else
dev = netdev_findby_ipv4addr(ripaddr);
@ -139,7 +139,7 @@ void netdev_ipv4_rxnotify(in_addr_t ripaddr)
****************************************************************************/
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t lipaddr,
FAR const net_ipv6addr_t ripaddr)
#else
@ -150,7 +150,7 @@ void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t ripaddr)
/* Find the device driver that serves the subnet of the remote address */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
dev = netdev_findby_ipv6addr(lipaddr, ripaddr);
#else
dev = netdev_findby_ipv6addr(ripaddr);

View File

@ -94,7 +94,7 @@
****************************************************************************/
#ifdef CONFIG_NET_IPv4
# ifdef CONFIG_NET_MULTILINK
# ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr)
# else
void netdev_ipv4_txnotify(in_addr_t ripaddr)
@ -104,7 +104,7 @@ void netdev_ipv4_txnotify(in_addr_t ripaddr)
/* Find the device driver that serves the subnet of the remote address */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
dev = netdev_findby_ipv4addr(lipaddr, ripaddr);
#else
dev = netdev_findby_ipv4addr(ripaddr);
@ -140,7 +140,7 @@ void netdev_ipv4_txnotify(in_addr_t ripaddr)
****************************************************************************/
#ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
FAR const net_ipv6addr_t ripaddr)
#else
@ -151,7 +151,7 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr)
/* Find the device driver that serves the subnet of the remote address */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
dev = netdev_findby_ipv6addr(lipaddr, ripaddr);
#else
dev = netdev_findby_ipv6addr(ripaddr);

View File

@ -289,7 +289,7 @@ static inline void netclose_txnotify(FAR struct socket *psock,
{
/* Notify the device driver that send data is available */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
#else
netdev_ipv4_txnotify(conn->u.ipv4.raddr);
@ -305,7 +305,7 @@ static inline void netclose_txnotify(FAR struct socket *psock,
/* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else
netdev_ipv6_txnotify(conn->u.ipv6.raddr);

View File

@ -492,7 +492,7 @@ static inline void sendfile_txnotify(FAR struct socket *psock,
{
/* Notify the device driver that send data is available */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
#else
netdev_ipv4_txnotify(conn->u.ipv4.raddr);
@ -508,7 +508,7 @@ static inline void sendfile_txnotify(FAR struct socket *psock,
/* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else
netdev_ipv6_txnotify(conn->u.ipv6.raddr);

View File

@ -1225,7 +1225,7 @@ static inline void recvfrom_udp_rxnotify(FAR struct socket *psock,
{
/* Notify the device driver of the receive ready */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_rxnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
#else
netdev_ipv4_rxnotify(conn->u.ipv4.raddr);
@ -1241,7 +1241,7 @@ static inline void recvfrom_udp_rxnotify(FAR struct socket *psock,
/* Notify the device driver of the receive ready */
DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_rxnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else
netdev_ipv6_rxnotify(conn->u.ipv6.raddr);

View File

@ -104,7 +104,7 @@ static uint16_t g_last_tcp_port;
****************************************************************************/
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NETDEV_MULTINIC)
static inline FAR struct tcp_conn_s *tcp_ipv4_listener(inaddr_t ipaddr,
static inline FAR struct tcp_conn_s *tcp_ipv4_listener(in_addr_t ipaddr,
uint16_t portno)
{
FAR struct tcp_conn_s *conn;
@ -207,7 +207,7 @@ static inline FAR struct tcp_conn_s *tcp_ipv6_ listener(net_ipv6addr_t ipaddr,
#ifdef CONFIG_NETDEV_MULTINIC
static FAR struct tcp_conn_s *
tcp_listener(uint8_t domain, FAR const union ip_binding_u *ipaddr,
tcp_listener(uint8_t domain, FAR const union ip_addr_u *ipaddr,
uint16_t portno)
{
#ifdef CONFIG_NET_IPv4
@ -521,7 +521,7 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn,
#ifdef CONFIG_NETDEV_MULTINIC
port = tcp_selectport(PF_INET,
(FAR const union ip_addr_u ipaddr *)&addr->sin_addr.s_addr,
(FAR const union ip_addr_u *)&addr->sin_addr.s_addr,
ntohs(addr->sin_port));
#else
port = tcp_selectport(ntohs(addr->sin_port));
@ -539,7 +539,7 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn,
conn->lport = addr->sin_port;
#ifdef CONFIG_NETDEV_MULTINIC
net_ipv4addr_copy(conn->u.ipv4.laddr, ipaddr);
net_ipv4addr_copy(conn->u.ipv4.laddr, addr->sin_addr.s_addr);
#endif
return OK;
@ -1100,7 +1100,13 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr)
flags = net_lock();
#ifdef CONFIG_NETDEV_MULTINIC
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6)
port = tcp_selectport(conn->domain, &conn->u, ntohs(conn->lport));
#elif defined(CONFIG_NET_IPv4)
port = tcp_selectport(PF_INET, &conn->u, ntohs(conn->lport));
#else
port = tcp_selectport(PF_INET6, &conn->u, ntohs(conn->lport));
#endif
#else
port = tcp_selectport(ntohs(conn->lport));
#endif

View File

@ -829,7 +829,7 @@ static inline void send_txnotify(FAR struct socket *psock,
{
/* Notify the device driver that send data is available */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
#else
netdev_ipv4_txnotify(conn->u.ipv4.raddr);
@ -845,7 +845,7 @@ static inline void send_txnotify(FAR struct socket *psock,
/* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else
netdev_ipv6_txnotify(conn->u.ipv6.raddr);

View File

@ -615,7 +615,7 @@ static inline void send_txnotify(FAR struct socket *psock,
{
/* Notify the device driver that send data is available */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
#else
netdev_ipv4_txnotify(conn->u.ipv4.raddr);
@ -631,7 +631,7 @@ static inline void send_txnotify(FAR struct socket *psock,
/* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else
netdev_ipv6_txnotify(conn->u.ipv6.raddr);

View File

@ -596,7 +596,7 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr)
* interfaces for receiving (Sending will use the default port).
*/
net_ipv4addr_copy(conn->u.ipv4.laddr, inaddr->sin_addr.s_addr;);
net_ipv4addr_copy(conn->u.ipv4.laddr, inaddr->sin_addr.s_addr);
#endif /* CONFIG_NETDEV_MULTINIC */
}
#endif /* CONFIG_NET_IPv4 */
@ -646,7 +646,7 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr)
/* Is any other UDP connection already bound to this address and port? */
#ifdef CONFIG_NETDEV_MULTINIC
if (!udp_find_conn(conn->domain, &config->u, portno))
if (!udp_find_conn(conn->domain, &conn->u, portno))
#else
if (!udp_find_conn(portno))
#endif

View File

@ -320,7 +320,7 @@ static inline void sendto_txnotify(FAR struct socket *psock,
{
/* Notify the device driver that send data is available */
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
#else
netdev_ipv4_txnotify(conn->u.ipv4.raddr);
@ -336,7 +336,7 @@ static inline void sendto_txnotify(FAR struct socket *psock,
/* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NET_MULTILINK
#ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else
netdev_ipv6_txnotify(conn->u.ipv6.raddr);