diff --git a/os/contiki-net.h b/os/contiki-net.h index 1eb50dd8d..6384c51ef 100644 --- a/os/contiki-net.h +++ b/os/contiki-net.h @@ -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" diff --git a/os/net/app-layer/coap/coap-uip.c b/os/net/app-layer/coap/coap-uip.c index e2be92326..1e817e657 100644 --- a/os/net/app-layer/coap/coap-uip.c +++ b/os/net/app-layer/coap/coap-uip.c @@ -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; diff --git a/os/net/ipv6/uip-nameserver.c b/os/net/ipv6/uip-nameserver.c index 83a1943b0..755b33992 100644 --- a/os/net/ipv6/uip-nameserver.c +++ b/os/net/ipv6/uip-nameserver.c @@ -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; diff --git a/os/net/ipv6/uip.h b/os/net/ipv6/uip.h index 9f5eb159d..e31e80201 100755 --- a/os/net/ipv6/uip.h +++ b/os/net/ipv6/uip.h @@ -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. diff --git a/os/net/ipv6/uiplib.c b/os/net/ipv6/uiplib.c index a6d8b4f0c..e4a7a49b7 100644 --- a/os/net/ipv6/uiplib.c +++ b/os/net/ipv6/uiplib.c @@ -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. */ diff --git a/os/net/ipv6/uiplib.h b/os/net/ipv6/uiplib.h index b30a1bcb5..aaf91282f 100644 --- a/os/net/ipv6/uiplib.h +++ b/os/net/ipv6/uiplib.h @@ -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); diff --git a/os/net/ipv6/uipopt.h b/os/net/ipv6/uipopt.h index 15c79e20a..f01689f4f 100644 --- a/os/net/ipv6/uipopt.h +++ b/os/net/ipv6/uipopt.h @@ -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