mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
net/ip: do not drop the udp packet from IP layer
this change to support receive the udp data from the specified port without obtaining the address. e.g: disable the Bootstrap flag on dhcpc handshake Reference: RFC1542: Clarifications and Extensions for the Bootstrap Protocol. Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
+10
-10
@@ -237,16 +237,6 @@ int ipv4_input(FAR struct net_driver_s *dev)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ICMP
|
||||
/* In other cases, the device must be assigned a non-zero IP address. */
|
||||
|
||||
if (net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
|
||||
{
|
||||
nwarn("WARNING: No IP address assigned\n");
|
||||
goto drop;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(CONFIG_NET_BROADCAST) && defined(NET_UDP_HAVE_STACK)
|
||||
/* The address is not the broadcast address and we have been assigned a
|
||||
* address. So there is also the possibility that the destination address
|
||||
@@ -307,6 +297,7 @@ int ipv4_input(FAR struct net_driver_s *dev)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (ipv4->proto != IP_PROTO_UDP)
|
||||
{
|
||||
/* Not destined for us and not forwardable... Drop the
|
||||
* packet.
|
||||
@@ -322,6 +313,15 @@ int ipv4_input(FAR struct net_driver_s *dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_NET_ICMP
|
||||
/* In other cases, the device must be assigned a non-zero IP address. */
|
||||
|
||||
else if (net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
|
||||
{
|
||||
nwarn("WARNING: No IP address assigned\n");
|
||||
goto drop;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ipv4_chksum(dev) != 0xffff)
|
||||
{
|
||||
|
||||
+13
-16
@@ -409,22 +409,6 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
* address by its IPv6 nexthdr field.
|
||||
*/
|
||||
}
|
||||
|
||||
/* In other cases, the device must be assigned a non-zero IP address
|
||||
* (the all zero address is the "unspecified" address.
|
||||
*/
|
||||
|
||||
else
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
if (net_ipv6addr_cmp(dev->d_ipv6addr, g_ipv6_unspecaddr))
|
||||
{
|
||||
nwarn("WARNING: No IP address assigned\n");
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/* Check if the packet is destined for out IP address */
|
||||
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -449,6 +433,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (nxthdr != IP_PROTO_UDP)
|
||||
{
|
||||
/* Not destined for us and not forwardable... drop the packet. */
|
||||
|
||||
@@ -457,6 +442,18 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
|
||||
/* In other cases, the device must be assigned a non-zero IP address
|
||||
* (the all zero address is the "unspecified" address.
|
||||
*/
|
||||
|
||||
if (net_ipv6addr_cmp(dev->d_ipv6addr, g_ipv6_unspecaddr))
|
||||
{
|
||||
nwarn("WARNING: No IP address assigned\n");
|
||||
goto drop;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now process the incoming packet according to the protocol specified in
|
||||
* the next header IPv6 field.
|
||||
|
||||
Reference in New Issue
Block a user