mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-02 12:52:10 +00:00
.. and deleted NAT again as Christian obviously didn't have the copyright on the code he sent us... THANKS!!!
This commit is contained in:
parent
67d8c7999a
commit
f9f77876a1
@ -13,9 +13,6 @@ HISTORY
|
||||
|
||||
++ New features:
|
||||
|
||||
2010-05-05: Simon Goldschmidt (Christian Walter)
|
||||
* ip_nat.h/.c, opt.h, ip.c, timers.c: task #7506: added NAT support
|
||||
|
||||
2010-05-02: Simon Goldschmidt
|
||||
* netbuf.h/.c, sockets.c, api_msg.c: use checksum-on-copy for sending
|
||||
UDP data for LWIP_NETIF_TX_SINGLE_PBUF==1
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/ip_frag.h"
|
||||
#include "lwip/ip_nat.h"
|
||||
#include "lwip/inet_chksum.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/icmp.h"
|
||||
@ -378,30 +377,15 @@ ip_input(struct pbuf *p, struct netif *inp)
|
||||
|
||||
/* packet not for us? */
|
||||
if (netif == NULL) {
|
||||
#if IP_FORWARD || IP_NAT
|
||||
u8_t taken = 0;
|
||||
#endif /* IP_FORWARD || IP_NAT */
|
||||
/* packet not for us, route or discard */
|
||||
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE, ("ip_input: packet not for us.\n"));
|
||||
#if IP_FORWARD || IP_NAT
|
||||
#if IP_FORWARD
|
||||
/* non-broadcast packet? */
|
||||
if (!ip_addr_isbroadcast(&(iphdr->dest), inp)) {
|
||||
#if IP_NAT
|
||||
/* check if we want to perform NAT with this packet. */
|
||||
taken = ip_nat_out(p);
|
||||
if (!taken)
|
||||
#endif /* IP_NAT */
|
||||
{
|
||||
#if IP_FORWARD
|
||||
/* try to forward IP packet on (other) interfaces */
|
||||
if (ip_forward(p, iphdr, inp) != NULL) {
|
||||
taken = 1;
|
||||
}
|
||||
ip_forward(p, iphdr, inp);
|
||||
} else
|
||||
#endif /* IP_FORWARD */
|
||||
}
|
||||
}
|
||||
if (!taken)
|
||||
#endif /* IP_FORWARD || IP_NAT */
|
||||
{
|
||||
snmp_inc_ipinaddrerrors();
|
||||
snmp_inc_ipindiscards();
|
||||
@ -459,12 +443,6 @@ ip_input(struct pbuf *p, struct netif *inp)
|
||||
current_netif = inp;
|
||||
current_header = iphdr;
|
||||
|
||||
#if IP_NAT
|
||||
if (!ip_addr_isbroadcast(&(iphdr->dest), inp) &&
|
||||
(ip_nat_input(p) != 0)) {
|
||||
LWIP_DEBUGF(IP_DEBUG, ("ip_input: packet consumed by nat layer\n"));
|
||||
} else
|
||||
#endif /* IP_NAT */
|
||||
#if LWIP_RAW
|
||||
/* raw input did not eat the packet? */
|
||||
if (raw_input(p, inp) == 0)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,6 @@
|
||||
#include "lwip/autoip.h"
|
||||
#include "lwip/igmp.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/ip_nat.h"
|
||||
|
||||
|
||||
/** The one and only timeout list */
|
||||
@ -215,22 +214,6 @@ dns_timer(void *arg)
|
||||
}
|
||||
#endif /* LWIP_DNS */
|
||||
|
||||
#if IP_NAT
|
||||
/**
|
||||
* Timer callback function that calls ip_nat_tmr() and reschedules itself.
|
||||
*
|
||||
* @param arg unused argument
|
||||
*/
|
||||
static void
|
||||
nat_timer(void *arg)
|
||||
{
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: nat_timer()\n"));
|
||||
ip_nat_tmr();
|
||||
sys_timeout(LWIP_NAT_TMR_INTERVAL_SEC, nat_timer, NULL);
|
||||
}
|
||||
#endif /* IP_NAT */
|
||||
|
||||
/** Initialize this module */
|
||||
void sys_timeouts_init(void)
|
||||
{
|
||||
@ -253,9 +236,6 @@ void sys_timeouts_init(void)
|
||||
#if LWIP_DNS
|
||||
sys_timeout(DNS_TMR_INTERVAL, dns_timer, NULL);
|
||||
#endif /* LWIP_DNS */
|
||||
#if IP_NAT
|
||||
sys_timeout(LWIP_NAT_TMR_INTERVAL_SEC, nat_timer, NULL);
|
||||
#endif /* IP_NAT */
|
||||
|
||||
#if NO_SYS
|
||||
/* Initialise timestamp for sys_check_timeouts */
|
||||
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Template - A brief description for this module.
|
||||
* Copyright (c) 2008 Christian Walter, © Embedded Solutions, Vienna 2006.
|
||||
*
|
||||
* $Id: ip_nat.h,v 1.1 2010/05/05 19:34:23 goldsimon Exp $
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __LWIP_NAT_H__
|
||||
#define __LWIP_NAT_H__
|
||||
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if IP_NAT
|
||||
|
||||
/** Timer interval at which to call ip_nat_tmr() */
|
||||
#define LWIP_NAT_TMR_INTERVAL_SEC 5
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
struct netif;
|
||||
struct pbuf;
|
||||
|
||||
typedef struct ip_nat_entry
|
||||
{
|
||||
ip_addr_t source_net;
|
||||
ip_addr_t source_netmask;
|
||||
ip_addr_t dest_net;
|
||||
ip_addr_t dest_netmask;
|
||||
struct netif *out_if;
|
||||
struct netif *in_if;
|
||||
} ip_nat_entry_t;
|
||||
|
||||
void ip_nat_init(void);
|
||||
void ip_nat_tmr(void);
|
||||
u8_t ip_nat_input(struct pbuf *p);
|
||||
u8_t ip_nat_out(struct pbuf *p);
|
||||
|
||||
err_t ip_nat_add(const ip_nat_entry_t *new_entry);
|
||||
void ip_nat_remove(const ip_nat_entry_t *remove_entry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* IP_NAT */
|
||||
|
||||
#endif /* __LWIP_NAT_H__ */
|
@ -466,11 +466,6 @@
|
||||
#define IP_FORWARD 0
|
||||
#endif
|
||||
|
||||
/** IP_NAT==1: Enables network address translation code */
|
||||
#ifndef IP_NAT
|
||||
#define IP_NAT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* IP_OPTIONS_ALLOWED: Defines the behavior for IP options.
|
||||
* IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
|
||||
|
Loading…
Reference in New Issue
Block a user