net/: Decouple autoconfig and icmpv6 socket to avoid the invalid kconfig combination.

This commit is contained in:
Xiang Xiao
2019-09-20 12:45:05 -06:00
committed by Gregory Nutt
parent 6d557386f5
commit 6c484847d5
4 changed files with 10 additions and 15 deletions
+2 -1
View File
@@ -369,7 +369,8 @@ static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev,
{ {
/* Perform the ICMPV6 poll /* Perform the ICMPV6 poll
* Note: conn equal NULL in the first iteration means poll dev's callback list * Note: conn equal NULL in the first iteration means poll dev's callback list
* since icmpv6_neighbor still append it's callback into this list. * since icmpv6_autoconfig and icmpv6_neighbor still append it's callback into
* this list.
*/ */
icmpv6_poll(dev, conn); icmpv6_poll(dev, conn);
+1 -3
View File
@@ -421,7 +421,6 @@ void icmpv6_notify(net_ipv6addr_t ipaddr);
* *
* Input Parameters: * Input Parameters:
* dev - The device driver structure to assign the address to * dev - The device driver structure to assign the address to
* psock - A pointer to a NuttX-specific, internal socket structure
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned on * Zero (OK) is returned on success; A negated errno value is returned on
@@ -430,8 +429,7 @@ void icmpv6_notify(net_ipv6addr_t ipaddr);
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_ICMPv6_AUTOCONF #ifdef CONFIG_NET_ICMPv6_AUTOCONF
int icmpv6_autoconfig(FAR struct net_driver_s *dev, int icmpv6_autoconfig(FAR struct net_driver_s *dev);
FAR struct socket *psock);
#endif #endif
/**************************************************************************** /****************************************************************************
+6 -10
View File
@@ -186,7 +186,6 @@ static uint16_t icmpv6_router_eventhandler(FAR struct net_driver_s *dev,
* *
* Input Parameters: * Input Parameters:
* dev - The device to use to send the solicitation * dev - The device to use to send the solicitation
* conn - A pointer to the ICMPv6 connection structure
* advertise - True: Send the Neighbor Advertisement message * advertise - True: Send the Neighbor Advertisement message
* *
* Returned Value: * Returned Value:
@@ -198,9 +197,7 @@ static uint16_t icmpv6_router_eventhandler(FAR struct net_driver_s *dev,
* *
****************************************************************************/ ****************************************************************************/
static int icmpv6_send_message(FAR struct net_driver_s *dev, static int icmpv6_send_message(FAR struct net_driver_s *dev, bool advertise)
FAR struct icmpv6_conn_s *conn,
bool advertise)
{ {
struct icmpv6_router_s state; struct icmpv6_router_s state;
int ret; int ret;
@@ -225,7 +222,7 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev,
* want anything to happen until we are ready. * want anything to happen until we are ready.
*/ */
state.snd_cb = icmpv6_callback_alloc(dev, conn); state.snd_cb = devif_callback_alloc(dev, &dev->d_conncb);
if (!state.snd_cb) if (!state.snd_cb)
{ {
nerr("ERROR: Failed to allocate a cllback\n"); nerr("ERROR: Failed to allocate a cllback\n");
@@ -257,7 +254,7 @@ static int icmpv6_send_message(FAR struct net_driver_s *dev,
while (!state.snd_sent); while (!state.snd_sent);
ret = state.snd_result; ret = state.snd_result;
icmpv6_callback_free(dev, conn, state.snd_cb); devif_dev_callback_free(dev, state.snd_cb);
errout_with_semaphore: errout_with_semaphore:
nxsem_destroy(&state.snd_sem); nxsem_destroy(&state.snd_sem);
@@ -293,9 +290,8 @@ errout_with_semaphore:
* *
****************************************************************************/ ****************************************************************************/
int icmpv6_autoconfig(FAR struct net_driver_s *dev, FAR struct socket *psock) int icmpv6_autoconfig(FAR struct net_driver_s *dev)
{ {
FAR struct icmpv6_conn_s *conn = psock->s_conn;
struct icmpv6_rnotify_s notify; struct icmpv6_rnotify_s notify;
struct timespec delay; struct timespec delay;
net_ipv6addr_t lladdr; net_ipv6addr_t lladdr;
@@ -400,7 +396,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev, FAR struct socket *psock)
/* Send the ICMPv6 Router solicitation message */ /* Send the ICMPv6 Router solicitation message */
ret = icmpv6_send_message(dev, conn, false); ret = icmpv6_send_message(dev, false);
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: Failed send router solicitation: %d\n", ret); nerr("ERROR: Failed send router solicitation: %d\n", ret);
@@ -436,7 +432,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev, FAR struct socket *psock)
* Advertisement message. * Advertisement message.
*/ */
ret = icmpv6_send_message(dev, conn, true); ret = icmpv6_send_message(dev, true);
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: Failed send neighbor advertisement: %d\n", ret); nerr("ERROR: Failed send neighbor advertisement: %d\n", ret);
+1 -1
View File
@@ -897,7 +897,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
dev = netdev_ifr_dev(req); dev = netdev_ifr_dev(req);
if (dev) if (dev)
{ {
ret = icmpv6_autoconfig(dev, psock); ret = icmpv6_autoconfig(dev);
} }
} }
break; break;