Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additions for iputils #1230

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions abis/linux/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ struct group_source_req {
#define IP_HDRINCL 3
#define IP_OPTIONS 4
#define IP_RECVOPTS 6
#define IP_RETOPTS 7
#define IP_PKTINFO 8
#define IP_PKTOPTIONS 9
#define IP_MTU_DISCOVER 10
Expand All @@ -166,12 +167,14 @@ struct group_source_req {
#define IP_UNICAST_IF 50

#define IPV6_2292PKTOPTIONS 6
#define IPV6_2292HOPLIMIT 8
#define IPV6_UNICAST_HOPS 16
#define IPV6_MULTICAST_IF 17
#define IPV6_MULTICAST_HOPS 18
#define IPV6_MULTICAST_LOOP 19
#define IPV6_JOIN_GROUP 20
#define IPV6_LEAVE_GROUP 21
#define IPV6_MTU_DISCOVER 23
#define IPV6_MTU 24
#define IPV6_RECVERR 25
#define IPV6_V6ONLY 26
Expand All @@ -186,6 +189,13 @@ struct group_source_req {
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP

#define IPV6_PMTUDISC_DONT 0
#define IPV6_PMTUDISC_WANT 1
#define IPV6_PMTUDISC_DO 2
#define IPV6_PMTUDISC_PROBE 3
#define IPV6_PMTUDISC_INTERFACE 4
#define IPV6_PMTUDISC_OMIT 5

#define IP_PMTUDISC_DONT 0
#define IP_PMTUDISC_WANT 1
#define IP_PMTUDISC_DO 2
Expand Down
1 change: 1 addition & 0 deletions abis/linux/ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define TIOCNXCL 0x540D

#define SIOCPROTOPRIVATE 0x89E0
#define SIOCGSTAMP 0x8906
#define SIOCGIFNAME 0x8910
#define SIOCGIFCONF 0x8912
#define SIOCGIFFLAGS 0x8913
Expand Down
5 changes: 5 additions & 0 deletions options/glibc/generic/resolv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ void res_nclose(res_state) {
return;
}

int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **) {
__ensure(!"Not implemented");
__builtin_unreachable();
}

/* This is completely unused, and exists purely to satisfy broken apps. */

struct __res_state *__res_state() {
Expand Down
2 changes: 2 additions & 0 deletions options/glibc/include/resolv.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ int res_query(const char *__dname, int __class, int __type,

int res_init(void);

int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);

#endif /* !__MLIBC_ABI_ONLY */

/* From musl: Unused; purely for broken apps
Expand Down
22 changes: 22 additions & 0 deletions options/posix/include/netinet/icmp6.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,35 @@ extern "C" {

#define ICMP6_FILTER 1

#define ICMP6_DST_UNREACH 1
#define ICMP6_PACKET_TOO_BIG 2
#define ICMP6_TIME_EXCEEDED 3
#define ICMP6_PARAM_PROB 4

#define ICMP6_FILTER_BLOCK 1
#define ICMP6_FILTER_PASS 2
#define ICMP6_FILTER_BLOCKOTHERS 3
#define ICMP6_FILTER_PASSONLY 4
#define ICMP6_ECHO_REQUEST 128
#define ICMP6_ECHO_REPLY 129

#define MLD_LISTENER_QUERY 130
#define MLD_LISTENER_REPORT 131
#define MLD_LISTENER_REDUCTION 132

#define ICMP6_DST_UNREACH_NOROUTE 0
#define ICMP6_DST_UNREACH_ADMIN 1
#define ICMP6_DST_UNREACH_BEYONDSCOPE 2
#define ICMP6_DST_UNREACH_ADDR 3
#define ICMP6_DST_UNREACH_NOPORT 4

#define ICMP6_TIME_EXCEED_TRANSIT 0
#define ICMP6_TIME_EXCEED_REASSEMBLY 1

#define ICMP6_PARAMPROB_HEADER 0
#define ICMP6_PARAMPROB_NEXTHEADER 1
#define ICMP6_PARAMPROB_OPTION 2

struct icmp6_filter {
uint32_t icmp6_filt[8];
};
Expand Down
41 changes: 41 additions & 0 deletions options/posix/include/netinet/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,47 @@ extern "C" {
#define IPTOS_CLASS_CS6 0xC0
#define IPTOS_DSCP_EF 0xB8

#define IPOPT_COPY 0x80
#define IPOPT_CLASS_MASK 0x60
#define IPOPT_NUMBER_MASK 0x1f

#define IPOPT_COPIED(o) ((o) & IPOPT_COPY)
#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK)
#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK)

#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_DEBMEAS 0x40
#define IPOPT_MEASUREMENT IPOPT_DEBMEAS
#define IPOPT_RESERVED2 0x60

#define IPOPT_EOL 0
#define IPOPT_END IPOPT_EOL
#define IPOPT_NOP 1
#define IPOPT_NOOP IPOPT_NOP

#define IPOPT_RR 7
#define IPOPT_TS 68
#define IPOPT_TIMESTAMP IPOPT_TS
#define IPOPT_SECURITY 130
#define IPOPT_SEC IPOPT_SECURITY
#define IPOPT_LSRR 131
#define IPOPT_SATID 136
#define IPOPT_SID IPOPT_SATID
#define IPOPT_SSRR 137
#define IPOPT_RA 148

#define IPOPT_OPTVAL 0
#define IPOPT_OLEN 1
#define IPOPT_OFFSET 2
#define IPOPT_MINOFF 4

#define MAX_IPOPTLEN 40

#define IPOPT_TS_TSONLY 0
#define IPOPT_TS_TSANDADDR 1
#define IPOPT_TS_PRESPEC 3

#define IPDEFTTL 64

struct ip {
Expand Down
2 changes: 2 additions & 0 deletions options/posix/include/netinet/ip6.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ struct ip6_hdr {
struct in6_addr ip6_dst;
};

#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt

#ifdef __cplusplus
}
#endif
Expand Down
56 changes: 56 additions & 0 deletions options/posix/include/netinet/ip_icmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,64 @@ extern "C" {
#include <netinet/in.h>
#include <netinet/ip.h>

struct icmphdr {
uint8_t type;
uint8_t code;
uint16_t checksum;
union {
struct {
uint16_t id;
uint16_t sequence;
} echo;
uint32_t gateway;
struct {
uint16_t __unused;
uint16_t mtu;
} frag;
uint8_t reserved[4];
} un;
};

#define ICMP_ECHOREPLY 0
#define ICMP_DEST_UNREACH 3
#define ICMP_SOURCE_QUENCH 4
#define ICMP_REDIRECT 5
#define ICMP_ECHO 8
#define ICMP_TIME_EXCEEDED 11
#define ICMP_PARAMETERPROB 12
#define ICMP_TIMESTAMP 13
#define ICMP_TIMESTAMPREPLY 14
#define ICMP_INFO_REQUEST 15
#define ICMP_INFO_REPLY 16
#define ICMP_ADDRESS 17
#define ICMP_ADDRESSREPLY 18

#define ICMP_NET_UNREACH 0
#define ICMP_HOST_UNREACH 1
#define ICMP_PROT_UNREACH 2
#define ICMP_PORT_UNREACH 3
#define ICMP_FRAG_NEEDED 4
#define ICMP_SR_FAILED 5
#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
#define ICMP_PREC_VIOLATION 14
#define ICMP_PREC_CUTOFF 15
#define NR_ICMP_UNREACH 15

#define ICMP_REDIR_NET 0
#define ICMP_REDIR_HOST 1
#define ICMP_REDIR_NETTOS 2
#define ICMP_REDIR_HOSTTOS 3

#define ICMP_EXC_TTL 0
#define ICMP_EXC_FRAGTIME 1

#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8)

struct icmp_ra_addr {
Expand Down
Loading