Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
git-mirror
/
glibc
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security
Insights
Files
b194db7
abilist
aout
argp
assert
bits
catgets
conf
conform
crypt
csu
ctype
debug
dirent
dlfcn
elf
gmon
gnulib
grp
hesiod
hurd
iconv
iconvdata
include
inet
intl
io
libidn
libio
locale
localedata
login
mach
malloc
manual
math
misc
nis
nptl
nptl_db
nscd
nss
po
posix
bits
glob
rxspencer
sys
.cvsignore
BOOST.tests
Depend
Makefile
PCRE.tests
PTESTS
PTESTS2C.sed
TESTS
TESTS2C.sed
Versions
_exit.c
alarm.c
annexc.c
bsd-getpgrp.c
bug-ga1.c
bug-ga2.c
bug-glob1.c
bug-glob2.c
bug-regex1.c
bug-regex10.c
bug-regex11.c
bug-regex12.c
bug-regex13.c
bug-regex14.c
bug-regex15.c
bug-regex16.c
bug-regex17.c
bug-regex18.c
bug-regex19.c
bug-regex2.c
bug-regex20.c
bug-regex21.c
bug-regex22.c
bug-regex23.c
bug-regex24.c
bug-regex25.c
bug-regex26.c
bug-regex27.c
bug-regex28.c
bug-regex3.c
bug-regex4.c
bug-regex5.c
bug-regex6.c
bug-regex7.c
bug-regex8.c
bug-regex9.c
confstr.c
cpio.h
environ.c
execl.c
execle.c
execlp.c
execv.c
execve.c
execvp.c
fexecve.c
fnmatch.c
fnmatch.h
fnmatch_loop.c
fork.c
fpathconf.c
gai.conf
gai_strerror.c
get_child_max.c
getaddrinfo.c
getconf.c
getegid.c
geteuid.c
getgid.c
getgroups.c
getlogin.c
getlogin_r.c
getopt.c
getopt.h
getopt1.c
getopt_init.c
getopt_int.h
getpgid.c
getpgrp.c
getpid.c
getppid.c
getresgid.c
getresuid.c
getsid.c
getuid.c
glob.c
glob.h
glob64.c
globtest.c
globtest.sh
group_member.c
init-posix.c
nanosleep.c
pathconf.c
pause.c
posix_madvise.c
pread.c
pread64.c
ptestcases.h
pwrite.c
pwrite64.c
re_comp.h
regcomp.c
regex.c
regex.h
regex_internal.c
regex_internal.h
regexbug1.c
regexec.c
runptests.c
runtests.c
sched.h
sched_cpualloc.c
sched_cpucount.c
sched_cpufree.c
sched_getaffinity.c
sched_getp.c
sched_gets.c
sched_primax.c
sched_primin.c
sched_rr_gi.c
sched_setaffinity.c
sched_setp.c
sched_sets.c
sched_yield.c
setgid.c
setlogin.c
setpgid.c
setpgrp.c
setresgid.c
setresuid.c
setsid.c
setuid.c
sleep.c
spawn.c
spawn.h
spawn_faction_addclose.c
spawn_faction_adddup2.c
spawn_faction_addopen.c
spawn_faction_destroy.c
spawn_faction_init.c
spawn_int.h
spawnattr_destroy.c
spawnattr_getdefault.c
spawnattr_getflags.c
spawnattr_getpgroup.c
spawnattr_getschedparam.c
spawnattr_getschedpolicy.c
spawnattr_getsigmask.c
spawnattr_init.c
spawnattr_setdefault.c
spawnattr_setflags.c
spawnattr_setpgroup.c
spawnattr_setschedparam.c
spawnattr_setschedpolicy.c
spawnattr_setsigmask.c
spawni.c
spawnp.c
sysconf.c
tar.h
test-vfork.c
testcases.h
testfnm.c
times.c
transbug.c
tst-boost.c
tst-chmod.c
tst-cpucount.c
tst-cpuset.c
tst-dir.c
tst-exec.c
tst-execl1.c
tst-execl2.c
tst-execle1.c
tst-execle2.c
tst-execlp1.c
tst-execlp2.c
tst-execv1.c
tst-execv2.c
tst-execve1.c
tst-execve2.c
tst-execvp1.c
tst-execvp2.c
tst-execvp3.c
tst-execvp4.c
tst-fnmatch.c
tst-fnmatch.input
tst-fnmatch2.c
tst-fork.c
tst-getaddrinfo.c
tst-getaddrinfo2.c
tst-getaddrinfo3.c
tst-getconf.sh
tst-getlogin.c
tst-gnuglob.c
tst-mmap.c
tst-nanosleep.c
tst-nice.c
tst-pcre.c
tst-preadwrite.c
tst-preadwrite64.c
tst-regex.c
tst-regex2.c
tst-regexloc.c
tst-rfc3484-2.c
tst-rfc3484-3.c
tst-rfc3484.c
tst-rxspencer.c
tst-spawn.c
tst-sysconf.c
tst-truncate.c
tst-truncate64.c
tst-vfork1.c
tst-vfork2.c
tst-vfork3.c
tst-waitid.c
tstgetopt.c
uname.c
unistd.h
vfork.c
wait.c
wait.h
wait3.c
wait4.c
waitid.c
waitpid.c
wordexp-test.c
wordexp-tst.sh
wordexp.c
wordexp.h
pwd
resolv
resource
rt
scripts
setjmp
shadow
signal
socket
soft-fp
stdio-common
stdlib
streams
string
sunrpc
sysdeps
sysvipc
termios
time
timezone
wcsmbs
wctype
.cvsignore
BUGS
CANCEL-FCT-WAIVE
CANCEL-FILE-WAIVE
CONFORMANCE
COPYING
COPYING.LIB
ChangeLog
ChangeLog.1
ChangeLog.10
ChangeLog.11
ChangeLog.12
ChangeLog.13
ChangeLog.14
ChangeLog.15
ChangeLog.16
ChangeLog.2
ChangeLog.3
ChangeLog.4
ChangeLog.5
ChangeLog.6
ChangeLog.7
ChangeLog.8
ChangeLog.9
FAQ
FAQ.in
INSTALL
LICENSES
Makeconfig
Makefile
Makefile.in
Makerules
NAMESPACE
NEWS
NOTES
PROJECTS
README
README.libm
README.template
Rules
Versions.def
WUR-REPORT
abi-tags
aclocal.m4
config-name.in
config.h.in
config.make.in
configure
configure.in
cppflags-iterator.mk
extra-lib.mk
extra-modules.mk
o-iterator.mk
shlib-versions
test-skeleton.c
tls.make.c
version.h
Breadcrumbs
glibc
/
posix
/
tst-rfc3484.c
Blame
Blame
Latest commit
History
History
139 lines (113 loc) · 3.16 KB
Breadcrumbs
glibc
/
posix
/
tst-rfc3484.c
Top
File metadata and controls
Code
Blame
139 lines (113 loc) · 3.16 KB
Raw
#include <stdbool.h> #include <stdio.h> #include <ifaddrs.h> /* Internal definitions used in the libc code. */ #define __getservbyname_r getservbyname_r #define __socket socket #define __getsockname getsockname #define __inet_aton inet_aton #define __gethostbyaddr_r gethostbyaddr_r #define __gethostbyname2_r gethostbyname2_r void attribute_hidden __check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen) { *p1 = *p2 = true; *in6ai = NULL; *in6ailen = 0; } void attribute_hidden __check_native (uint32_t a1_index, int *a1_native, uint32_t a2_index, int *a2_native) { } int attribute_hidden __idna_to_ascii_lz (const char *input, char **output, int flags) { return 0; } int attribute_hidden __idna_to_unicode_lzlz (const char *input, char **output, int flags) { *output = NULL; return 0; } void attribute_hidden _res_hconf_init (void) { } #include "../sysdeps/posix/getaddrinfo.c" service_user *__nss_hosts_database attribute_hidden; /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ #if __BYTE_ORDER == __BIG_ENDIAN # define h(n) n #else # define h(n) __bswap_constant_32 (n) #endif struct sockaddr_in addrs[] = { { .sin_family = AF_INET, .sin_addr = { h (0xc0a86d1d) } }, { .sin_family = AF_INET, .sin_addr = { h (0xc0a85d03) } }, { .sin_family = AF_INET, .sin_addr = { h (0xc0a82c3d) } }, { .sin_family = AF_INET, .sin_addr = { h (0xc0a86002) } }, { .sin_family = AF_INET, .sin_addr = { h (0xc0a802f3) } }, { .sin_family = AF_INET, .sin_addr = { h (0xc0a80810) } }, { .sin_family = AF_INET, .sin_addr = { h (0xc0a85e02) } } }; #define naddrs (sizeof (addrs) / sizeof (addrs[0])) static struct addrinfo ais[naddrs]; static struct sort_result results[naddrs]; static size_t order[naddrs]; static int expected[naddrs] = { 6, 1, 0, 3, 2, 4, 5 }; ssize_t __getline (char **lineptr, size_t *n, FILE *s) { *lineptr = NULL; *n = 0; return 0; } static int do_test (void) { labels = default_labels; precedence = default_precedence; scopes= default_scopes; struct sockaddr_in so; so.sin_family = AF_INET; so.sin_addr.s_addr = h (0xc0a85f19); for (int i = 0; i < naddrs; ++i) { ais[i].ai_family = AF_INET; ais[i].ai_addr = (struct sockaddr *) &addrs[i]; results[i].dest_addr = &ais[i]; results[i].got_source_addr = true; memcpy(&results[i].source_addr, &so, sizeof (so)); results[i].source_addr_len = sizeof (so); results[i].source_addr_flags = 0; results[i].prefixlen = 8; results[i].index = 0; order[i] = i; } struct sort_result_combo combo = { .results = results, .nresults = naddrs }; qsort_r (order, naddrs, sizeof (order[0]), rfc3484_sort, &combo); int result = 0; for (int i = 0; i < naddrs; ++i) { struct in_addr addr = ((struct sockaddr_in *) (results[order[i]].dest_addr->ai_addr))->sin_addr; int here = memcmp (&addr, &addrs[expected[i]].sin_addr, sizeof (struct in_addr)); printf ("[%d] = %s: %s\n", i, inet_ntoa (addr), here ? "FAIL" : "OK"); result |= here; } return result; } #define TEST_FUNCTION do_test () #include "../test-skeleton.c"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
You can’t perform that action at this time.