2017-07-05 19:01:16 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* net/devif/devif_forward.c
|
|
|
|
*
|
2024-09-11 14:39:39 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2017-07-05 19:01:16 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2017-07-05 19:01:16 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2017-07-05 19:01:16 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2017-07-08 05:32:10 +02:00
|
|
|
#include <nuttx/mm/iob.h>
|
2017-07-05 19:01:16 +02:00
|
|
|
#include <nuttx/net/netdev.h>
|
|
|
|
|
2017-07-08 02:45:58 +02:00
|
|
|
#include "ipforward/ipforward.h"
|
2017-07-05 19:01:16 +02:00
|
|
|
#include "devif/devif.h"
|
|
|
|
|
2017-08-08 22:24:12 +02:00
|
|
|
#ifdef CONFIG_NET_IPFORWARD
|
2017-07-05 19:01:16 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: devif_forward
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called from protocol-specific IP forwarding logic to re-send a packet.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* fwd - An initialized instance of the common forwarding structure that
|
|
|
|
* includes everything needed to perform the forwarding operation.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The network is locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void devif_forward(FAR struct forward_s *fwd)
|
|
|
|
{
|
2017-07-07 00:19:10 +02:00
|
|
|
DEBUGASSERT(fwd != NULL && fwd->f_iob != NULL && fwd->f_dev != NULL);
|
2017-07-05 19:01:16 +02:00
|
|
|
|
2022-12-06 07:34:41 +01:00
|
|
|
/* Move the IOB chain that contains the L3 header and any data payload */
|
2017-07-05 19:01:16 +02:00
|
|
|
|
2022-12-06 07:34:41 +01:00
|
|
|
netdev_iob_replace(fwd->f_dev, fwd->f_iob);
|
2017-07-05 19:01:16 +02:00
|
|
|
|
2017-07-08 04:19:26 +02:00
|
|
|
fwd->f_dev->d_sndlen = 0;
|
2022-12-06 07:34:41 +01:00
|
|
|
fwd->f_iob = NULL;
|
2017-07-05 19:01:16 +02:00
|
|
|
}
|
|
|
|
|
2017-08-08 22:24:12 +02:00
|
|
|
#endif /* CONFIG_NET_IPFORWARD */
|