From 0e8caaf081a844893aa5bbf67010c3e34ca47f34 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 1 Jun 2019 19:32:01 -0400 Subject: Minimize includes of unrelated public headers by networking headers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop including sys/param.h, sys/types.h, stdint.h, inttypes.h, stdio.h, and string.h from network-related headers. This is done separately from earlier patches because the network headers are extra messy, and are also more likely to contain quirks inherited verbatim from 4.xBSD than the bulk of our public headers. Rose and NetROM are based on AX.25 so it makes practical sense for netrose/rose.h and netrom/netrom.h to continue including netax25/ax25.h. The only copies of ip_icmp.h and udp.h in the source tree are moved from sysdeps/gnu to inet (after which there are no longer any netinet/ headers in sysdeps/gnu). Much as sys/un.h needs to duplicate the prototype for strlen, netinet/icmp6.h needs to duplicate the prototype for memset. I am open to better ideas on that front. * resolv/resolv.h: Include bits/types.h, bits/types/FILE.h, and bits/types/size_t.h; don’t include sys/param.h, sys/types.h, or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/arpa/nameser.h: Include features.h, bits/types.h, and bits/types/size_t.h; don’t include sys/param.h, sys/types.h, or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/arpa/nameser_compat.h: Include features.h. * sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h; don’t include sys/types.h or stdint.h. Use __uint8_t and __uint16_t instead of uint8_t and uint16_t. * sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and bits/types.h; don’t include sys/types.h or stdint.h. Use __uint8_t and __uint16_t instead of uint8_t and uint16_t. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h and bits/types.h. Use __uint8_t instead of uint8_t. * sysdeps/mach/hurd/net/if_arp.h: Don’t include sys/types.h or stdint.h. Use __uint32_t instead of uint32_t. * sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h. Don’t include sys/types.h or stdint.h. Use __uint32_t instead of uint32_t. * sysdeps/mach/hurd/net/route.h: Don’t include sys/types.h. * sysdeps/unix/sysv/linux/net/route.h: Don’t include sys/types.h. * sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint8_t and __uint32_t instead of uint8_t and uint32_t. * sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h, bits/types.h, and sys/ioctl.h. Don’t include asm/types.h or linux/atalk.h. Copy over all user-appropriate definitions from linux/atalk.h with adjustments for glibc context. * grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c * resolv/ns_print.c, resolv/tst-ns_name_compress.c * resolv/tst-res_hnok.c, support/resolv_test.c: Include stdio.h. * nscd/initgrcache.c, nscd/netgroupcache.c * nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c * nss/nss_compat/compat-spwd.c, resolv/ns_print.c: Include sys/param.h for MIN and/or MAX. * resolv/tst-resolv-res_init-skeleton.c: Include signal.h. * inet/protocols/rwhod.h: Include features.h and bits/types.h. Don’t include sys/types.h. Use __int32_t instead of int32_t. * inet/protocols/talkd.h: Include features.h and bits/types.h. Don’t include sys/types.h, sys/socket.h, or stdint.h. Use __int32_t and __uint32_t instead of int32_t and uint32_t. * inet/protocols/timed.h: Include features.h, bits/types.h, and bits/types/struct_timeval.h. Don’t include sys/types.h or sys/time.h. * sysdeps/unix/sysv/linux/netipx/ipx.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * sysdeps/unix/sysv/linux/netrose/rose.h: Include features.h. Don’t include sys/socket.h. * inet/netinet/icmp6.h: Include features.h, bits/endian.h, bits/types.h, and bits/types/size_t.h. Don’t include inttypes.h, string.h, or sys/types.h. Duplicate prototype of memset here. Use __uintN_t instead of uintN_t types. * inet/netinet/igmp.h: Include bits/types.h. Don’t include sys/types.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip.h: Include bits/types.h. Don’t include bits/stdint-uintn.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip6.h: Include features.h, bits/endian.h, and bits/types.h. Don’t include inttypes.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip_icmp.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uintN_t instead of uintN_t types. * inet/netinet/udp.h: Likewise. * sysdeps/generic/netinet/if_ether.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_fddi.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_tr.h: Likewise. * sysdeps/gnu/netinet/ip_icmp.h: Move to inet/netinet/ip_icmp.h. * sysdeps/gnu/netinet/udp.h: Move to inet/netinet/udp.h. * include/netinet/ip_icmp.h, include/netinet/udp.h: New wrappers. * sysdeps/gnu/Makefile: Remove $(subdir)==inet stanza. * inet/Makefile (headers): Add netinet/ip_icmp.h and netinet/udp.h. Don’t use $(wildcard *.h) for arpa and protocols headers. Sort list. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update. --- grp/initgroups.c | 1 + include/netinet/ip_icmp.h | 1 + include/netinet/udp.h | 1 + inet/Makefile | 11 +- inet/netinet/icmp6.h | 123 +++++++------ inet/netinet/igmp.h | 9 +- inet/netinet/ip.h | 40 ++-- inet/netinet/ip6.h | 86 ++++----- inet/netinet/ip_icmp.h | 282 +++++++++++++++++++++++++++++ inet/netinet/udp.h | 96 ++++++++++ inet/protocols/rwhod.h | 5 +- inet/protocols/talkd.h | 11 +- inet/protocols/timed.h | 5 +- nscd/initgrcache.c | 2 + nscd/netgroupcache.c | 1 + nss/nss_compat/compat-grp.c | 1 + nss/nss_compat/compat-pwd.c | 1 + nss/nss_compat/compat-spwd.c | 1 + nss/nss_db/db-XXX.c | 1 + resolv/arpa/nameser.h | 34 ++-- resolv/arpa/nameser_compat.h | 1 + resolv/ns_print.c | 2 + resolv/resolv.h | 13 +- resolv/tst-ns_name_compress.c | 1 + resolv/tst-res_hnok.c | 1 + scripts/check-obsolete-constructs.py | 55 ++---- support/resolv_test.c | 1 + sysdeps/generic/netinet/if_ether.h | 6 +- sysdeps/gnu/Makefile | 5 - sysdeps/gnu/netinet/ip_icmp.h | 282 ----------------------------- sysdeps/gnu/netinet/udp.h | 96 ---------- sysdeps/mach/hurd/net/ethernet.h | 12 +- sysdeps/mach/hurd/net/if_arp.h | 5 +- sysdeps/mach/hurd/net/route.h | 3 +- sysdeps/unix/sysv/linux/net/ethernet.h | 12 +- sysdeps/unix/sysv/linux/net/if_arp.h | 5 +- sysdeps/unix/sysv/linux/net/if_ppp.h | 10 +- sysdeps/unix/sysv/linux/net/if_shaper.h | 8 +- sysdeps/unix/sysv/linux/net/route.h | 2 +- sysdeps/unix/sysv/linux/netatalk/at.h | 39 +++- sysdeps/unix/sysv/linux/netinet/if_ether.h | 21 +-- sysdeps/unix/sysv/linux/netinet/if_fddi.h | 14 +- sysdeps/unix/sysv/linux/netinet/if_tr.h | 68 +++---- sysdeps/unix/sysv/linux/netipx/ipx.h | 10 +- sysdeps/unix/sysv/linux/netrose/rose.h | 2 +- 45 files changed, 710 insertions(+), 676 deletions(-) create mode 100644 include/netinet/ip_icmp.h create mode 100644 include/netinet/udp.h create mode 100644 inet/netinet/ip_icmp.h create mode 100644 inet/netinet/udp.h delete mode 100644 sysdeps/gnu/netinet/ip_icmp.h delete mode 100644 sysdeps/gnu/netinet/udp.h diff --git a/grp/initgroups.c b/grp/initgroups.c index f4c4e986e9..9cef00ed98 100644 --- a/grp/initgroups.c +++ b/grp/initgroups.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/include/netinet/ip_icmp.h b/include/netinet/ip_icmp.h new file mode 100644 index 0000000000..f8d0080f68 --- /dev/null +++ b/include/netinet/ip_icmp.h @@ -0,0 +1 @@ +#include diff --git a/include/netinet/udp.h b/include/netinet/udp.h new file mode 100644 index 0000000000..c45cb0bedd --- /dev/null +++ b/include/netinet/udp.h @@ -0,0 +1 @@ +#include diff --git a/inet/Makefile b/inet/Makefile index bd2fc317b5..ef12db0c4a 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -22,10 +22,13 @@ subdir := inet include ../Makeconfig -headers := netinet/ether.h netinet/in.h netinet/in_systm.h \ - netinet/if_ether.h netinet/igmp.h \ - netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \ - aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h +headers := aliases.h ifaddrs.h bits/in.h \ + netinet/ether.h netinet/icmp6.h netinet/if_ether.h netinet/igmp.h \ + netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h \ + netinet/ip_icmp.h netinet/tcp.h netinet/udp.h \ + arpa/ftp.h arpa/inet.h arpa/telnet.h arpa/tftp.h \ + protocols/routed.h protocols/rwhod.h protocols/talkd.h \ + protocols/timed.h routines := htonl htons \ inet_lnaof inet_mkadr \ diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h index a75722887d..2d1c70bdad 100644 --- a/inet/netinet/icmp6.h +++ b/inet/netinet/icmp6.h @@ -18,9 +18,10 @@ #ifndef _NETINET_ICMP6_H #define _NETINET_ICMP6_H 1 -#include -#include -#include +#include +#include +#include +#include #include #define ICMP6_FILTER 1 @@ -32,19 +33,19 @@ struct icmp6_filter { - uint32_t icmp6_filt[8]; + __uint32_t icmp6_filt[8]; }; struct icmp6_hdr { - uint8_t icmp6_type; /* type field */ - uint8_t icmp6_code; /* code field */ - uint16_t icmp6_cksum; /* checksum field */ + __uint8_t icmp6_type; /* type field */ + __uint8_t icmp6_code; /* code field */ + __uint16_t icmp6_cksum; /* checksum field */ union { - uint32_t icmp6_un_data32[1]; /* type-specific field */ - uint16_t icmp6_un_data16[2]; /* type-specific field */ - uint8_t icmp6_un_data8[4]; /* type-specific field */ + __uint32_t icmp6_un_data32[1]; /* type-specific field */ + __uint16_t icmp6_un_data16[2]; /* type-specific field */ + __uint8_t icmp6_un_data8[4]; /* type-specific field */ } icmp6_dataun; }; @@ -96,6 +97,8 @@ struct icmp6_hdr #define ICMP6_FILTER_SETBLOCK(type, filterp) \ ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))) +extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); + #define ICMP6_FILTER_SETPASSALL(filterp) \ memset (filterp, 0, sizeof (struct icmp6_filter)); @@ -122,8 +125,8 @@ struct nd_router_solicit /* router solicitation */ struct nd_router_advert /* router advertisement */ { struct icmp6_hdr nd_ra_hdr; - uint32_t nd_ra_reachable; /* reachable time */ - uint32_t nd_ra_retransmit; /* retransmit timer */ + __uint32_t nd_ra_reachable; /* reachable time */ + __uint32_t nd_ra_retransmit; /* retransmit timer */ /* could be followed by options */ }; @@ -185,8 +188,8 @@ struct nd_redirect /* redirect */ struct nd_opt_hdr /* Neighbor discovery option header */ { - uint8_t nd_opt_type; - uint8_t nd_opt_len; /* in units of 8 octets */ + __uint8_t nd_opt_type; + __uint8_t nd_opt_len; /* in units of 8 octets */ /* followed by option specific data */ }; @@ -200,13 +203,13 @@ struct nd_opt_hdr /* Neighbor discovery option header */ struct nd_opt_prefix_info /* prefix information */ { - uint8_t nd_opt_pi_type; - uint8_t nd_opt_pi_len; - uint8_t nd_opt_pi_prefix_len; - uint8_t nd_opt_pi_flags_reserved; - uint32_t nd_opt_pi_valid_time; - uint32_t nd_opt_pi_preferred_time; - uint32_t nd_opt_pi_reserved2; + __uint8_t nd_opt_pi_type; + __uint8_t nd_opt_pi_len; + __uint8_t nd_opt_pi_prefix_len; + __uint8_t nd_opt_pi_flags_reserved; + __uint32_t nd_opt_pi_valid_time; + __uint32_t nd_opt_pi_preferred_time; + __uint32_t nd_opt_pi_reserved2; struct in6_addr nd_opt_pi_prefix; }; @@ -216,19 +219,19 @@ struct nd_opt_prefix_info /* prefix information */ struct nd_opt_rd_hdr /* redirected header */ { - uint8_t nd_opt_rh_type; - uint8_t nd_opt_rh_len; - uint16_t nd_opt_rh_reserved1; - uint32_t nd_opt_rh_reserved2; + __uint8_t nd_opt_rh_type; + __uint8_t nd_opt_rh_len; + __uint16_t nd_opt_rh_reserved1; + __uint32_t nd_opt_rh_reserved2; /* followed by IP header and data */ }; struct nd_opt_mtu /* MTU option */ { - uint8_t nd_opt_mtu_type; - uint8_t nd_opt_mtu_len; - uint16_t nd_opt_mtu_reserved; - uint32_t nd_opt_mtu_mtu; + __uint8_t nd_opt_mtu_type; + __uint8_t nd_opt_mtu_len; + __uint16_t nd_opt_mtu_reserved; + __uint32_t nd_opt_mtu_mtu; }; struct mld_hdr @@ -248,10 +251,10 @@ struct mld_hdr struct icmp6_router_renum /* router renumbering header */ { struct icmp6_hdr rr_hdr; - uint8_t rr_segnum; - uint8_t rr_flags; - uint16_t rr_maxdelay; - uint32_t rr_reserved; + __uint8_t rr_segnum; + __uint8_t rr_flags; + __uint16_t rr_maxdelay; + __uint32_t rr_reserved; }; #define rr_type rr_hdr.icmp6_type @@ -268,13 +271,13 @@ struct icmp6_router_renum /* router renumbering header */ struct rr_pco_match /* match prefix part */ { - uint8_t rpm_code; - uint8_t rpm_len; - uint8_t rpm_ordinal; - uint8_t rpm_matchlen; - uint8_t rpm_minlen; - uint8_t rpm_maxlen; - uint16_t rpm_reserved; + __uint8_t rpm_code; + __uint8_t rpm_len; + __uint8_t rpm_ordinal; + __uint8_t rpm_matchlen; + __uint8_t rpm_minlen; + __uint8_t rpm_maxlen; + __uint16_t rpm_reserved; struct in6_addr rpm_prefix; }; @@ -285,13 +288,13 @@ struct rr_pco_match /* match prefix part */ struct rr_pco_use /* use prefix part */ { - uint8_t rpu_uselen; - uint8_t rpu_keeplen; - uint8_t rpu_ramask; - uint8_t rpu_raflags; - uint32_t rpu_vltime; - uint32_t rpu_pltime; - uint32_t rpu_flags; + __uint8_t rpu_uselen; + __uint8_t rpu_keeplen; + __uint8_t rpu_ramask; + __uint8_t rpu_raflags; + __uint32_t rpu_vltime; + __uint32_t rpu_pltime; + __uint32_t rpu_flags; struct in6_addr rpu_prefix; }; @@ -308,10 +311,10 @@ struct rr_pco_use /* use prefix part */ struct rr_result /* router renumbering result message */ { - uint16_t rrr_flags; - uint8_t rrr_ordinal; - uint8_t rrr_matchedlen; - uint32_t rrr_ifid; + __uint16_t rrr_flags; + __uint8_t rrr_ordinal; + __uint8_t rrr_matchedlen; + __uint32_t rrr_ifid; struct in6_addr rrr_prefix; }; @@ -326,20 +329,20 @@ struct rr_result /* router renumbering result message */ /* Mobile IPv6 extension: Advertisement Interval. */ struct nd_opt_adv_interval { - uint8_t nd_opt_adv_interval_type; - uint8_t nd_opt_adv_interval_len; - uint16_t nd_opt_adv_interval_reserved; - uint32_t nd_opt_adv_interval_ival; + __uint8_t nd_opt_adv_interval_type; + __uint8_t nd_opt_adv_interval_len; + __uint16_t nd_opt_adv_interval_reserved; + __uint32_t nd_opt_adv_interval_ival; }; /* Mobile IPv6 extension: Home Agent Info. */ struct nd_opt_home_agent_info { - uint8_t nd_opt_home_agent_info_type; - uint8_t nd_opt_home_agent_info_len; - uint16_t nd_opt_home_agent_info_reserved; - uint16_t nd_opt_home_agent_info_preference; - uint16_t nd_opt_home_agent_info_lifetime; + __uint8_t nd_opt_home_agent_info_type; + __uint8_t nd_opt_home_agent_info_len; + __uint16_t nd_opt_home_agent_info_reserved; + __uint16_t nd_opt_home_agent_info_preference; + __uint16_t nd_opt_home_agent_info_lifetime; }; #endif /* netinet/icmpv6.h */ diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h index 3a5b157073..9e6b3a8b1e 100644 --- a/inet/netinet/igmp.h +++ b/inet/netinet/igmp.h @@ -20,11 +20,10 @@ #include -#include - #ifdef __USE_MISC #include +#include __BEGIN_DECLS @@ -65,9 +64,9 @@ __BEGIN_DECLS */ struct igmp { - uint8_t igmp_type; /* IGMP type */ - uint8_t igmp_code; /* routing code */ - uint16_t igmp_cksum; /* checksum */ + __uint8_t igmp_type; /* IGMP type */ + __uint8_t igmp_code; /* routing code */ + __uint16_t igmp_cksum; /* checksum */ struct in_addr igmp_group; /* group address */ }; diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h index 8dd7f6a40e..9184b34f20 100644 --- a/inet/netinet/ip.h +++ b/inet/netinet/ip.h @@ -22,14 +22,14 @@ #include #include -#include +#include __BEGIN_DECLS struct timestamp { - uint8_t len; - uint8_t ptr; + __uint8_t len; + __uint8_t ptr; #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int flags:4; unsigned int overflow:4; @@ -39,7 +39,7 @@ struct timestamp #else # error "Please fix " #endif - uint32_t data[9]; + __uint32_t data[9]; }; struct iphdr @@ -53,15 +53,15 @@ struct iphdr #else # error "Please fix " #endif - uint8_t tos; - uint16_t tot_len; - uint16_t id; - uint16_t frag_off; - uint8_t ttl; - uint8_t protocol; - uint16_t check; - uint32_t saddr; - uint32_t daddr; + __uint8_t tos; + __uint16_t tot_len; + __uint16_t id; + __uint16_t frag_off; + __uint8_t ttl; + __uint8_t protocol; + __uint16_t check; + __uint32_t saddr; + __uint32_t daddr; /*The options start here. */ }; @@ -115,7 +115,7 @@ struct ip unsigned int ip_v:4; /* version */ unsigned int ip_hl:4; /* header length */ #endif - uint8_t ip_tos; /* type of service */ + __uint8_t ip_tos; /* type of service */ unsigned short ip_len; /* total length */ unsigned short ip_id; /* identification */ unsigned short ip_off; /* fragment offset field */ @@ -123,8 +123,8 @@ struct ip #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - uint8_t ip_ttl; /* time to live */ - uint8_t ip_p; /* protocol */ + __uint8_t ip_ttl; /* time to live */ + __uint8_t ip_p; /* protocol */ unsigned short ip_sum; /* checksum */ struct in_addr ip_src, ip_dst; /* source and dest address */ }; @@ -134,9 +134,9 @@ struct ip */ struct ip_timestamp { - uint8_t ipt_code; /* IPOPT_TS */ - uint8_t ipt_len; /* size of structure (variable) */ - uint8_t ipt_ptr; /* index of current entry */ + __uint8_t ipt_code; /* IPOPT_TS */ + __uint8_t ipt_len; /* size of structure (variable) */ + __uint8_t ipt_ptr; /* index of current entry */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int ipt_flg:4; /* flags, see below */ unsigned int ipt_oflw:4; /* overflow counter */ @@ -145,7 +145,7 @@ struct ip_timestamp unsigned int ipt_oflw:4; /* overflow counter */ unsigned int ipt_flg:4; /* flags, see below */ #endif - uint32_t data[9]; + __uint32_t data[9]; }; #endif /* __USE_MISC */ diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h index a10a9d8594..387a33c966 100644 --- a/inet/netinet/ip6.h +++ b/inet/netinet/ip6.h @@ -18,8 +18,10 @@ #ifndef _NETINET_IP6_H #define _NETINET_IP6_H 1 -#include +#include #include +#include +#include struct ip6_hdr { @@ -27,13 +29,13 @@ struct ip6_hdr { struct ip6_hdrctl { - uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, - 20 bits flow-ID */ - uint16_t ip6_un1_plen; /* payload length */ - uint8_t ip6_un1_nxt; /* next header */ - uint8_t ip6_un1_hlim; /* hop limit */ + __uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, + 20 bits flow-ID */ + __uint16_t ip6_un1_plen; /* payload length */ + __uint8_t ip6_un1_nxt; /* next header */ + __uint8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; - uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ + __uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ } ip6_ctlun; struct in6_addr ip6_src; /* source address */ struct in6_addr ip6_dst; /* destination address */ @@ -49,45 +51,45 @@ struct ip6_hdr /* Generic extension header. */ struct ip6_ext { - uint8_t ip6e_nxt; /* next header. */ - uint8_t ip6e_len; /* length in units of 8 octets. */ + __uint8_t ip6e_nxt; /* next header. */ + __uint8_t ip6e_len; /* length in units of 8 octets. */ }; /* Hop-by-Hop options header. */ struct ip6_hbh { - uint8_t ip6h_nxt; /* next header. */ - uint8_t ip6h_len; /* length in units of 8 octets. */ + __uint8_t ip6h_nxt; /* next header. */ + __uint8_t ip6h_len; /* length in units of 8 octets. */ /* followed by options */ }; /* Destination options header */ struct ip6_dest { - uint8_t ip6d_nxt; /* next header */ - uint8_t ip6d_len; /* length in units of 8 octets */ + __uint8_t ip6d_nxt; /* next header */ + __uint8_t ip6d_len; /* length in units of 8 octets */ /* followed by options */ }; /* Routing header */ struct ip6_rthdr { - uint8_t ip6r_nxt; /* next header */ - uint8_t ip6r_len; /* length in units of 8 octets */ - uint8_t ip6r_type; /* routing type */ - uint8_t ip6r_segleft; /* segments left */ + __uint8_t ip6r_nxt; /* next header */ + __uint8_t ip6r_len; /* length in units of 8 octets */ + __uint8_t ip6r_type; /* routing type */ + __uint8_t ip6r_segleft; /* segments left */ /* followed by routing type specific data */ }; /* Type 0 Routing header */ struct ip6_rthdr0 { - uint8_t ip6r0_nxt; /* next header */ - uint8_t ip6r0_len; /* length in units of 8 octets */ - uint8_t ip6r0_type; /* always zero */ - uint8_t ip6r0_segleft; /* segments left */ - uint8_t ip6r0_reserved; /* reserved field */ - uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ + __uint8_t ip6r0_nxt; /* next header */ + __uint8_t ip6r0_len; /* length in units of 8 octets */ + __uint8_t ip6r0_type; /* always zero */ + __uint8_t ip6r0_segleft; /* segments left */ + __uint8_t ip6r0_reserved; /* reserved field */ + __uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ /* followed by up to 127 struct in6_addr */ struct in6_addr ip6r0_addr[0]; }; @@ -95,10 +97,10 @@ struct ip6_rthdr0 /* Fragment header */ struct ip6_frag { - uint8_t ip6f_nxt; /* next header */ - uint8_t ip6f_reserved; /* reserved field */ - uint16_t ip6f_offlg; /* offset, reserved, and flag */ - uint32_t ip6f_ident; /* identification */ + __uint8_t ip6f_nxt; /* next header */ + __uint8_t ip6f_reserved; /* reserved field */ + __uint16_t ip6f_offlg; /* offset, reserved, and flag */ + __uint32_t ip6f_ident; /* identification */ }; #if __BYTE_ORDER == __BIG_ENDIAN @@ -114,8 +116,8 @@ struct ip6_frag /* IPv6 options */ struct ip6_opt { - uint8_t ip6o_type; - uint8_t ip6o_len; + __uint8_t ip6o_type; + __uint8_t ip6o_len; }; /* The high-order 3 bits of the option type define the behavior @@ -141,19 +143,19 @@ struct ip6_opt /* Jumbo Payload Option */ struct ip6_opt_jumbo { - uint8_t ip6oj_type; - uint8_t ip6oj_len; - uint8_t ip6oj_jumbo_len[4]; + __uint8_t ip6oj_type; + __uint8_t ip6oj_len; + __uint8_t ip6oj_jumbo_len[4]; }; #define IP6OPT_JUMBO_LEN 6 /* NSAP Address Option */ struct ip6_opt_nsap { - uint8_t ip6on_type; - uint8_t ip6on_len; - uint8_t ip6on_src_nsap_len; - uint8_t ip6on_dst_nsap_len; + __uint8_t ip6on_type; + __uint8_t ip6on_len; + __uint8_t ip6on_src_nsap_len; + __uint8_t ip6on_dst_nsap_len; /* followed by source NSAP */ /* followed by destination NSAP */ }; @@ -161,17 +163,17 @@ struct ip6_opt_nsap /* Tunnel Limit Option */ struct ip6_opt_tunnel { - uint8_t ip6ot_type; - uint8_t ip6ot_len; - uint8_t ip6ot_encap_limit; + __uint8_t ip6ot_type; + __uint8_t ip6ot_len; + __uint8_t ip6ot_encap_limit; }; /* Router Alert Option */ struct ip6_opt_router { - uint8_t ip6or_type; - uint8_t ip6or_len; - uint8_t ip6or_value[2]; + __uint8_t ip6or_type; + __uint8_t ip6or_len; + __uint8_t ip6or_value[2]; }; /* Router alert values (in network byte order) */ diff --git a/inet/netinet/ip_icmp.h b/inet/netinet/ip_icmp.h new file mode 100644 index 0000000000..ae2d37c245 --- /dev/null +++ b/inet/netinet/ip_icmp.h @@ -0,0 +1,282 @@ +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __NETINET_IP_ICMP_H +#define __NETINET_IP_ICMP_H 1 + +#include +#include + +__BEGIN_DECLS + +struct icmphdr +{ + __uint8_t type; /* message type */ + __uint8_t code; /* type sub-code */ + __uint16_t checksum; + union + { + struct + { + __uint16_t id; + __uint16_t sequence; + } echo; /* echo datagram */ + __uint32_t gateway; /* gateway address */ + struct + { + __uint16_t __glibc_reserved; + __uint16_t mtu; + } frag; /* path mtu discovery */ + } un; +}; + +#define ICMP_ECHOREPLY 0 /* Echo Reply */ +#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ +#define ICMP_SOURCE_QUENCH 4 /* Source Quench */ +#define ICMP_REDIRECT 5 /* Redirect (change route) */ +#define ICMP_ECHO 8 /* Echo Request */ +#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ +#define ICMP_PARAMETERPROB 12 /* Parameter Problem */ +#define ICMP_TIMESTAMP 13 /* Timestamp Request */ +#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ +#define ICMP_INFO_REQUEST 15 /* Information Request */ +#define ICMP_INFO_REPLY 16 /* Information Reply */ +#define ICMP_ADDRESS 17 /* Address Mask Request */ +#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ +#define NR_ICMP_TYPES 18 + + +/* Codes for UNREACH. */ +#define ICMP_NET_UNREACH 0 /* Network Unreachable */ +#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ +#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ +#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ +#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ +#define ICMP_SR_FAILED 5 /* Source Route failed */ +#define ICMP_NET_UNKNOWN 6 +#define ICMP_HOST_UNKNOWN 7 +#define ICMP_HOST_ISOLATED 8 +#define ICMP_NET_ANO 9 +#define ICMP_HOST_ANO 10 +#define ICMP_NET_UNR_TOS 11 +#define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ + +/* Codes for REDIRECT. */ +#define ICMP_REDIR_NET 0 /* Redirect Net */ +#define ICMP_REDIR_HOST 1 /* Redirect Host */ +#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ +#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ + +/* Codes for TIME_EXCEEDED. */ +#define ICMP_EXC_TTL 0 /* TTL count exceeded */ +#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ + + +#ifdef __USE_MISC +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#include +#include + +/* + * Internal of an ICMP Router Advertisement + */ +struct icmp_ra_addr +{ + __uint32_t ira_addr; + __uint32_t ira_preference; +}; + +struct icmp +{ + __uint8_t icmp_type; /* type of message, see below */ + __uint8_t icmp_code; /* type sub code */ + __uint16_t icmp_cksum; /* ones complement checksum of struct */ + union + { + unsigned char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* gateway address */ + struct ih_idseq /* echo datagram */ + { + __uint16_t icd_id; + __uint16_t icd_seq; + } ih_idseq; + __uint32_t ih_void; + + /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ + struct ih_pmtu + { + __uint16_t ipm_void; + __uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv + { + __uint8_t irt_num_addrs; + __uint8_t irt_wpa; + __uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union + { + struct + { + __uint32_t its_otime; + __uint32_t its_rtime; + __uint32_t its_ttime; + } id_ts; + struct + { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + struct icmp_ra_addr id_radv; + __uint32_t id_mask; + __uint8_t id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enough to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#ifndef _IP_VHL +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ +#else +#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) + /* N.B.: must separately check that header length >= 5 */ +#endif + +/* Definition of type and code fields. */ +/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_ROUTERADVERT 9 /* router advertisement */ +#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +/* UNREACH codes */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ +#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ +#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ +#define ICMP_UNREACH_NET_PROHIB 9 /* net denied */ +#define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */ +#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ +#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ +#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ +#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ +#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ + +/* REDIRECT codes */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ + +/* TIMEXCEED codes */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ + +/* PARAMPROB code */ +#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ + +#define ICMP_INFOTYPE(type) \ + ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO \ + || (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT \ + || (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY \ + || (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY \ + || (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) + +#endif /* __USE_MISC */ + +__END_DECLS + +#endif /* netinet/ip_icmp.h */ diff --git a/inet/netinet/udp.h b/inet/netinet/udp.h new file mode 100644 index 0000000000..062e966d11 --- /dev/null +++ b/inet/netinet/udp.h @@ -0,0 +1,96 @@ +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * Copyright (C) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __NETINET_UDP_H +#define __NETINET_UDP_H 1 + +#include +#include + +/* UDP header as specified by RFC 768, August 1980. */ + +struct udphdr +{ + __extension__ union + { + struct + { + __uint16_t uh_sport; /* source port */ + __uint16_t uh_dport; /* destination port */ + __uint16_t uh_ulen; /* udp length */ + __uint16_t uh_sum; /* udp checksum */ + }; + struct + { + __uint16_t source; + __uint16_t dest; + __uint16_t len; + __uint16_t check; + }; + }; +}; + +/* UDP socket options */ +#define UDP_CORK 1 /* Never send partially complete segments. */ +#define UDP_ENCAP 100 /* Set the socket to accept + encapsulated packets. */ +#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP + over IPv6. */ +#define UDP_NO_CHECK6_RX 102 /* Disable accepting checksum for UDP + over IPv6. */ +#define UDP_SEGMENT 103 /* Set GSO segmentation size. */ +#define UDP_GRO 104 /* This socket can receive UDP GRO packets. */ + +/* UDP encapsulation types */ +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ +#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ +#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ +#define UDP_ENCAP_GTP0 4 /* GSM TS 09.60 */ +#define UDP_ENCAP_GTP1U 5 /* 3GPP TS 29.060 */ + +#define SOL_UDP 17 /* sockopt level for UDP */ + +#endif /* netinet/udp.h */ diff --git a/inet/protocols/rwhod.h b/inet/protocols/rwhod.h index 446d6f97b8..74fe1f926c 100644 --- a/inet/protocols/rwhod.h +++ b/inet/protocols/rwhod.h @@ -32,7 +32,8 @@ #ifndef _PROTOCOLS_RWHOD_H #define _PROTOCOLS_RWHOD_H 1 -#include +#include +#include /* * rwho protocol packet format. @@ -40,7 +41,7 @@ struct outmp { char out_line[8]; /* tty name */ char out_name[8]; /* user id */ - int32_t out_time; /* time on */ + __int32_t out_time; /* time on */ }; struct whod { diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h index 09bd8a90ba..5068e981b7 100644 --- a/inet/protocols/talkd.h +++ b/inet/protocols/talkd.h @@ -50,9 +50,8 @@ * stream connection through which the conversation takes place. */ -#include -#include -#include +#include +#include #include /* @@ -63,10 +62,10 @@ typedef struct { unsigned char type; /* request type, see below */ unsigned char answer; /* not used */ unsigned char pad; - uint32_t id_num; /* message id */ + __uint32_t id_num; /* message id */ struct osockaddr addr; /* old (4.3) style */ struct osockaddr ctl_addr; /* old (4.3) style */ - int32_t pid; /* caller's process id */ + __int32_t pid; /* caller's process id */ #define NAME_SIZE 12 char l_name[NAME_SIZE];/* caller's name */ char r_name[NAME_SIZE];/* callee's name */ @@ -82,7 +81,7 @@ typedef struct { unsigned char type; /* type of request message, see below */ unsigned char answer; /* response to request message, see below */ unsigned char pad; - uint32_t id_num; /* message id */ + __uint32_t id_num; /* message id */ struct osockaddr addr; /* address for establishing conversation */ } CTL_RESPONSE; diff --git a/inet/protocols/timed.h b/inet/protocols/timed.h index cabdce44a6..5ec9de87a7 100644 --- a/inet/protocols/timed.h +++ b/inet/protocols/timed.h @@ -32,8 +32,9 @@ #ifndef _PROTOCOLS_TIMED_H #define _PROTOCOLS_TIMED_H 1 -#include -#include +#include +#include +#include /* * Time Synchronization Protocol diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index a9f230bfb0..c37b920fae 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -20,10 +20,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index 88c69d1e9c..dacd52315a 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "../inet/netgroup.h" #include "nscd.h" diff --git a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c index a8de1e03b3..148bb3cb58 100644 --- a/nss/nss_compat/compat-grp.c +++ b/nss/nss_compat/compat-grp.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c index ec3f35c594..843c98a6db 100644 --- a/nss/nss_compat/compat-pwd.c +++ b/nss/nss_compat/compat-pwd.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c index f6b7a1ef15..fa85c3bf28 100644 --- a/nss/nss_compat/compat-spwd.c +++ b/nss/nss_compat/compat-spwd.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c index 7994711e56..981268d8ba 100644 --- a/nss/nss_db/db-XXX.c +++ b/nss/nss_db/db-XXX.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h index a99d5ec508..4ce57bd3f9 100644 --- a/resolv/arpa/nameser.h +++ b/resolv/arpa/nameser.h @@ -48,9 +48,9 @@ #ifndef _ARPA_NAMESER_H_ #define _ARPA_NAMESER_H_ -#include -#include -#include +#include +#include +#include /* * Define constants based on RFC 883, RFC 1034, RFC 1035 @@ -92,7 +92,7 @@ typedef enum __ns_sect { */ typedef struct __ns_msg { const unsigned char *_msg, *_eom; - uint16_t _id, _flags, _counts[ns_s_max]; + __uint16_t _id, _flags, _counts[ns_s_max]; const unsigned char *_sections[ns_s_max]; ns_sect _sect; int _rrnum; @@ -116,10 +116,10 @@ extern const struct _ns_flagdata _ns_flagdata[]; */ typedef struct __ns_rr { char name[NS_MAXDNAME]; - uint16_t type; - uint16_t rr_class; - uint32_t ttl; - uint16_t rdlength; + __uint16_t type; + __uint16_t rr_class; + __uint32_t ttl; + __uint16_t rdlength; const unsigned char * rdata; } ns_rr; @@ -355,24 +355,24 @@ typedef enum __ns_cert_types { */ #define NS_GET16(s, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (s) = ((uint16_t)t_cp[0] << 8) \ - | ((uint16_t)t_cp[1]) \ + (s) = ((__uint16_t)t_cp[0] << 8) \ + | ((__uint16_t)t_cp[1]) \ ; \ (cp) += NS_INT16SZ; \ } while (0) #define NS_GET32(l, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (l) = ((uint32_t)t_cp[0] << 24) \ - | ((uint32_t)t_cp[1] << 16) \ - | ((uint32_t)t_cp[2] << 8) \ - | ((uint32_t)t_cp[3]) \ + (l) = ((__uint32_t)t_cp[0] << 24) \ + | ((__uint32_t)t_cp[1] << 16) \ + | ((__uint32_t)t_cp[2] << 8) \ + | ((__uint32_t)t_cp[3]) \ ; \ (cp) += NS_INT32SZ; \ } while (0) #define NS_PUT16(s, cp) do { \ - uint16_t t_s = (uint16_t)(s); \ + __uint16_t t_s = (__uint16_t)(s); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ @@ -380,7 +380,7 @@ typedef enum __ns_cert_types { } while (0) #define NS_PUT32(l, cp) do { \ - uint32_t t_l = (uint32_t)(l); \ + __uint32_t t_l = (__uint32_t)(l); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ @@ -408,7 +408,7 @@ int ns_sprintrrf (const unsigned char *, size_t, const char *, const char *, char *, size_t) __THROW; int ns_format_ttl (unsigned long, char *, size_t) __THROW; int ns_parse_ttl (const char *, unsigned long *) __THROW; -uint32_t ns_datetosecs (const char *, int *) __THROW; +__uint32_t ns_datetosecs (const char *, int *) __THROW; int ns_name_ntol (const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_ntop (const unsigned char *, char *, size_t) __THROW; diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h index 37c178b524..8996d376da 100644 --- a/resolv/arpa/nameser_compat.h +++ b/resolv/arpa/nameser_compat.h @@ -29,6 +29,7 @@ #ifndef _ARPA_NAMESER_COMPAT_ #define _ARPA_NAMESER_COMPAT_ +#include #include /*% diff --git a/resolv/ns_print.c b/resolv/ns_print.c index d61f5044b1..1dbcfb8910 100644 --- a/resolv/ns_print.c +++ b/resolv/ns_print.c @@ -19,6 +19,7 @@ /* Import. */ #include +#include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/resolv/resolv.h b/resolv/resolv.h index ce3922c3ed..e070755e08 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -54,11 +54,12 @@ #include -#include -#include -#include #include #include + +#include +#include +#include #include /* @@ -249,10 +250,10 @@ int loc_aton (const char *__ascii, unsigned char *__binary) __THROW; const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW; int dn_skipname (const unsigned char *, const unsigned char *) __THROW; -void putlong (uint32_t, unsigned char *) __THROW; -void putshort (uint16_t, unsigned char *) __THROW; +void putlong (__uint32_t, unsigned char *) __THROW; +void putshort (__uint16_t, unsigned char *) __THROW; const char * p_class (int) __THROW; -const char * p_time (uint32_t) __THROW; +const char * p_time (__uint32_t) __THROW; const char * p_type (int) __THROW; const char * p_rcode (int) __THROW; const unsigned char * p_cdnname (const unsigned char *, diff --git a/resolv/tst-ns_name_compress.c b/resolv/tst-ns_name_compress.c index f2602eba9f..70ec7ed36b 100644 --- a/resolv/tst-ns_name_compress.c +++ b/resolv/tst-ns_name_compress.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include #include diff --git a/resolv/tst-res_hnok.c b/resolv/tst-res_hnok.c index 2724d5d85e..34f6c3cb54 100644 --- a/resolv/tst-res_hnok.c +++ b/resolv/tst-res_hnok.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 1a0e91cf63..5e528bcc1a 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -607,44 +607,30 @@ HEADER_ALLOWED_INCLUDES = { # Nonstandardized networking headers "ifaddrs.h": [ "sys/socket.h" ], - "resolv.h": [ "arpa/nameser.h", "netinet/in.h", - "stdio.h", "sys/param.h", - "sys/types.h" ], - - "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h", - "sys/param.h", "sys/types.h" ], - "net/ethernet.h": [ "stdint.h", "sys/types.h", - "net/if_ether.h" ], - "net/if_arp.h": [ "stdint.h", "sys/socket.h", - "sys/types.h" ], - "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "stdint.h", - "sys/ioctl.h", "sys/types.h" ], - "net/if_shaper.h": [ "net/if.h", "stdint.h", "sys/ioctl.h", - "sys/types.h" ], - "net/route.h": [ "netinet/in.h", "sys/socket.h", - "sys/types.h" ], - "netatalk/at.h": [ "sys/socket.h" ], + + "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ], + "arpa/nameser.h": [ "arpa/nameser_compat.h" ], + + "net/ethernet.h": [ "net/if_ether.h" ], + "net/if_arp.h": [ "sys/socket.h" ], + "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", + "sys/ioctl.h" ], + "net/if_shaper.h": [ "net/if.h", "sys/ioctl.h" ], + "net/route.h": [ "netinet/in.h", "sys/socket.h" ], + "netatalk/at.h": [ "sys/socket.h", "sys/ioctl.h" ], + "netinet/ether.h": [ "netinet/if_ether.h" ], - "netinet/icmp6.h": [ "inttypes.h", "netinet/in.h", "string.h", - "sys/types.h" ], - "netinet/if_ether.h": [ "net/ethernet.h", "net/if_arp.h", - "sys/types.h", "stdint.h" ], - "netinet/if_fddi.h": [ "stdint.h", "sys/types.h" ], - "netinet/if_tr.h": [ "stdint.h", "sys/types.h" ], - "netinet/igmp.h": [ "netinet/in.h", "sys/types.h" ], + "netinet/icmp6.h": [ "netinet/in.h" ], + "netinet/if_ether.h": [ "net/ethernet.h", "net/if_arp.h" ], + "netinet/igmp.h": [ "netinet/in.h" ], "netinet/ip.h": [ "netinet/in.h" ], - "netinet/ip6.h": [ "inttypes.h", "netinet/in.h" ], - "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h", - "stdint.h", "sys/types.h" ], - "netinet/udp.h": [ "stdint.h", "sys/types.h" ], - "netipx/ipx.h": [ "stdint.h", "sys/types.h" ], + "netinet/ip6.h": [ "netinet/in.h" ], + "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h" ], + "netrom/netrom.h": [ "netax25/ax25.h" ], - "netrose/rose.h": [ "netax25/ax25.h", "sys/socket.h" ], + "netrose/rose.h": [ "netax25/ax25.h" ], "protocols/routed.h": [ "sys/socket.h" ], - "protocols/rwhod.h": [ "paths.h", "sys/types.h" ], - "protocols/talkd.h": [ "stdint.h", "sys/socket.h", - "sys/types.h" ], - "protocols/timed.h": [ "sys/time.h", "sys/types.h" ], + "protocols/rwhod.h": [ "paths.h" ], # Internal headers "features.h": [ "gnu/stubs.h", "stdc-predef.h", @@ -682,7 +668,6 @@ SYSDEP_ALLOWED_INCLUDES = { "net/ethernet.h": [ "linux/if_ether.h" ], "net/if_slip.h": [ "linux/if_slip.h" ], "net/ppp_defs.h": [ "asm/types.h", "linux/ppp_defs.h" ], - "netatalk/at.h": [ "asm/types.h", "linux/atalk.h" ], "netinet/if_ether.h": [ "linux/if_ether.h" ], "netinet/if_fddi.h": [ "linux/if_fddi.h" ], diff --git a/support/resolv_test.c b/support/resolv_test.c index 53b7fc41ab..baf87671fb 100644 --- a/support/resolv_test.c +++ b/support/resolv_test.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/sysdeps/generic/netinet/if_ether.h b/sysdeps/generic/netinet/if_ether.h index 2f13f40a41..cec12725f8 100644 --- a/sysdeps/generic/netinet/if_ether.h +++ b/sysdeps/generic/netinet/if_ether.h @@ -18,8 +18,8 @@ #ifndef __NETINET_IF_ETHER_H #define __NETINET_IF_ETHER_H 1 -#include -#include +#include +#include #define ETH_ALEN 6 /* Octets in one ethernet address. */ @@ -27,7 +27,7 @@ systems. */ struct ether_addr { - uint8_t ether_addr_octet[ETH_ALEN]; + __uint8_t ether_addr_octet[ETH_ALEN]; } __attribute__ ((__packed__)); #endif /* netinet/if_ether.h */ diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index 37b47c8223..e04d37c7bc 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -59,11 +59,6 @@ $(foreach o,$(object-suffixes) $(object-suffixes:=.d),\ endif -ifeq ($(subdir),inet) -sysdep_headers += netinet/udp.h netinet/ip_icmp.h -endif - - ifeq ($(subdir),csu) routines += unwind-resume shared-only-routines += unwind-resume diff --git a/sysdeps/gnu/netinet/ip_icmp.h b/sysdeps/gnu/netinet/ip_icmp.h deleted file mode 100644 index 0a4875e7d4..0000000000 --- a/sysdeps/gnu/netinet/ip_icmp.h +++ /dev/null @@ -1,282 +0,0 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef __NETINET_IP_ICMP_H -#define __NETINET_IP_ICMP_H 1 - -#include -#include - -__BEGIN_DECLS - -struct icmphdr -{ - uint8_t type; /* message type */ - uint8_t code; /* type sub-code */ - uint16_t checksum; - union - { - struct - { - uint16_t id; - uint16_t sequence; - } echo; /* echo datagram */ - uint32_t gateway; /* gateway address */ - struct - { - uint16_t __glibc_reserved; - uint16_t mtu; - } frag; /* path mtu discovery */ - } un; -}; - -#define ICMP_ECHOREPLY 0 /* Echo Reply */ -#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ -#define ICMP_SOURCE_QUENCH 4 /* Source Quench */ -#define ICMP_REDIRECT 5 /* Redirect (change route) */ -#define ICMP_ECHO 8 /* Echo Request */ -#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ -#define ICMP_PARAMETERPROB 12 /* Parameter Problem */ -#define ICMP_TIMESTAMP 13 /* Timestamp Request */ -#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ -#define ICMP_INFO_REQUEST 15 /* Information Request */ -#define ICMP_INFO_REPLY 16 /* Information Reply */ -#define ICMP_ADDRESS 17 /* Address Mask Request */ -#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ -#define NR_ICMP_TYPES 18 - - -/* Codes for UNREACH. */ -#define ICMP_NET_UNREACH 0 /* Network Unreachable */ -#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ -#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ -#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ -#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ -#define ICMP_SR_FAILED 5 /* Source Route failed */ -#define ICMP_NET_UNKNOWN 6 -#define ICMP_HOST_UNKNOWN 7 -#define ICMP_HOST_ISOLATED 8 -#define ICMP_NET_ANO 9 -#define ICMP_HOST_ANO 10 -#define ICMP_NET_UNR_TOS 11 -#define ICMP_HOST_UNR_TOS 12 -#define ICMP_PKT_FILTERED 13 /* Packet filtered */ -#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ -#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ -#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ - -/* Codes for REDIRECT. */ -#define ICMP_REDIR_NET 0 /* Redirect Net */ -#define ICMP_REDIR_HOST 1 /* Redirect Host */ -#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ -#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ - -/* Codes for TIME_EXCEEDED. */ -#define ICMP_EXC_TTL 0 /* TTL count exceeded */ -#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ - - -#ifdef __USE_MISC -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 - */ - -#include -#include - -/* - * Internal of an ICMP Router Advertisement - */ -struct icmp_ra_addr -{ - uint32_t ira_addr; - uint32_t ira_preference; -}; - -struct icmp -{ - uint8_t icmp_type; /* type of message, see below */ - uint8_t icmp_code; /* type sub code */ - uint16_t icmp_cksum; /* ones complement checksum of struct */ - union - { - unsigned char ih_pptr; /* ICMP_PARAMPROB */ - struct in_addr ih_gwaddr; /* gateway address */ - struct ih_idseq /* echo datagram */ - { - uint16_t icd_id; - uint16_t icd_seq; - } ih_idseq; - uint32_t ih_void; - - /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ - struct ih_pmtu - { - uint16_t ipm_void; - uint16_t ipm_nextmtu; - } ih_pmtu; - - struct ih_rtradv - { - uint8_t irt_num_addrs; - uint8_t irt_wpa; - uint16_t irt_lifetime; - } ih_rtradv; - } icmp_hun; -#define icmp_pptr icmp_hun.ih_pptr -#define icmp_gwaddr icmp_hun.ih_gwaddr -#define icmp_id icmp_hun.ih_idseq.icd_id -#define icmp_seq icmp_hun.ih_idseq.icd_seq -#define icmp_void icmp_hun.ih_void -#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void -#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu -#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs -#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa -#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime - union - { - struct - { - uint32_t its_otime; - uint32_t its_rtime; - uint32_t its_ttime; - } id_ts; - struct - { - struct ip idi_ip; - /* options and then 64 bits of data */ - } id_ip; - struct icmp_ra_addr id_radv; - uint32_t id_mask; - uint8_t id_data[1]; - } icmp_dun; -#define icmp_otime icmp_dun.id_ts.its_otime -#define icmp_rtime icmp_dun.id_ts.its_rtime -#define icmp_ttime icmp_dun.id_ts.its_ttime -#define icmp_ip icmp_dun.id_ip.idi_ip -#define icmp_radv icmp_dun.id_radv -#define icmp_mask icmp_dun.id_mask -#define icmp_data icmp_dun.id_data -}; - -/* - * Lower bounds on packet lengths for various types. - * For the error advice packets must first insure that the - * packet is large enough to contain the returned ip header. - * Only then can we do the check to see if 64 bits of packet - * data have been returned, since we need to check the returned - * ip header length. - */ -#define ICMP_MINLEN 8 /* abs minimum */ -#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ -#define ICMP_MASKLEN 12 /* address mask */ -#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ -#ifndef _IP_VHL -#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) - /* N.B.: must separately check that ip_hl >= 5 */ -#else -#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8) - /* N.B.: must separately check that header length >= 5 */ -#endif - -/* Definition of type and code fields. */ -/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */ -#define ICMP_UNREACH 3 /* dest unreachable, codes: */ -#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ -#define ICMP_ROUTERADVERT 9 /* router advertisement */ -#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ -#define ICMP_TIMXCEED 11 /* time exceeded, code: */ -#define ICMP_PARAMPROB 12 /* ip header bad */ -#define ICMP_TSTAMP 13 /* timestamp request */ -#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ -#define ICMP_IREQ 15 /* information request */ -#define ICMP_IREQREPLY 16 /* information reply */ -#define ICMP_MASKREQ 17 /* address mask request */ -#define ICMP_MASKREPLY 18 /* address mask reply */ - -#define ICMP_MAXTYPE 18 - -/* UNREACH codes */ -#define ICMP_UNREACH_NET 0 /* bad net */ -#define ICMP_UNREACH_HOST 1 /* bad host */ -#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ -#define ICMP_UNREACH_PORT 3 /* bad port */ -#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ -#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ -#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ -#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ -#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ -#define ICMP_UNREACH_NET_PROHIB 9 /* net denied */ -#define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */ -#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ -#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ -#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */ -#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */ -#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */ - -/* REDIRECT codes */ -#define ICMP_REDIRECT_NET 0 /* for network */ -#define ICMP_REDIRECT_HOST 1 /* for host */ -#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ -#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ - -/* TIMEXCEED codes */ -#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ -#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ - -/* PARAMPROB code */ -#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ - -#define ICMP_INFOTYPE(type) \ - ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO \ - || (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT \ - || (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY \ - || (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY \ - || (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) - -#endif /* __USE_MISC */ - -__END_DECLS - -#endif /* netinet/ip_icmp.h */ diff --git a/sysdeps/gnu/netinet/udp.h b/sysdeps/gnu/netinet/udp.h deleted file mode 100644 index 51d584629c..0000000000 --- a/sysdeps/gnu/netinet/udp.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* - * Copyright (C) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef __NETINET_UDP_H -#define __NETINET_UDP_H 1 - -#include -#include - -/* UDP header as specified by RFC 768, August 1980. */ - -struct udphdr -{ - __extension__ union - { - struct - { - uint16_t uh_sport; /* source port */ - uint16_t uh_dport; /* destination port */ - uint16_t uh_ulen; /* udp length */ - uint16_t uh_sum; /* udp checksum */ - }; - struct - { - uint16_t source; - uint16_t dest; - uint16_t len; - uint16_t check; - }; - }; -}; - -/* UDP socket options */ -#define UDP_CORK 1 /* Never send partially complete segments. */ -#define UDP_ENCAP 100 /* Set the socket to accept - encapsulated packets. */ -#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP - over IPv6. */ -#define UDP_NO_CHECK6_RX 102 /* Disable accepting checksum for UDP - over IPv6. */ -#define UDP_SEGMENT 103 /* Set GSO segmentation size. */ -#define UDP_GRO 104 /* This socket can receive UDP GRO packets. */ - -/* UDP encapsulation types */ -#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ -#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ -#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ -#define UDP_ENCAP_GTP0 4 /* GSM TS 09.60 */ -#define UDP_ENCAP_GTP1U 5 /* 3GPP TS 29.060 */ - -#define SOL_UDP 17 /* sockopt level for UDP */ - -#endif /* netinet/udp.h */ diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h index 53b2e39600..ffbb510d1e 100644 --- a/sysdeps/mach/hurd/net/ethernet.h +++ b/sysdeps/mach/hurd/net/ethernet.h @@ -22,9 +22,7 @@ #define __NET_ETHERNET_H 1 #include - -#include -#include +#include #include /* IEEE 802.3 Ethernet constants */ __BEGIN_DECLS @@ -33,15 +31,15 @@ __BEGIN_DECLS systems. */ struct ether_addr { - uint8_t ether_addr_octet[ETH_ALEN]; + __uint8_t ether_addr_octet[ETH_ALEN]; }; /* 10Mb/s ethernet header */ struct ether_header { - uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ - uint16_t ether_type; /* packet type ID field */ + __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ + __uint16_t ether_type; /* packet type ID field */ }; /* Ethernet protocol ID's */ diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h index ffb6ef1e22..86dd2ffc37 100644 --- a/sysdeps/mach/hurd/net/if_arp.h +++ b/sysdeps/mach/hurd/net/if_arp.h @@ -23,10 +23,7 @@ #define _NET_IF_ARP_H 1 #include - -#include #include -#include __BEGIN_DECLS @@ -133,7 +130,7 @@ struct arpreq struct arpd_request { unsigned short int req; /* Request type. */ - uint32_t ip; /* IP address of entry. */ + __uint32_t ip; /* IP address of entry. */ unsigned long int dev; /* Device entry is tied to. */ unsigned long int stamp; unsigned long int updated; diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h index 8d9338a923..8772461da5 100644 --- a/sysdeps/mach/hurd/net/route.h +++ b/sysdeps/mach/hurd/net/route.h @@ -18,12 +18,11 @@ /* Based on the 4.4BSD and Linux version of this file. */ #ifndef _NET_ROUTE_H - #define _NET_ROUTE_H 1 + #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/unix/sysv/linux/net/ethernet.h index f98c27c028..f8b06b9ffc 100644 --- a/sysdeps/unix/sysv/linux/net/ethernet.h +++ b/sysdeps/unix/sysv/linux/net/ethernet.h @@ -21,8 +21,8 @@ #ifndef __NET_ETHERNET_H #define __NET_ETHERNET_H 1 -#include -#include +#include +#include #include /* IEEE 802.3 Ethernet constants */ @@ -32,15 +32,15 @@ __BEGIN_DECLS systems. */ struct ether_addr { - uint8_t ether_addr_octet[ETH_ALEN]; + __uint8_t ether_addr_octet[ETH_ALEN]; } __attribute__ ((__packed__)); /* 10Mb/s ethernet header */ struct ether_header { - uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ - uint16_t ether_type; /* packet type ID field */ + __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ + __uint16_t ether_type; /* packet type ID field */ } __attribute__ ((__packed__)); /* Ethernet protocol ID's */ diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index e9dc7c2645..bbaf956180 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -22,9 +22,8 @@ #ifndef _NET_IF_ARP_H #define _NET_IF_ARP_H 1 -#include +#include #include -#include __BEGIN_DECLS @@ -171,7 +170,7 @@ struct arpreq_old struct arpd_request { unsigned short int req; /* Request type. */ - uint32_t ip; /* IP address of entry. */ + __uint32_t ip; /* IP address of entry. */ unsigned long int dev; /* Device entry is tied to. */ unsigned long int stamp; unsigned long int updated; diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h index 31a20766f0..1fd813ba8e 100644 --- a/sysdeps/unix/sysv/linux/net/if_ppp.h +++ b/sysdeps/unix/sysv/linux/net/if_ppp.h @@ -48,10 +48,10 @@ #ifndef __NET_IF_PPP_H #define __NET_IF_PPP_H 1 -#include -#include -#include +#include +#include #include +#include #include __BEGIN_DECLS @@ -113,8 +113,8 @@ struct npioctl { /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ struct ppp_option_data { - uint8_t *ptr; - uint32_t length; + __uint8_t *ptr; + __uint32_t length; int transmit; }; diff --git a/sysdeps/unix/sysv/linux/net/if_shaper.h b/sysdeps/unix/sysv/linux/net/if_shaper.h index 180306716b..46ec85f2e3 100644 --- a/sysdeps/unix/sysv/linux/net/if_shaper.h +++ b/sysdeps/unix/sysv/linux/net/if_shaper.h @@ -18,8 +18,8 @@ #ifndef _NET_IF_SHAPER_H #define _NET_IF_SHAPER_H 1 -#include -#include +#include +#include #include #include @@ -43,11 +43,11 @@ __BEGIN_DECLS struct shaperconf { - uint16_t ss_cmd; + __uint16_t ss_cmd; union { char ssu_name[14]; - uint32_t ssu_speed; + __uint32_t ssu_speed; } ss_u; #define ss_speed ss_u.ssu_speed #define ss_name ss_u.ssu_name diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h index 557943a993..09819c9cae 100644 --- a/sysdeps/unix/sysv/linux/net/route.h +++ b/sysdeps/unix/sysv/linux/net/route.h @@ -21,8 +21,8 @@ #define _NET_ROUTE_H 1 #include + #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h index 9247943747..c4e33a8e42 100644 --- a/sysdeps/unix/sysv/linux/netatalk/at.h +++ b/sysdeps/unix/sysv/linux/netatalk/at.h @@ -18,11 +18,46 @@ #ifndef _NETATALK_AT_H #define _NETATALK_AT_H 1 -#include +#include +#include #include -#include + #include +#include + +/* Constants from linux/atalk.h as of kernel version 5.0. */ +#define ATPORT_FIRST 1 +#define ATPORT_RESERVED 128 +#define ATPORT_LAST 254 /* 254 is only legal on localtalk */ +#define ATADDR_ANYNET 0 +#define ATADDR_ANYNODE 0 +#define ATADDR_ANYPORT 0 +#define ATADDR_BCAST 255 +#define DDP_MAXSZ 587 +#define DDP_MAXHOPS 15 /* 4 bits of hop counter */ #define SOL_ATALK 258 /* sockopt level for atalk */ +#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) + +struct atalk_addr +{ + __uint16_t s_net; /* network byte order */ + __uint8_t s_node; +}; + +struct atalk_netrange +{ + __uint8_t nr_phase; + __uint16_t nr_firstnet; /* network byte order */ + __uint16_t nr_lastnet; /* network byte order */ +}; + +struct sockaddr_at +{ + __SOCKADDR_COMMON (sat_); + __uint8_t sat_port; + struct atalk_addr sat_addr; + __uint8_t sat_zero[8]; +}; #endif /* netatalk/at.h */ diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h index 8aebfe31d3..24a0d7ea29 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_ether.h +++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h @@ -16,10 +16,10 @@ . */ #ifndef __NETINET_IF_ETHER_H - #define __NETINET_IF_ETHER_H 1 + #include -#include +#include /* Get definitions from kernel header file. */ #include @@ -56,7 +56,6 @@ * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 * $FreeBSD$ */ - #include #include @@ -70,10 +69,10 @@ __BEGIN_DECLS */ struct ether_arp { struct arphdr ea_hdr; /* fixed-size header */ - uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */ - uint8_t arp_spa[4]; /* sender protocol address */ - uint8_t arp_tha[ETH_ALEN]; /* target hardware address */ - uint8_t arp_tpa[4]; /* target protocol address */ + __uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */ + __uint8_t arp_spa[4]; /* sender protocol address */ + __uint8_t arp_tha[ETH_ALEN]; /* target hardware address */ + __uint8_t arp_tpa[4]; /* target protocol address */ }; #define arp_hrd ea_hdr.ar_hrd #define arp_pro ea_hdr.ar_pro @@ -88,14 +87,14 @@ struct ether_arp { */ #define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ /* struct in_addr *ipaddr; */ \ - /* uint8_t enaddr[ETH_ALEN]; */ \ + /* __uint8_t enaddr[ETH_ALEN]; */ \ { \ (enaddr)[0] = 0x01; \ (enaddr)[1] = 0x00; \ (enaddr)[2] = 0x5e; \ - (enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \ - (enaddr)[4] = ((uint8_t *)ipaddr)[2]; \ - (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ + (enaddr)[3] = ((__uint8_t *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((__uint8_t *)ipaddr)[2]; \ + (enaddr)[5] = ((__uint8_t *)ipaddr)[3]; \ } __END_DECLS diff --git a/sysdeps/unix/sysv/linux/netinet/if_fddi.h b/sysdeps/unix/sysv/linux/netinet/if_fddi.h index 02eee30078..d65b2d91b2 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_fddi.h +++ b/sysdeps/unix/sysv/linux/netinet/if_fddi.h @@ -18,16 +18,18 @@ #ifndef _NETINET_IF_FDDI_H #define _NETINET_IF_FDDI_H 1 -#include -#include +#include +#include + #include #ifdef __USE_MISC -struct fddi_header { - uint8_t fddi_fc; /* Frame Control (FC) value */ - uint8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */ - uint8_t fddi_shost[FDDI_K_ALEN]; /* Source host */ +struct fddi_header +{ + __uint8_t fddi_fc; /* Frame Control (FC) value */ + __uint8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */ + __uint8_t fddi_shost[FDDI_K_ALEN]; /* Source host */ }; #endif diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h index d36bec3a8b..3cc47e73cc 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_tr.h +++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h @@ -16,49 +16,49 @@ . */ #ifndef _NETINET_IF_TR_H -#define _NETINET_IF_TR_H 1 +#define _NETINET_IF_TR_H 1 -#include -#include +#include +#include /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble and FCS/CRC (frame check sequence). */ #define TR_ALEN 6 /* Octets in one token-ring addr */ -#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc)) +#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc)) #define AC 0x10 -#define LLC_FRAME 0x40 +#define LLC_FRAME 0x40 /* LLC and SNAP constants */ -#define EXTENDED_SAP 0xAA -#define UI_CMD 0x03 +#define EXTENDED_SAP 0xAA +#define UI_CMD 0x03 /* This is an Token-Ring frame header. */ struct trh_hdr { - uint8_t ac; /* access control field */ - uint8_t fc; /* frame control field */ - uint8_t daddr[TR_ALEN]; /* destination address */ - uint8_t saddr[TR_ALEN]; /* source address */ - uint16_t rcf; /* route control field */ - uint16_t rseg[8]; /* routing registers */ + __uint8_t ac; /* access control field */ + __uint8_t fc; /* frame control field */ + __uint8_t daddr[TR_ALEN]; /* destination address */ + __uint8_t saddr[TR_ALEN]; /* source address */ + __uint16_t rcf; /* route control field */ + __uint16_t rseg[8]; /* routing registers */ }; /* This is an Token-Ring LLC structure */ struct trllc { - uint8_t dsap; /* destination SAP */ - uint8_t ssap; /* source SAP */ - uint8_t llc; /* LLC control field */ - uint8_t protid[3]; /* protocol id */ - uint16_t ethertype; /* ether type field */ + __uint8_t dsap; /* destination SAP */ + __uint8_t ssap; /* source SAP */ + __uint8_t llc; /* LLC control field */ + __uint8_t protid[3]; /* protocol id */ + __uint16_t ethertype; /* ether type field */ }; /* Token-Ring statistics collection data. */ struct tr_statistics { - unsigned long rx_packets; /* total packets received */ + unsigned long rx_packets; /* total packets received */ unsigned long tx_packets; /* total packets transmitted */ - unsigned long rx_bytes; /* total bytes received */ + unsigned long rx_bytes; /* total bytes received */ unsigned long tx_bytes; /* total bytes transmitted */ unsigned long rx_errors; /* bad packets received */ unsigned long tx_errors; /* packet transmit problems */ @@ -84,27 +84,27 @@ struct tr_statistics }; /* source routing stuff */ -#define TR_RII 0x80 -#define TR_RCF_DIR_BIT 0x80 -#define TR_RCF_LEN_MASK 0x1f00 -#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ +#define TR_RII 0x80 +#define TR_RCF_DIR_BIT 0x80 +#define TR_RCF_LEN_MASK 0x1f00 +#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ -#define TR_RCF_FRAME2K 0x20 -#define TR_RCF_BROADCAST_MASK 0xC000 -#define TR_MAXRIFLEN 18 +#define TR_RCF_FRAME2K 0x20 +#define TR_RCF_BROADCAST_MASK 0xC000 +#define TR_MAXRIFLEN 18 #ifdef __USE_MISC struct trn_hdr { - uint8_t trn_ac; /* access control field */ - uint8_t trn_fc; /* field control field */ - uint8_t trn_dhost[TR_ALEN]; /* destination host */ - uint8_t trn_shost[TR_ALEN]; /* source host */ - uint16_t trn_rcf; /* route control field */ - uint16_t trn_rseg[8]; /* routing registers */ + __uint8_t trn_ac; /* access control field */ + __uint8_t trn_fc; /* field control field */ + __uint8_t trn_dhost[TR_ALEN]; /* destination host */ + __uint8_t trn_shost[TR_ALEN]; /* source host */ + __uint16_t trn_rcf; /* route control field */ + __uint16_t trn_rseg[8]; /* routing registers */ }; #endif -#endif /* netinet/if_tr.h */ +#endif /* netinet/if_tr.h */ diff --git a/sysdeps/unix/sysv/linux/netipx/ipx.h b/sysdeps/unix/sysv/linux/netipx/ipx.h index a234a81773..a53f050506 100644 --- a/sysdeps/unix/sysv/linux/netipx/ipx.h +++ b/sysdeps/unix/sysv/linux/netipx/ipx.h @@ -18,8 +18,8 @@ #ifndef __NETIPX_IPX_H #define __NETIPX_IPX_H 1 -#include -#include +#include +#include #include __BEGIN_DECLS @@ -33,10 +33,10 @@ __BEGIN_DECLS struct sockaddr_ipx { sa_family_t sipx_family; - uint16_t sipx_port; - uint32_t sipx_network; + __uint16_t sipx_port; + __uint32_t sipx_network; unsigned char sipx_node[IPX_NODE_LEN]; - uint8_t sipx_type; + __uint8_t sipx_type; unsigned char sipx_zero; /* 16 byte fill */ }; diff --git a/sysdeps/unix/sysv/linux/netrose/rose.h b/sysdeps/unix/sysv/linux/netrose/rose.h index 79d4d597a9..54ce1f3543 100644 --- a/sysdeps/unix/sysv/linux/netrose/rose.h +++ b/sysdeps/unix/sysv/linux/netrose/rose.h @@ -21,7 +21,7 @@ #ifndef _NETROSE_ROSE_H #define _NETROSE_ROSE_H 1 -#include +#include #include /* Socket level values. */ -- cgit v1.2.1