mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Clean up some conditional logic
This commit is contained in:
@@ -228,7 +228,8 @@ static int ipv6_hdrsize(FAR struct ipv6_hdr_s *ipv6)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NETDEV_MULTINIC)
|
#if defined(CONFIG_NETDEV_MULTINIC) && \
|
||||||
|
(defined(CONFIG_NET_UDP) || defined(CONFIG_NET_ICMPv6))
|
||||||
static int ipv6_dev_forward(FAR struct net_driver_s *dev,
|
static int ipv6_dev_forward(FAR struct net_driver_s *dev,
|
||||||
FAR struct ipv6_hdr_s *ipv6,
|
FAR struct ipv6_hdr_s *ipv6,
|
||||||
FAR struct iob_s *iob)
|
FAR struct iob_s *iob)
|
||||||
@@ -248,6 +249,8 @@ static int ipv6_dev_forward(FAR struct net_driver_s *dev,
|
|||||||
nwarn("WARNING: UPD/ICMPv6 packet forwarding not yet supported\n");
|
nwarn("WARNING: UPD/ICMPv6 packet forwarding not yet supported\n");
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
# define ipv6_dev_forward(dev,ipv6,iob) -EPROTONOSUPPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -416,12 +419,18 @@ int ipv6_forward(FAR struct net_driver_s *dev, FAR struct ipv6_hdr_s *ipv6)
|
|||||||
|
|
||||||
/* Then set up to forward the packet */
|
/* Then set up to forward the packet */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_TCP
|
||||||
if (ipv6->proto == IP_PROTO_TCP)
|
if (ipv6->proto == IP_PROTO_TCP)
|
||||||
{
|
{
|
||||||
|
/* Forward a TCP packet, handling ACKs, windowing, etc. */
|
||||||
|
|
||||||
ret = tcp_ipv6_forward(fwddev, ipv6, iob);
|
ret = tcp_ipv6_forward(fwddev, ipv6, iob);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
/* Forward a UDP or ICMPv6 packet */
|
||||||
|
|
||||||
ret = ipv6_dev_forward(fwddev, ipv6, iob);
|
ret = ipv6_dev_forward(fwddev, ipv6, iob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user