2024-01-01 18:12:26 +00:00
|
|
|
/* Copyright (C) 1997-2024 Free Software Foundation, Inc..
|
1997-07-06 22:02:42 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
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.
|
1997-07-06 22:02:42 +00:00
|
|
|
|
|
|
|
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
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1997-07-06 22:02:42 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
1997-07-06 22:02:42 +00:00
|
|
|
|
|
|
|
/* Based on the 4.4BSD and Linux version of this file. */
|
|
|
|
|
|
|
|
#ifndef _NET_ROUTE_H
|
|
|
|
|
|
|
|
#define _NET_ROUTE_H 1
|
|
|
|
#include <features.h>
|
|
|
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
2022-09-20 22:41:31 +00:00
|
|
|
#include <net/if.h>
|
1997-07-06 22:02:42 +00:00
|
|
|
|
|
|
|
|
2022-09-20 22:41:31 +00:00
|
|
|
typedef struct ifrtreq
|
|
|
|
{
|
2022-09-21 06:51:50 +00:00
|
|
|
char ifname[IF_NAMESIZE];
|
2022-09-20 22:41:31 +00:00
|
|
|
in_addr_t rt_dest;
|
|
|
|
in_addr_t rt_mask;
|
|
|
|
in_addr_t rt_gateway;
|
|
|
|
int rt_flags;
|
|
|
|
int rt_metric;
|
|
|
|
int rt_mtu;
|
|
|
|
int rt_window;
|
|
|
|
int rt_irtt;
|
|
|
|
int rt_tos;
|
|
|
|
int rt_class;
|
|
|
|
} ifrtreq_t;
|
2022-09-21 17:27:39 +00:00
|
|
|
#define _IOT_ifrtreq _IOT (_IOTS(char), IF_NAMESIZE, _IOTS(int), 10, 0, 0)
|
2022-09-20 22:41:31 +00:00
|
|
|
|
|
|
|
|
1997-07-06 22:02:42 +00:00
|
|
|
#define RTF_UP 0x0001 /* Route usable. */
|
|
|
|
#define RTF_GATEWAY 0x0002 /* Destination is a gateway. */
|
|
|
|
|
|
|
|
#define RTF_HOST 0x0004 /* Host entry (net otherwise). */
|
|
|
|
#define RTF_REINSTATE 0x0008 /* Reinstate route after timeout. */
|
|
|
|
#define RTF_DYNAMIC 0x0010 /* Created dyn. (by redirect). */
|
|
|
|
#define RTF_MODIFIED 0x0020 /* Modified dyn. (by redirect). */
|
|
|
|
#define RTF_MTU 0x0040 /* Specific MTU for this route. */
|
|
|
|
#define RTF_MSS RTF_MTU /* Compatibility. */
|
|
|
|
#define RTF_WINDOW 0x0080 /* Per route window clamping. */
|
|
|
|
#define RTF_IRTT 0x0100 /* Initial round trip time. */
|
|
|
|
#define RTF_REJECT 0x0200 /* Reject route. */
|
|
|
|
#define RTF_STATIC 0x0400 /* Manually injected route. */
|
|
|
|
#define RTF_XRESOLVE 0x0800 /* External resolver. */
|
|
|
|
#define RTF_NOFORWARD 0x1000 /* Forwarding inhibited. */
|
|
|
|
#define RTF_THROW 0x2000 /* Go to next class. */
|
|
|
|
#define RTF_NOPMTUDISC 0x4000 /* Do not send packets with DF. */
|
|
|
|
|
|
|
|
/* for IPv6 */
|
|
|
|
#define RTF_DEFAULT 0x00010000 /* default - learned via ND */
|
|
|
|
#define RTF_ALLONLINK 0x00020000 /* fallback, no routers on link */
|
|
|
|
#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
|
|
|
|
|
|
|
|
#define RTF_LINKRT 0x00100000 /* link specific - device match */
|
|
|
|
#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
|
|
|
|
|
|
|
|
#define RTF_CACHE 0x01000000 /* cache entry */
|
|
|
|
#define RTF_FLOW 0x02000000 /* flow significant route */
|
|
|
|
#define RTF_POLICY 0x04000000 /* policy route */
|
|
|
|
|
|
|
|
#define RTCF_VALVE 0x00200000
|
|
|
|
#define RTCF_MASQ 0x00400000
|
|
|
|
#define RTCF_NAT 0x00800000
|
|
|
|
#define RTCF_DOREDIRECT 0x01000000
|
|
|
|
#define RTCF_LOG 0x02000000
|
|
|
|
#define RTCF_DIRECTSRC 0x04000000
|
|
|
|
|
|
|
|
#define RTF_LOCAL 0x80000000
|
|
|
|
#define RTF_INTERFACE 0x40000000
|
|
|
|
#define RTF_MULTICAST 0x20000000
|
|
|
|
#define RTF_BROADCAST 0x10000000
|
|
|
|
#define RTF_NAT 0x08000000
|
|
|
|
|
|
|
|
#define RTF_ADDRCLASSMASK 0xF8000000
|
Installed-header hygiene (BZ#20366): obsolete BSD u_* types.
The types u_char, u_short, u_int, u_long, ushort, uint, ulong, u_int8_t,
u_int16_t, u_int32_t, u_int64_t, quad_t, and u_quad_t are BSDisms that
have never been standardized. While glibc should continue to *provide*
these types for compatibility's sake, its public headers should not
use them.
The meat of this change was mechanically generated by the following
shell command:
perl -pi~ -e '
s/\b(__)?u_char\b/unsigned char/g;
s/\b(__)?u_?short\b/unsigned short/g;
s/\b(__)?u_?int\b/unsigned int/g;
s/\b(__)?u_?long\b/unsigned long/g;
s/\b(__)?u_int8_t\b/uint8_t/g;
s/\b(__)?u_int16_t\b/uint16_t/g;
s/\b(__)?u_int32_t\b/uint32_t/g;
s/\b(__)?u_int64_t\b/uint64_t/g;
s/\b(__)?u_quad_t\b/uint64_t/g;
s/\b(__)?quad_t\b/uint64_t/g;
' $(grep -lE -e '\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' \
$(grep -LE '\<(_(SYS|BITS)_TYPES_H|rpc/(rpc|rpc_msg|types|xdr)\.h)\>' \
$(find . \( -false $(sed 's/^/-o -name /' all-installed-headers) \
\) -printf '%P\n' | sort -u)))
where 'all-installed-headers' was a list of the basenames of all installed
header files, manually extracted from the Makefiles. Non-installed
wrapper headers in include/ are also adjusted, for consistency.
I then manually fixed up indentation and line-wrapping.
sys/types.h and bits/types.h are excluded because they must continue
to define the u_* types (under __USE_MISC) for compatibility with
applications. They do not use these types themselves.
All headers that (transitively) include rpc/types.h are also excluded,
for three reasons. First, the u_* types are defined by rpc/types.h,
unconditionally (not just under __USE_MISC) so they are logically part
of the SunRPC API. Second, many of those headers appear to be
machine-generated. Third, it's my understanding that we are getting
rid of as much of SunRPC as possible in the near future.
(The one file under sunrpc/ that's touched, sunrpc/rpc/rpc_des.h, does
*not* include rpc/types.h. This may itself be a bug.)
After changing from u_intNN_t to uintNN_t, a number of headers now
need to include stdint.h to pick up those types. It might be more
hygenic, namespace-wise, to use __uintNN_t instead, but none of these
headers are bound by ISO or POSIX to do so, and it's unlikely that
anyone using them will be bothered. (The two files that were using
__-prefixed versions of the u_types, sysdeps/mach/hurd/net/route.h and
sysdeps/unix/sysv/linux/net/route.h, both already also contained uses of
the unprefixed versions.)
Some of these files directly included features.h and/or sys/cdefs.h,
which I removed, as the style generally seems to be to let sys/types.h
do that for us. (This does not change the set of definitions exposed
by any header; sys/types.h unconditionally includes both features.h
and sys/cdefs.h.)
One file included asm/types.h unnecessarily.
* bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h
* inet/protocols/routed.h, inet/protocols/talkd.h
* inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h
* resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h
* sysdeps/generic/netinet/if_ether.h
* sysdeps/generic/netinet/in_systm.h
* sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h
* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
* sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h
* sysdeps/mach/hurd/net/if_arp.h
* sysdeps/mach/hurd/net/if_ppp.h
* sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h
* sysdeps/unix/sysv/linux/bits/in.h
* sysdeps/unix/sysv/linux/net/ethernet.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/if_ppp.h
* sysdeps/unix/sysv/linux/net/if_shaper.h
* sysdeps/unix/sysv/linux/net/route.h
* sysdeps/unix/sysv/linux/netinet/if_ether.h
* sysdeps/unix/sysv/linux/netinet/if_fddi.h
* sysdeps/unix/sysv/linux/netinet/if_tr.h
* sysdeps/unix/sysv/linux/netipx/ipx.h
* sysdeps/unix/sysv/linux/sys/acct.h
* include/arpa/nameser.h, include/resolv.h:
Change all uses of u_char to unsigned char,
u_short and ushort to unsigned short, u_int and uint to unsigned int,
u_long and ulong to unsigned long, u_int8_t to uint8_t,
u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t,
and u_int64_t and u_quad_t to uint64_t.
* mach/sys/reboot.h: Remove two casts of integer literals
to the types they already have.
* bits/in.h: Correct error in description of IP_MULTICAST_LOOP.
* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
* sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment
from referring to 'unsigned char' to 'uint8_t' for consistency with
the macro definition below.
* gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h
* io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h
* sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h
* sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h
* sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h
* sysdeps/unix/sysv/linux/sys/acct.h
* include/arpa/nameser.h, include/resolv.h:
Fix indentation disrupted by mechanical edits.
* inet/protocols/talkd.h, resolv/arpa/nameser.h
* sysdeps/generic/netinet/in_systm.h
* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
* sysdeps/gnu/netinet/udp.h
* sysdeps/unix/sysv/linux/net/ethernet.h
* sysdeps/unix/sysv/linux/net/if_arp.h
* sysdeps/unix/sysv/linux/net/if_ppp.h
* sysdeps/unix/sysv/linux/net/if_shaper.h
* sysdeps/unix/sysv/linux/netinet/if_fddi.h
* sysdeps/unix/sysv/linux/netinet/if_tr.h
* sysdeps/unix/sysv/linux/netipx/ipx.h
* sysdeps/unix/sysv/linux/sys/acct.h
Include stdint.h for uintNN_t definitions.
Don't include sys/cdefs.h, features.h, or asm/types.h directly.
2016-08-21 19:38:41 +00:00
|
|
|
#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23)
|
1997-07-06 22:02:42 +00:00
|
|
|
|
|
|
|
#define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK)
|
|
|
|
|
|
|
|
#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \
|
|
|
|
== (RTF_LOCAL|RTF_INTERFACE))
|
|
|
|
|
|
|
|
#define RT_CLASS_UNSPEC 0
|
|
|
|
#define RT_CLASS_DEFAULT 253
|
|
|
|
|
|
|
|
#define RT_CLASS_MAIN 254
|
|
|
|
#define RT_CLASS_LOCAL 255
|
|
|
|
#define RT_CLASS_MAX 255
|
|
|
|
|
|
|
|
|
|
|
|
#define RTMSG_ACK NLMSG_ACK
|
|
|
|
#define RTMSG_OVERRUN NLMSG_OVERRUN
|
|
|
|
|
|
|
|
#define RTMSG_NEWDEVICE 0x11
|
|
|
|
#define RTMSG_DELDEVICE 0x12
|
|
|
|
#define RTMSG_NEWROUTE 0x21
|
|
|
|
#define RTMSG_DELROUTE 0x22
|
|
|
|
#define RTMSG_NEWRULE 0x31
|
|
|
|
#define RTMSG_DELRULE 0x32
|
|
|
|
#define RTMSG_CONTROL 0x40
|
|
|
|
|
|
|
|
#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */
|
|
|
|
|
|
|
|
#endif /* net/route.h */
|