Clean up some conditional logic

This commit is contained in:
Gregory Nutt
2017-07-03 16:02:59 -06:00
parent 83a875f394
commit eafcf4d059
+10 -1
View File
@@ -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);
} }