Codebase list iputils / eea655d
Put IPv6 header NextHeader field definitions into header Instead of hardwire 43 and 44 constants, it's better to copy the definitions from include/net/ipv6.h from kernel. Closes: https://github.com/iputils/iputils/pull/256 Reviewed-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Petr Vorel <pvorel@suse.cz> Petr Vorel authored 4 years ago Petr Vorel committed 3 years ago
3 changed file(s) with 34 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 // SPDX-License-Identifier: GPL-2.0-or-later
1 /*
2 * Copyright (c) 2020 Petr Vorel <petr.vorel@gmail.com>
3 */
4
5 #ifndef IPV6_H
6 #define IPV6_H
7
8 /* Definitions from kernel include/net/ipv6.h */
9
10 /*
11 * NextHeader field of IPv6 header
12 */
13
14 #define NEXTHDR_HOP 0 /* Hop-by-hop option header. */
15 #define NEXTHDR_TCP 6 /* TCP segment. */
16 #define NEXTHDR_UDP 17 /* UDP message. */
17 #define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
18 #define NEXTHDR_ROUTING 43 /* Routing header. */
19 #define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
20 #define NEXTHDR_GRE 47 /* GRE header. */
21 #define NEXTHDR_ESP 50 /* Encapsulating security payload. */
22 #define NEXTHDR_AUTH 51 /* Authentication header. */
23 #define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
24 #define NEXTHDR_NONE 59 /* No next header */
25 #define NEXTHDR_DEST 60 /* Destination options header. */
26 #define NEXTHDR_SCTP 132 /* SCTP message. */
27 #define NEXTHDR_MOBILITY 135 /* Mobility header. */
28
29 #endif /* IPV6_H */
6060
6161 #include "iputils_common.h"
6262 #include "iputils_ni.h"
63 #include "ipv6.h"
6364 #include "ping.h"
6465
6566 #ifndef IPV6_FLOWLABEL_MGR
863864
864865 nexthdr = iph1->ip6_nxt;
865866
866 if (nexthdr == 44) {
867 if (nexthdr == NEXTHDR_FRAGMENT) {
867868 nexthdr = *(uint8_t *)icmph1;
868869 icmph1++;
869870 }
252252 #endif
253253
254254 #include "iputils_common.h"
255 #include "ipv6.h"
255256
256257 #ifdef USE_IDN
257258 # define ADDRINFO_IDN_FLAGS AI_IDN
530531 up = (struct udphdr *)(hip + 1);
531532 nexthdr = hip->ip6_nxt;
532533
533 if (nexthdr == 44) {
534 if (nexthdr == NEXTHDR_FRAGMENT) {
534535 nexthdr = *(unsigned char *)up;
535536 up++;
536537 }