forked from nuttx/nuttx-update
forward: limit the forwarding range of broadcast packets
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
4be499a243
commit
6c73221dd4
2 changed files with 20 additions and 2 deletions
|
@ -343,7 +343,16 @@ int ipv4_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
|
|||
FAR struct ipv4_hdr_s *ipv4;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(fwddev != NULL && dev != NULL && dev->d_buf != NULL);
|
||||
DEBUGASSERT(fwddev != NULL);
|
||||
|
||||
/* Only IFF_UP device and non-loopback device need forward packet */
|
||||
|
||||
if (!IFF_IS_UP(fwddev->d_flags) || fwddev->d_lltype == NET_LL_LOOPBACK)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
DEBUGASSERT(dev != NULL && dev->d_buf != NULL);
|
||||
|
||||
/* Check if we are forwarding on the same device that we received the
|
||||
* packet from.
|
||||
|
|
|
@ -470,7 +470,16 @@ int ipv6_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
|
|||
FAR struct ipv6_hdr_s *ipv6;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(fwddev != NULL && dev != NULL && dev->d_buf != NULL);
|
||||
DEBUGASSERT(fwddev != NULL);
|
||||
|
||||
/* Only IFF_UP device and non-loopback device need forward packet */
|
||||
|
||||
if (!IFF_IS_UP(fwddev->d_flags) || fwddev->d_lltype == NET_LL_LOOPBACK)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
DEBUGASSERT(dev != NULL && dev->d_buf != NULL);
|
||||
|
||||
/* Check if we are forwarding on the same device that we received the
|
||||
* packet from.
|
||||
|
|
Loading…
Reference in a new issue