1997-07-06 22:02:42 +00:00
|
|
|
/* Definitions for Address Resolution Protocol.
|
2021-01-02 19:32:25 +00:00
|
|
|
Copyright (C) 1997-2021 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_IF_ARP_H
|
|
|
|
|
|
|
|
#define _NET_IF_ARP_H 1
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2018-01-29 00:48:24 +00:00
|
|
|
#include <stdint.h>
|
1997-07-06 22:02:42 +00:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
/* Some internals from deep down in the kernel. */
|
|
|
|
#define MAX_ADDR_LEN 7
|
|
|
|
|
|
|
|
|
|
|
|
/* This structure defines an ethernet arp header. */
|
|
|
|
|
|
|
|
/* ARP protocol opcodes. */
|
|
|
|
#define ARPOP_REQUEST 1 /* ARP request. */
|
|
|
|
#define ARPOP_REPLY 2 /* ARP reply. */
|
|
|
|
#define ARPOP_RREQUEST 3 /* RARP request. */
|
|
|
|
#define ARPOP_RREPLY 4 /* RARP reply. */
|
|
|
|
|
|
|
|
/* See RFC 826 for protocol description. ARP packets are variable
|
|
|
|
in size; the arphdr structure defines the fixed-length portion.
|
|
|
|
Protocol type values are the same as those for 10 Mb/s Ethernet.
|
|
|
|
It is followed by the variable-sized fields ar_sha, arp_spa,
|
|
|
|
arp_tha and arp_tpa in that order, according to the lengths
|
|
|
|
specified. Field names used correspond to RFC 826. */
|
|
|
|
|
|
|
|
struct arphdr
|
|
|
|
{
|
|
|
|
unsigned short int ar_hrd; /* Format of hardware address. */
|
|
|
|
unsigned short int ar_pro; /* Format of protocol address. */
|
|
|
|
unsigned char ar_hln; /* Length of hardware address. */
|
|
|
|
unsigned char ar_pln; /* Length of protocol address. */
|
|
|
|
unsigned short int ar_op; /* ARP opcode (command). */
|
|
|
|
#if 0
|
|
|
|
/* Ethernet looks like this : This bit is variable sized
|
|
|
|
however... */
|
|
|
|
unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */
|
|
|
|
unsigned char __ar_sip[4]; /* Sender IP address. */
|
|
|
|
unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */
|
|
|
|
unsigned char __ar_tip[4]; /* Target IP address. */
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* ARP protocol HARDWARE identifiers. */
|
|
|
|
#define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */
|
|
|
|
#define ARPHRD_ETHER 1 /* Ethernet 10Mbps. */
|
|
|
|
#define ARPHRD_EETHER 2 /* Experimental Ethernet. */
|
|
|
|
#define ARPHRD_AX25 3 /* AX.25 Level 2. */
|
|
|
|
#define ARPHRD_PRONET 4 /* PROnet token ring. */
|
|
|
|
#define ARPHRD_CHAOS 5 /* Chaosnet. */
|
|
|
|
#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */
|
|
|
|
#define ARPHRD_ARCNET 7 /* ARCnet. */
|
|
|
|
#define ARPHRD_APPLETLK 8 /* APPLEtalk. */
|
|
|
|
#define ARPHRD_DLCI 15 /* Frame Relay DLCI. */
|
|
|
|
#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */
|
|
|
|
|
|
|
|
/* Dummy types for non ARP hardware */
|
|
|
|
#define ARPHRD_SLIP 256
|
|
|
|
#define ARPHRD_CSLIP 257
|
|
|
|
#define ARPHRD_SLIP6 258
|
|
|
|
#define ARPHRD_CSLIP6 259
|
|
|
|
#define ARPHRD_RSRVD 260 /* Notional KISS type. */
|
|
|
|
#define ARPHRD_ADAPT 264
|
|
|
|
#define ARPHRD_ROSE 270
|
|
|
|
#define ARPHRD_X25 271 /* CCITT X.25. */
|
|
|
|
#define ARPHRD_PPP 512
|
|
|
|
#define ARPHRD_HDLC 513 /* (Cisco) HDLC. */
|
|
|
|
#define ARPHRD_LAPB 516 /* LAPB. */
|
|
|
|
|
|
|
|
#define ARPHRD_TUNNEL 768 /* IPIP tunnel. */
|
|
|
|
#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */
|
|
|
|
#define ARPHRD_FRAD 770 /* Frame Relay Access Device. */
|
|
|
|
#define ARPHRD_SKIP 771 /* SKIP vif. */
|
|
|
|
#define ARPHRD_LOOPBACK 772 /* Loopback device. */
|
|
|
|
#define ARPHRD_LOCALTLK 773 /* Localtalk device. */
|
|
|
|
#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */
|
|
|
|
#define ARPHRD_BIF 775 /* AP1000 BIF. */
|
|
|
|
#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */
|
|
|
|
|
|
|
|
|
|
|
|
/* ARP ioctl request. */
|
|
|
|
struct arpreq
|
|
|
|
{
|
|
|
|
struct sockaddr arp_pa; /* Protocol address. */
|
|
|
|
struct sockaddr arp_ha; /* Hardware address. */
|
|
|
|
int arp_flags; /* Flags. */
|
|
|
|
struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */
|
|
|
|
char arp_dev[16];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ARP Flag values. */
|
|
|
|
#define ATF_COM 0x02 /* Completed entry (ha valid). */
|
|
|
|
#define ATF_PERM 0x04 /* Permanent entry. */
|
|
|
|
#define ATF_PUBL 0x08 /* Publish entry. */
|
|
|
|
#define ATF_USETRAILERS 0x10 /* Has requested trailers. */
|
|
|
|
#define ATF_NETMASK 0x20 /* Want to use a netmask (only
|
|
|
|
for proxy entries). */
|
|
|
|
#define ATF_DONTPUB 0x40 /* Don't answer this addresses. */
|
|
|
|
#define ATF_MAGIC 0x80 /* Automatically added entry. */
|
|
|
|
|
|
|
|
|
|
|
|
/* Support for the user space arp daemon, arpd. */
|
|
|
|
#define ARPD_UPDATE 0x01
|
|
|
|
#define ARPD_LOOKUP 0x02
|
|
|
|
#define ARPD_FLUSH 0x03
|
|
|
|
|
|
|
|
struct arpd_request
|
|
|
|
{
|
|
|
|
unsigned short int req; /* Request type. */
|
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
|
|
|
uint32_t ip; /* IP address of entry. */
|
1997-07-06 22:02:42 +00:00
|
|
|
unsigned long int dev; /* Device entry is tied to. */
|
|
|
|
unsigned long int stamp;
|
|
|
|
unsigned long int updated;
|
|
|
|
unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */
|
|
|
|
};
|
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* net/if_arp.h */
|