uIP: remove leftover IPv4 code

This commit is contained in:
Simon Duquennoy 2018-10-17 09:13:42 +02:00
parent 5d43741699
commit b56ff259dc
7 changed files with 2 additions and 112 deletions

View File

@ -44,10 +44,8 @@
#include "net/ipv6/uip-nameserver.h"
#include "net/routing/routing.h"
#if NETSTACK_CONF_WITH_IPV6
#include "net/ipv6/uip-icmp6.h"
#include "net/ipv6/uip-ds6.h"
#endif /* NETSTACK_CONF_WITH_IPV6 */
#include "net/ipv6/resolv.h"

View File

@ -79,11 +79,7 @@
/* direct access into the buffer */
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#if NETSTACK_CONF_WITH_IPV6
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[uip_l2_l3_hdr_len])
#else
#define UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLH_LEN + UIP_IPH_LEN])
#endif
#ifdef WITH_DTLS
static dtls_handler_t cb;

View File

@ -108,7 +108,7 @@ uip_nameserver_update(const uip_ipaddr_t *nameserver, uint32_t lifetime)
* the the eldest ones */
}
}
if(e == NULL) {
if((e = memb_alloc(&dnsmemb)) != NULL) {
list_add(dns, e);
@ -221,11 +221,7 @@ uip_nameserver_count(void)
}
return list_length(dns);
#else /* UIP_NAMESERVER_POOL_SIZE > 1 */
#if NETSTACK_CONF_WITH_IPV6
if(uip_is_addr_unspecified(&serveraddr)) {
#else /* NETSTACK_CONF_WITH_IPV6 */
if(uip_ipaddr_cmp(&serveraddr, &uip_all_zeroes_addr)) {
#endif /* NETSTACK_CONF_WITH_IPV6 */
return 0;
} else {
return 1;

View File

@ -65,7 +65,7 @@
#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
#define UIP_IPICMPH_LEN (UIP_IPH_LEN + UIP_ICMPH_LEN) /* Size of ICMP + IP header */
#define UIP_LLIPH_LEN (UIP_LLH_LEN + UIP_IPH_LEN) /* Size of L2 + IP header */
#if NETSTACK_CONF_WITH_IPV6
/**
* The sums below are quite used in ND. When used for uip_buf, we
* include link layer length when used for uip_len, we do not, hence
@ -76,8 +76,6 @@
#define uip_l2_l3_icmp_hdr_len (UIP_LLH_LEN + UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
#define uip_l3_hdr_len (UIP_IPH_LEN + uip_ext_len)
#define uip_l3_icmp_hdr_len (UIP_IPH_LEN + uip_ext_len + UIP_ICMPH_LEN)
#endif /*NETSTACK_CONF_WITH_IPV6*/
#include "net/ipv6/uipopt.h"
#include "net/ipv6/uipbuf.h"
@ -100,12 +98,7 @@ typedef union uip_ip6addr_t {
uint16_t u16[8];
} uip_ip6addr_t;
#if NETSTACK_CONF_WITH_IPV6
typedef uip_ip6addr_t uip_ipaddr_t;
#else /* NETSTACK_CONF_WITH_IPV6 */
typedef uip_ip4addr_t uip_ipaddr_t;
#endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/
#define UIP_802154_SHORTADDR_LEN 2
@ -1048,11 +1041,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport);
(addr1)->u16[1] == (addr2)->u16[1])
#define uip_ip6addr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
#if NETSTACK_CONF_WITH_IPV6
#define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2)
#else /* NETSTACK_CONF_WITH_IPV6 */
#define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2)
#endif /* NETSTACK_CONF_WITH_IPV6 */
/**
* Compare two IP addresses with netmasks
@ -1320,18 +1309,11 @@ extern uint16_t uip_urglen, uip_surglen;
* This function clears the uIP buffer by reseting the uip_len and
* uip_ext_len pointers.
*/
#if NETSTACK_CONF_WITH_IPV6
#define uip_clear_buf() { \
uip_len = 0; \
uip_ext_len = 0; \
uipbuf_clear_attr();\
}
#else /*NETSTACK_CONF_WITH_IPV6*/
#define uip_clear_buf() { \
uip_len = 0; \
uipbuf_clear_attr();\
}
#endif /*NETSTACK_CONF_WITH_IPV6*/
/**
* Representation of a uIP TCP connection.
@ -1494,13 +1476,11 @@ struct uip_stats {
checksum. */
} udp; /**< UDP statistics. */
#endif /* UIP_UDP */
#if NETSTACK_CONF_WITH_IPV6
struct {
uip_stats_t drop; /**< Number of dropped ND6 packets. */
uip_stats_t recv; /**< Number of recived ND6 packets */
uip_stats_t sent; /**< Number of sent ND6 packets */
} nd6;
#endif /*NETSTACK_CONF_WITH_IPV6*/
};
@ -1621,7 +1601,6 @@ void uip_process(uint8_t flag);
/* The TCP and IP headers. */
struct uip_tcpip_hdr {
#if NETSTACK_CONF_WITH_IPV6
/* IPv6 header. */
uint8_t vtc,
tcflow;
@ -1629,18 +1608,6 @@ struct uip_tcpip_hdr {
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* NETSTACK_CONF_WITH_IPV6 */
/* IPv4 header. */
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* NETSTACK_CONF_WITH_IPV6 */
/* TCP header. */
uint16_t srcport,
@ -1657,7 +1624,6 @@ struct uip_tcpip_hdr {
/* The ICMP and IP headers. */
struct uip_icmpip_hdr {
#if NETSTACK_CONF_WITH_IPV6
/* IPv6 header. */
uint8_t vtc,
tcf;
@ -1665,32 +1631,15 @@ struct uip_icmpip_hdr {
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* NETSTACK_CONF_WITH_IPV6 */
/* IPv4 header. */
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* NETSTACK_CONF_WITH_IPV6 */
/* ICMP header. */
uint8_t type, icode;
uint16_t icmpchksum;
#if !NETSTACK_CONF_WITH_IPV6
uint16_t id, seqno;
uint8_t payload[1];
#endif /* !NETSTACK_CONF_WITH_IPV6 */
};
/* The UDP and IP headers. */
struct uip_udpip_hdr {
#if NETSTACK_CONF_WITH_IPV6
/* IPv6 header. */
uint8_t vtc,
tcf;
@ -1698,18 +1647,6 @@ struct uip_udpip_hdr {
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* NETSTACK_CONF_WITH_IPV6 */
/* IP header. */
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* NETSTACK_CONF_WITH_IPV6 */
/* UDP header. */
uint16_t srcport,
@ -1725,7 +1662,6 @@ struct uip_udpip_hdr {
*/
/* The IP header */
struct uip_ip_hdr {
#if NETSTACK_CONF_WITH_IPV6
/* IPV6 header */
uint8_t vtc;
uint8_t tcflow;
@ -1733,18 +1669,6 @@ struct uip_ip_hdr {
uint8_t len[2];
uint8_t proto, ttl;
uip_ip6addr_t srcipaddr, destipaddr;
#else /* NETSTACK_CONF_WITH_IPV6 */
/* IPV4 header */
uint8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
uint16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* NETSTACK_CONF_WITH_IPV6 */
};
@ -1860,9 +1784,6 @@ struct uip_tcp_hdr {
struct uip_icmp_hdr {
uint8_t type, icode;
uint16_t icmpchksum;
#if !NETSTACK_CONF_WITH_IPV6
uint16_t id, seqno;
#endif /* !NETSTACK_CONF_WITH_IPV6 */
};
@ -1898,7 +1819,6 @@ struct uip_udp_hdr {
#define UIP_PROTO_ICMP6 58
#if NETSTACK_CONF_WITH_IPV6
/** @{ */
/** \brief extension headers types */
#define UIP_PROTO_HBHO 0
@ -1937,9 +1857,6 @@ struct uip_udp_hdr {
/** @} */
#endif /* NETSTACK_CONF_WITH_IPV6 */
#if UIP_FIXEDADDR
extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
#else /* UIP_FIXEDADDR */
@ -1954,10 +1871,6 @@ extern const uip_lladdr_t uip_lladdr;
extern uip_lladdr_t uip_lladdr;
#endif
#if NETSTACK_CONF_WITH_IPV6
/** Length of the link local prefix */
#define UIP_LLPREF_LEN 10
@ -2174,8 +2087,6 @@ extern uip_lladdr_t uip_lladdr;
(((a)->u8[14]) == ((b)->u8[14])) && \
(((a)->u8[15]) == ((b)->u8[15])))
#endif /*NETSTACK_CONF_WITH_IPV6*/
/**
* A non-error message that indicates that a packet should be
* processed locally.

View File

@ -56,7 +56,6 @@
#define LOG_LEVEL LOG_LEVEL_NONE
/*---------------------------------------------------------------------------*/
#if NETSTACK_CONF_WITH_IPV6
int
uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr)
{
@ -118,7 +117,6 @@ uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *ipaddr)
return 1;
}
#endif /* NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/
/* Parse a IPv4-address from a string. Returns the number of characters read
* for the address. */

View File

@ -68,11 +68,7 @@
* \retval 0 If the IP address could not be parsed.
* \retval Non-zero If the IP address was parsed.
*/
#if NETSTACK_CONF_WITH_IPV6
#define uiplib_ipaddrconv uiplib_ip6addrconv
#else /* NETSTACK_CONF_WITH_IPV6 */
#define uiplib_ipaddrconv uiplib_ip4addrconv
#endif /* NETSTACK_CONF_WITH_IPV6 */
int uiplib_ip4addrconv(const char *addrstr, uip_ip4addr_t *addr);
int uiplib_ip6addrconv(const char *addrstr, uip_ip6addr_t *addr);

View File

@ -248,11 +248,6 @@ void uip_log(char *msg);
/** The maximum transmission unit at the IP Layer*/
#define UIP_LINK_MTU 1280
#ifndef NETSTACK_CONF_WITH_IPV6
/** Do we use IPv6 or not (default: no) */
#define NETSTACK_CONF_WITH_IPV6 0
#endif
#ifndef UIP_CONF_IPV6_QUEUE_PKT
/** Do we do per %neighbor queuing during address resolution (default: no) */
#define UIP_CONF_IPV6_QUEUE_PKT 0