Remove various bits of header cruft.
Mostly BSD _KERNEL stuff.
Change-Id: Ic0a6914437d0c831a83588a435079d0c719fcbdf
diff --git a/libc/include/net/if_ether.h b/libc/include/net/if_ether.h
index 06cceb1..b1d2bce 100644
--- a/libc/include/net/if_ether.h
+++ b/libc/include/net/if_ether.h
@@ -34,15 +34,9 @@
#ifndef _NET_IF_ETHER_H_
#define _NET_IF_ETHER_H_
+#include <sys/cdefs.h>
#include <sys/types.h>
-#ifdef _KERNEL
-#ifdef _KERNEL_OPT
-#include "opt_mbuftrace.h"
-#endif
-#include <sys/mbuf.h>
-#endif
-
/*
* Some basic Ethernet constants.
*/
@@ -55,11 +49,6 @@
#define ETHER_MAX_LEN_JUMBO 9018 /* maximum jumbo frame len, including CRC */
/*
- * Some Ethernet extensions.
- */
-#define ETHER_VLAN_ENCAP_LEN 4 /* length of 802.1Q VLAN encapsulation */
-
-/*
* Ethernet address - 6 octets
* this is only used by the ethers(3) functions.
*/
@@ -78,37 +67,11 @@
#include <net/ethertypes.h>
-#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
-
#define ETHERMTU_JUMBO (ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
/*
- * Compute the maximum frame size based on ethertype (i.e. possible
- * encapsulation) and whether or not an FCS is present.
- */
-#define ETHER_MAX_FRAME(ifp, etype, hasfcs) \
- ((ifp)->if_mtu + ETHER_HDR_LEN + \
- ((hasfcs) ? ETHER_CRC_LEN : 0) + \
- (((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0))
-
-/*
- * Ethernet CRC32 polynomials (big- and little-endian verions).
- */
-#define ETHER_CRC_POLY_LE 0xedb88320
-#define ETHER_CRC_POLY_BE 0x04c11db6
-
-#ifndef _STANDALONE
-
-/*
- * Ethernet-specific mbuf flags.
- */
-#define M_HASFCS M_LINK0 /* FCS included at end of frame */
-#define M_PROMISC M_LINK1 /* this packet is not for us */
-
-#ifdef _KERNEL
-/*
* Macro to map an IP multicast address to an Ethernet multicast address.
* The high-order 25 bits of the Ethernet address are statically assigned,
* and the low-order 23 bits are taken from the low end of the IP address.
@@ -140,76 +103,12 @@
(enaddr)[4] = ((u_int8_t *)ip6addr)[14]; \
(enaddr)[5] = ((u_int8_t *)ip6addr)[15]; \
}
-#endif
-#define ETHERCAP_VLAN_MTU 0x00000001 /* VLAN-compatible MTU */
-#define ETHERCAP_VLAN_HWTAGGING 0x00000002 /* hardware VLAN tag support */
-#define ETHERCAP_JUMBO_MTU 0x00000004 /* 9000 byte MTU supported */
-
-#ifdef _KERNEL
-extern const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN];
-extern const uint8_t ethermulticastaddr_slowprotocols[ETHER_ADDR_LEN];
-extern const uint8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
-extern const uint8_t ether_ipmulticast_max[ETHER_ADDR_LEN];
-
-int ether_ioctl(struct ifnet *, u_long, caddr_t);
-int ether_addmulti (struct ifreq *, struct ethercom *);
-int ether_delmulti (struct ifreq *, struct ethercom *);
-int ether_changeaddr (struct ifreq *, struct ethercom *);
-int ether_multiaddr(struct sockaddr *, u_int8_t[], u_int8_t[]);
-
-/*
- * Ethernet 802.1Q VLAN structures.
- */
-
-/* add VLAN tag to input/received packet */
-#define VLAN_INPUT_TAG(ifp, m, vlanid, _errcase) \
- do { \
- struct m_tag *mtag = \
- m_tag_get(PACKET_TAG_VLAN, sizeof(u_int), M_NOWAIT);\
- if (mtag == NULL) { \
- ifp->if_ierrors++; \
- printf("%s: unable to allocate VLAN tag\n", \
- ifp->if_xname); \
- m_freem(m); \
- _errcase; \
- } \
- *(u_int *)(mtag + 1) = vlanid; \
- m_tag_prepend(m, mtag); \
- } while(0)
-
-/* extract VLAN tag from output/trasmit packet */
-#define VLAN_OUTPUT_TAG(ec, m0) \
- VLAN_ATTACHED(ec) ? m_tag_find((m0), PACKET_TAG_VLAN, NULL) : NULL
-
-/* extract VLAN ID value from a VLAN tag */
-#define VLAN_TAG_VALUE(mtag) \
- ((*(u_int *)(mtag + 1)) & 4095)
-
-/* test if any VLAN is configured for this interface */
-#define VLAN_ATTACHED(ec) ((ec)->ec_nvlans > 0)
-
-void ether_ifattach(struct ifnet *, const u_int8_t *);
-void ether_ifdetach(struct ifnet *);
-
-char *ether_sprintf(const u_int8_t *);
-char *ether_snprintf(char *, size_t, const u_int8_t *);
-
-u_int32_t ether_crc32_le(const u_int8_t *, size_t);
-u_int32_t ether_crc32_be(const u_int8_t *, size_t);
-
-int ether_nonstatic_aton(u_char *, char *);
-#else
-/*
- * Prototype ethers(3) functions.
- */
-#include <sys/cdefs.h>
__BEGIN_DECLS
-char* ether_ntoa __P((const struct ether_addr*)) __INTRODUCED_IN(21);
-struct ether_addr* ether_aton __P((const char*)) __INTRODUCED_IN(21);
-__END_DECLS
-#endif
-#endif /* _STANDALONE */
+char* ether_ntoa(const struct ether_addr*) __INTRODUCED_IN(21);
+struct ether_addr* ether_aton(const char*) __INTRODUCED_IN(21);
+
+__END_DECLS
#endif /* !_NET_IF_ETHER_H_ */
diff --git a/libc/include/netinet/icmp6.h b/libc/include/netinet/icmp6.h
index 6625712..e3e6e9a 100644
--- a/libc/include/netinet/icmp6.h
+++ b/libc/include/netinet/icmp6.h
@@ -107,13 +107,6 @@
#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
-#ifndef _KERNEL
-/* the followings are for backward compatibility to old KAME apps. */
-#define MLD6_LISTENER_QUERY MLD_LISTENER_QUERY
-#define MLD6_LISTENER_REPORT MLD_LISTENER_REPORT
-#define MLD6_LISTENER_DONE MLD_LISTENER_DONE
-#endif
-
#define ND_ROUTER_SOLICIT 133 /* router solicitation */
#define ND_ROUTER_ADVERT 134 /* router advertisement */
#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
@@ -134,12 +127,6 @@
#define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */
#define MLD_MTRACE 201 /* mtrace messages */
-#ifndef _KERNEL
-/* the followings are for backward compatibility to old KAME apps. */
-#define MLD6_MTRACE_RESP MLD_MTRACE_RESP
-#define MLD6_MTRACE MLD_MTRACE
-#endif
-
#define ICMP6_MAXTYPE 201
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
@@ -185,17 +172,6 @@
struct in6_addr mld_addr; /* multicast address */
} __packed;
-/* definitions to provide backward compatibility to old KAME applications */
-#ifndef _KERNEL
-#define mld6_hdr mld_hdr
-#define mld6_type mld_type
-#define mld6_code mld_code
-#define mld6_cksum mld_cksum
-#define mld6_maxdelay mld_maxdelay
-#define mld6_reserved mld_reserved
-#define mld6_addr mld_addr
-#endif
-
/* shortcut macro definitions */
#define mld_type mld_icmp6_hdr.icmp6_type
#define mld_code mld_icmp6_hdr.icmp6_code
@@ -562,233 +538,4 @@
* END android-changed
*/
-/*
- * Variables related to this implementation
- * of the internet control message protocol version 6.
- */
-
-/*
- * IPv6 ICMP statistics.
- * Each counter is an unsigned 64-bit value.
- */
-#define ICMP6_STAT_ERROR 0 /* # of calls to icmp6_error */
-#define ICMP6_STAT_CANTERROR 1 /* no error (old was icmp) */
-#define ICMP6_STAT_TOOFREQ 2 /* no error (rate limitation) */
-#define ICMP6_STAT_OUTHIST 3 /* # of output messages */
- /* space for 256 counters */
-#define ICMP6_STAT_BADCODE 259 /* icmp6_code out of range */
-#define ICMP6_STAT_TOOSHORT 260 /* packet < sizeof(struct icmp6_hdr) */
-#define ICMP6_STAT_CHECKSUM 261 /* bad checksum */
-#define ICMP6_STAT_BADLEN 262 /* calculated bound mismatch */
- /*
- * number of responses; this member is inherited from the netinet code,
- * but for netinet6 code, it is already available in outhist[].
- */
-#define ICMP6_STAT_REFLECT 263
-#define ICMP6_STAT_INHIST 264 /* # of input messages */
- /* space for 256 counters */
-#define ICMP6_STAT_ND_TOOMANYOPT 520 /* too many ND options */
-#define ICMP6_STAT_OUTERRHIST 521
- /* space for 13 counters */
-#define ICMP6_STAT_PMTUCHG 534 /* path MTU changes */
-#define ICMP6_STAT_ND_BADOPT 535 /* bad ND options */
-#define ICMP6_STAT_BADNS 536 /* bad neighbor solicititation */
-#define ICMP6_STAT_BADNA 537 /* bad neighbor advertisement */
-#define ICMP6_STAT_BADRS 538 /* bad router solicitiation */
-#define ICMP6_STAT_BADRA 539 /* bad router advertisement */
-#define ICMP6_STAT_BADREDIRECT 540 /* bad redirect message */
-#define ICMP6_STAT_DROPPED_RAROUTE 541 /* discarded routes from router advertisement */
-
-#define ICMP6_NSTATS 542
-
-#define ICMP6_ERRSTAT_DST_UNREACH_NOROUTE 0
-#define ICMP6_ERRSTAT_DST_UNREACH_ADMIN 1
-#define ICMP6_ERRSTAT_DST_UNREACH_BEYONDSCOPE 2
-#define ICMP6_ERRSTAT_DST_UNREACH_ADDR 3
-#define ICMP6_ERRSTAT_DST_UNREACH_NOPORT 4
-#define ICMP6_ERRSTAT_PACKET_TOO_BIG 5
-#define ICMP6_ERRSTAT_TIME_EXCEED_TRANSIT 6
-#define ICMP6_ERRSTAT_TIME_EXCEED_REASSEMBLY 7
-#define ICMP6_ERRSTAT_PARAMPROB_HEADER 8
-#define ICMP6_ERRSTAT_PARAMPROB_NEXTHEADER 9
-#define ICMP6_ERRSTAT_PARAMPROB_OPTION 10
-#define ICMP6_ERRSTAT_REDIRECT 11
-#define ICMP6_ERRSTAT_UNKNOWN 12
-
-/*
- * Names for ICMP sysctl objects
- */
-#define ICMPV6CTL_STATS 1
-#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */
-#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */
-#if 0 /*obsoleted*/
-#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */
-#endif
-#define ICMPV6CTL_ND6_PRUNE 6
-#define ICMPV6CTL_ND6_DELAY 8
-#define ICMPV6CTL_ND6_UMAXTRIES 9
-#define ICMPV6CTL_ND6_MMAXTRIES 10
-#define ICMPV6CTL_ND6_USELOOPBACK 11
-/*#define ICMPV6CTL_ND6_PROXYALL 12 obsoleted, do not reuse here */
-#define ICMPV6CTL_NODEINFO 13
-#define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */
-#define ICMPV6CTL_ND6_MAXNUDHINT 15
-#define ICMPV6CTL_MTUDISC_HIWAT 16
-#define ICMPV6CTL_MTUDISC_LOWAT 17
-#define ICMPV6CTL_ND6_DEBUG 18
-#define ICMPV6CTL_ND6_DRLIST 19
-#define ICMPV6CTL_ND6_PRLIST 20
-#define ICMPV6CTL_ND6_MAXQLEN 24
-#define ICMPV6CTL_MAXID 25
-
-#define ICMPV6CTL_NAMES { \
- { 0, 0 }, \
- { 0, 0 }, \
- { "rediraccept", CTLTYPE_INT }, \
- { "redirtimeout", CTLTYPE_INT }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "nd6_prune", CTLTYPE_INT }, \
- { 0, 0 }, \
- { "nd6_delay", CTLTYPE_INT }, \
- { "nd6_umaxtries", CTLTYPE_INT }, \
- { "nd6_mmaxtries", CTLTYPE_INT }, \
- { "nd6_useloopback", CTLTYPE_INT }, \
- { 0, 0 }, \
- { "nodeinfo", CTLTYPE_INT }, \
- { "errppslimit", CTLTYPE_INT }, \
- { "nd6_maxnudhint", CTLTYPE_INT }, \
- { "mtudisc_hiwat", CTLTYPE_INT }, \
- { "mtudisc_lowat", CTLTYPE_INT }, \
- { "nd6_debug", CTLTYPE_INT }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { 0, 0 }, \
- { "nd6_maxqueuelen", CTLTYPE_INT }, \
-}
-
-#ifdef _KERNEL
-struct rtentry;
-struct rttimer;
-struct in6_multi;
-
-void icmp6_init(void);
-void icmp6_paramerror(struct mbuf *, int);
-void icmp6_error(struct mbuf *, int, int, int);
-void icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
-int icmp6_input(struct mbuf **, int *, int);
-void icmp6_fasttimo(void);
-void icmp6_reflect(struct mbuf *, size_t);
-void icmp6_prepare(struct mbuf *);
-void icmp6_redirect_input(struct mbuf *, int);
-void icmp6_redirect_output(struct mbuf *, struct rtentry *);
-int icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-
-void icmp6_statinc(u_int);
-
-struct ip6ctlparam;
-void icmp6_mtudisc_update(struct ip6ctlparam *, int);
-void icmp6_mtudisc_callback_register(void (*)(struct in6_addr *));
-
-/* XXX: is this the right place for these macros? */
-#define icmp6_ifstat_inc(ifp, tag) \
-do { \
- if (ifp) \
- ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \
-} while (/*CONSTCOND*/ 0)
-
-#define icmp6_ifoutstat_inc(ifp, type, code) \
-do { \
- icmp6_ifstat_inc(ifp, ifs6_out_msg); \
- switch(type) { \
- case ICMP6_DST_UNREACH: \
- icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
- if (code == ICMP6_DST_UNREACH_ADMIN) \
- icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
- break; \
- case ICMP6_PACKET_TOO_BIG: \
- icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
- break; \
- case ICMP6_TIME_EXCEEDED: \
- icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
- break; \
- case ICMP6_PARAM_PROB: \
- icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
- break; \
- case ICMP6_ECHO_REQUEST: \
- icmp6_ifstat_inc(ifp, ifs6_out_echo); \
- break; \
- case ICMP6_ECHO_REPLY: \
- icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
- break; \
- case MLD_LISTENER_QUERY: \
- icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
- break; \
- case MLD_LISTENER_REPORT: \
- icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
- break; \
- case MLD_LISTENER_DONE: \
- icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
- break; \
- case ND_ROUTER_SOLICIT: \
- icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
- break; \
- case ND_ROUTER_ADVERT: \
- icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
- break; \
- case ND_NEIGHBOR_SOLICIT: \
- icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
- break; \
- case ND_NEIGHBOR_ADVERT: \
- icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
- break; \
- case ND_REDIRECT: \
- icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
- break; \
- } \
-} while (/*CONSTCOND*/ 0)
-
-extern int icmp6_rediraccept; /* accept/process redirects */
-extern int icmp6_redirtimeout; /* cache time for redirect routes */
-#endif /* _KERNEL */
-
-#ifdef ICMP6_STRINGS
-/* Info: http://www.iana.org/assignments/icmpv6-parameters */
-
-static const char * const icmp6_type_err[] = {
- "reserved0", "unreach", "packet_too_big", "timxceed", "paramprob",
- NULL
-};
-
-static const char * const icmp6_type_info[] = {
- "echo", "echoreply",
- "mcastlistenq", "mcastlistenrep", "mcastlistendone",
- "rtsol", "rtadv", "neighsol", "neighadv", "redirect",
- "routerrenum", "nodeinfoq", "nodeinfor", "invneighsol", "invneighrep",
- "mcastlistenrep2", "haad_req", "haad_rep",
- "mobile_psol", "mobile_padv", "cga_sol", "cga_adv",
- "experimental150", "mcast_rtadv", "mcast_rtsol", "mcast_rtterm",
- "fmipv6_msg", "rpl_control", NULL
-};
-
-static const char * const icmp6_code_none[] = { "none", NULL };
-
-static const char * const icmp6_code_unreach[] = {
- "noroute", "admin", "beyondscope", "addr", "port",
- "srcaddr_policy", "reject_route", "source_route_err", NULL
-};
-
-static const char * const icmp6_code_timxceed[] = {
- "intrans", "reass", NULL
-};
-
-static const char * const icmp6_code_paramprob[] = {
- "hdr_field", "nxthdr_type", "option", NULL
-};
-
-/* not all informational icmps that have codes have a names array */
-#endif
-
#endif /* !_NETINET_ICMP6_H_ */
diff --git a/libc/include/netinet/in_systm.h b/libc/include/netinet/in_systm.h
index 7e474ba..188268e 100644
--- a/libc/include/netinet/in_systm.h
+++ b/libc/include/netinet/in_systm.h
@@ -54,8 +54,4 @@
typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
-#ifdef _KERNEL
-n_time iptime (void);
-#endif
-
#endif /* !_NETINET_IN_SYSTM_H_ */
diff --git a/libc/include/netinet/ip6.h b/libc/include/netinet/ip6.h
index aa89186..52fcfae 100644
--- a/libc/include/netinet/ip6.h
+++ b/libc/include/netinet/ip6.h
@@ -112,20 +112,6 @@
#define IP6TOS_ECT 0x02 /* ECN-capable transport */
#endif
-#ifdef _KERNEL
-/*
- * for IPv6 pseudo header checksum
- * XXX nonstandard
- */
-struct ip6_hdr_pseudo {
- struct in6_addr ip6ph_src;
- struct in6_addr ip6ph_dst;
- u_int32_t ip6ph_len;
- u_int8_t ip6ph_zero[3];
- u_int8_t ip6ph_nxt;
-} __packed;
-#endif
-
/*
* Extension Headers
*/
@@ -271,53 +257,4 @@
#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */
#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/
-#ifdef _KERNEL
-/*
- * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
- * "len") is located in single mbuf, on contiguous memory region.
- * The pointer to the region will be returned to pointer variable "val",
- * with type "typ".
- * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
- * very top of mbuf. GET0 is likely to make memory copy than GET.
- *
- * XXX we're now testing this, needs m_pulldown()
- */
-#define IP6_EXTHDR_GET(val, typ, m, off, len) \
-do { \
- struct mbuf *_t; \
- int _tmp; \
- if ((m)->m_len >= (off) + (len)) \
- (val) = (typ)(mtod((m), char *) + (off)); \
- else { \
- _t = m_pulldown((m), (off), (len), &_tmp); \
- if (_t) { \
- if (_t->m_len < _tmp + (len)) \
- panic("m_pulldown malfunction"); \
- (val) = (typ)(mtod(_t, char *) + _tmp); \
- } else { \
- (val) = (typ)NULL; \
- (m) = NULL; \
- } \
- } \
-} while (/*CONSTCOND*/ 0)
-
-#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
-do { \
- struct mbuf *_t; \
- if ((off) == 0 && (m)->m_len >= len) \
- (val) = (typ)mtod((m), void *); \
- else { \
- _t = m_pulldown((m), (off), (len), NULL); \
- if (_t) { \
- if (_t->m_len < (len)) \
- panic("m_pulldown malfunction"); \
- (val) = (typ)mtod(_t, void *); \
- } else { \
- (val) = (typ)NULL; \
- (m) = NULL; \
- } \
- } \
-} while (/*CONSTCOND*/ 0)
-#endif /*_KERNEL*/
-
#endif /* !_NETINET_IP6_H_ */
diff --git a/libc/include/sys/ttydefaults.h b/libc/include/sys/ttydefaults.h
index 405e759..b62aab1 100644
--- a/libc/include/sys/ttydefaults.h
+++ b/libc/include/sys/ttydefaults.h
@@ -84,7 +84,6 @@
/*
* #define TTYDEFCHARS to include an array of default control characters.
*/
-#ifdef _KERNEL
#ifdef TTYDEFCHARS
const cc_t ttydefchars[NCCS] = {
[VEOF] = CEOF,
@@ -109,7 +108,4 @@
[19] = _POSIX_VDISABLE, /* spare */
};
#undef TTYDEFCHARS
-#else
-extern const cc_t ttydefchars[NCCS];
#endif
-#endif /* _KERNEL */