net/ipfwd: fix ipv4_dev_forward after IOB offload.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2022-12-06 11:49:13 +08:00 committed by archer
parent 2a780e0467
commit 6e9053265c

View File

@ -274,7 +274,7 @@ static int ipv4_dev_forward(FAR struct net_driver_s *dev,
* TLL decrements to zero, then do not forward the packet. * TLL decrements to zero, then do not forward the packet.
*/ */
ret = ipv4_decr_ttl((FAR struct ipv4_hdr_s *)fwd->f_iob->io_data); ret = ipv4_decr_ttl(ipv4);
if (ret < 1) if (ret < 1)
{ {
nwarn("WARNING: Hop limit exceeded... Dropping!\n"); nwarn("WARNING: Hop limit exceeded... Dropping!\n");
@ -285,9 +285,7 @@ static int ipv4_dev_forward(FAR struct net_driver_s *dev,
#ifdef CONFIG_NET_NAT #ifdef CONFIG_NET_NAT
/* Try NAT outbound, rule matching will be performed in NAT module. */ /* Try NAT outbound, rule matching will be performed in NAT module. */
ret = ipv4_nat_outbound(fwd->f_dev, ret = ipv4_nat_outbound(fwd->f_dev, ipv4, NAT_MANIP_SRC);
(FAR struct ipv4_hdr_s *)fwd->f_iob->io_data,
NAT_MANIP_SRC);
if (ret < 0) if (ret < 0)
{ {
nwarn("WARNING: Performing NAT outbound failed, dropping!\n"); nwarn("WARNING: Performing NAT outbound failed, dropping!\n");