| 1 |
.\" Copyright Red Hat, Inc. |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: GPL-2.0-only |
| 5 |
.\" |
| 6 |
.TH gai.conf 5 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
gai.conf \- getaddrinfo(3) configuration file |
| 9 |
.SH DESCRIPTION |
| 10 |
A call to |
| 11 |
.BR getaddrinfo (3) |
| 12 |
might return multiple answers. |
| 13 |
According to RFC\ 3484 these answers must be sorted so that |
| 14 |
the answer with the highest success rate is first in the list. |
| 15 |
The RFC provides an algorithm for the sorting. |
| 16 |
The static rules are not always adequate, though. |
| 17 |
For this reason, |
| 18 |
the RFC also requires that system administrators should have the possibility |
| 19 |
to dynamically change the sorting. |
| 20 |
For the glibc implementation, this can be achieved with the |
| 21 |
.I /etc/gai.conf |
| 22 |
file. |
| 23 |
.P |
| 24 |
Each line in the configuration file consists of a keyword and its parameters. |
| 25 |
White spaces in any place are ignored. |
| 26 |
Lines starting with \[aq]#\[aq] are comments and are ignored. |
| 27 |
.P |
| 28 |
The keywords currently recognized are: |
| 29 |
.TP |
| 30 |
.BI label\~ netmask\~label |
| 31 |
The value is added to the label table used in the RFC\ 3484 sorting. |
| 32 |
If any |
| 33 |
.B label |
| 34 |
definition is present in the configuration file, |
| 35 |
the default table is not used. |
| 36 |
All the label definitions |
| 37 |
of the default table which are to be maintained have to be duplicated. |
| 38 |
Following the keyword, |
| 39 |
the line has to contain a network mask and a label value. |
| 40 |
.TP |
| 41 |
.BI precedence\~ netmask\~precedence |
| 42 |
This keyword is similar to |
| 43 |
.BR label , |
| 44 |
but instead the value is added |
| 45 |
to the precedence table as specified in RFC\ 3484. |
| 46 |
Once again, the |
| 47 |
presence of a single |
| 48 |
.B precedence |
| 49 |
line in the configuration file |
| 50 |
causes the default table to not be used. |
| 51 |
.TP |
| 52 |
.BR reload\~ < yes | no > |
| 53 |
This keyword controls whether a process checks whether the configuration |
| 54 |
file has been changed since the last time it was read. |
| 55 |
If the value is |
| 56 |
.RB \[dq] yes \[dq], |
| 57 |
the file is reread. |
| 58 |
This might cause problems in multithreaded |
| 59 |
applications and is generally a bad idea. |
| 60 |
The default is |
| 61 |
.RB \[dq] no \[dq]. |
| 62 |
.TP |
| 63 |
.BI scopev4\~ mask\~value |
| 64 |
Add another rule to the RFC\ 3484 scope table for IPv4 address. |
| 65 |
By default, the scope IDs described in section 3.2 in RFC\ 3484 are used. |
| 66 |
Changing these defaults should hardly ever be necessary. |
| 67 |
.SH FILES |
| 68 |
.I /etc/gai.conf |
| 69 |
.SH VERSIONS |
| 70 |
The |
| 71 |
.I gai.conf |
| 72 |
.\" Added in 2006 |
| 73 |
file is supported since glibc 2.5. |
| 74 |
.SH EXAMPLES |
| 75 |
The default table according to RFC\ 3484 would be specified with the |
| 76 |
following configuration file: |
| 77 |
.P |
| 78 |
.in +4n |
| 79 |
.EX |
| 80 |
label ::1/128 0 |
| 81 |
label ::/0 1 |
| 82 |
label 2002::/16 2 |
| 83 |
label ::/96 3 |
| 84 |
label ::ffff:0:0/96 4 |
| 85 |
precedence ::1/128 50 |
| 86 |
precedence ::/0 40 |
| 87 |
precedence 2002::/16 30 |
| 88 |
precedence ::/96 20 |
| 89 |
precedence ::ffff:0:0/96 10 |
| 90 |
.EE |
| 91 |
.in |
| 92 |
.P |
| 93 |
glibc includes some extra rules in the label table |
| 94 |
for site-local addresses, ULA, and Teredo tunnels. |
| 95 |
Its default label table is: |
| 96 |
.in +4n |
| 97 |
.EX |
| 98 |
label ::1/128 0 |
| 99 |
label ::/0 1 |
| 100 |
label 2002::/16 2 |
| 101 |
label ::/96 3 |
| 102 |
label ::ffff:0:0/96 4 |
| 103 |
label fec0::/10 5 |
| 104 |
label fc00::/7 6 |
| 105 |
label 2001:0::/32 7 |
| 106 |
.EE |
| 107 |
.in |
| 108 |
.\" .SH AUTHOR |
| 109 |
.\" Ulrich Drepper <[email protected]> |
| 110 |
.\" |
| 111 |
.SH SEE ALSO |
| 112 |
.BR getaddrinfo (3), |
| 113 |
RFC\ 3484 |