Improve icmp handling if MULTINIC enabled. From Max Neklyudov

This commit is contained in:
Gregory Nutt
2015-05-27 09:26:00 -06:00
parent adb617cdcd
commit 8ecb84ed89
9 changed files with 98 additions and 17 deletions
+1
View File
@@ -130,6 +130,7 @@ FAR struct net_driver_s *netdev_default(void);
#ifdef CONFIG_NET_IPv4
# ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr);
void netdev_ipv4_txnotify_dev(FAR struct net_driver_s *dev);
# else
void netdev_ipv4_txnotify(in_addr_t ripaddr);
# endif
+7 -1
View File
@@ -65,6 +65,7 @@
#include "socket/socket.h"
#include "netdev/netdev.h"
#include "devif/devif.h"
#include "igmp/igmp.h"
#include "icmpv6/icmpv6.h"
#include "route/route.h"
@@ -1024,7 +1025,7 @@ void netdev_ifup(FAR struct net_driver_s *dev)
void netdev_ifdown(FAR struct net_driver_s *dev)
{
/* Make sure that the device supports the d_ifdown() method */
/* Check sure that the device supports the d_ifdown() method */
if (dev->d_ifdown)
{
@@ -1041,6 +1042,11 @@ void netdev_ifdown(FAR struct net_driver_s *dev)
dev->d_flags &= ~IFF_UP;
}
}
/* Notify clients that the network has been taken down */
(void)devif_callback_execute(dev, NULL, NETDEV_DOWN,
dev->d_callbacks);
}
}
+4
View File
@@ -247,6 +247,10 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
devfmt = NETDEV_DEFAULT_FORMAT;
#endif
/* There are no clients of the device yet */
dev->d_callbacks = NULL;
/* Get the next available device number and sssign a device name to
* the interface
*/
+31
View File
@@ -166,4 +166,35 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr)
}
#endif /* CONFIG_NET_IPv6 */
/****************************************************************************
* Function: netdev_ipv4_txnotify_dev
*
* Description:
* Notify the device driver that new TX data is available. This variant
* would be called when the upper level logic already understands how the
* packet will be routed.
*
* Parameters:
* dev - The network device driver state structure.
*
* Returned Value:
* None
*
* Assumptions:
* Called from normal user mode
*
****************************************************************************/
#ifdef CONFIG_NETDEV_MULTINIC
void netdev_ipv4_txnotify_dev(FAR struct net_driver_s *dev)
{
if (dev && dev->d_txavail)
{
/* Notify the device driver that new TX data is available. */
(void)dev->d_txavail(dev);
}
}
#endif /* CONFIG_NET_IPv6 */
#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */