Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbcc8b14

Browse files
committed
Remove configure probe for sockaddr_in6 and require AF_INET6.
SUSv3 <netinet/in.h> defines struct sockaddr_in6, and all targeted Unixsystems have it. Windows has it in <ws2ipdef.h>. Remove the configureprobe, the macro and a small amount of dead code.Also remove a mention of IPv6-less builds from the documentation, sincethere aren't any.This is similar to commitsf558088 and077bf2f for Unix sockets. Eventhough AF_INET6 is an "optional" component of SUSv3, there are no knownmodern operating system without it, and it seems even less likely to beomitted from future systems than AF_UNIX.Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com
1 parent28ec316 commitbcc8b14

File tree

16 files changed

+7
-105
lines changed

16 files changed

+7
-105
lines changed

‎configure

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16218,16 +16218,6 @@ cat >>confdefs.h <<_ACEOF
1621816218
_ACEOF
1621916219

1622016220

16221-
ac_fn_c_check_type "$LINENO" "struct sockaddr_in6" "ac_cv_type_struct_sockaddr_in6" "$ac_includes_default
16222-
#include <netinet/in.h>
16223-
"
16224-
if test "x$ac_cv_type_struct_sockaddr_in6" = xyes; then :
16225-
16226-
$as_echo "#define HAVE_IPV6 1" >>confdefs.h
16227-
16228-
fi
16229-
16230-
1623116221
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PS_STRINGS" >&5
1623216222
$as_echo_n "checking for PS_STRINGS... " >&6; }
1623316223
if ${pgac_cv_var_PS_STRINGS+:} false; then :

‎configure.ac

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,12 +1801,6 @@ AC_CHECK_DECLS([pwritev], [], [AC_LIBOBJ(pwritev)], [#include <sys/uio.h>])
18011801
# This is probably only present on macOS, but may as well check always
18021802
AC_CHECK_DECLS(F_FULLFSYNC,[],[],[#include <fcntl.h>])
18031803

1804-
AC_CHECK_TYPE([struct sockaddr_in6],
1805-
[AC_DEFINE(HAVE_IPV6,1,[Define to 1 if you have support for IPv6.])],
1806-
[],
1807-
[$ac_includes_default
1808-
#include <netinet/in.h>])
1809-
18101804
AC_CACHE_CHECK([for PS_STRINGS],[pgac_cv_var_PS_STRINGS],
18111805
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
18121806
[#include <machine/vmparam.h>

‎doc/src/sgml/client-auth.sgml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,6 @@ hostnogssenc <replaceable>database</replaceable> <replaceable>user</replaceabl
305305
An entry given in IPv4 format will match only IPv4 connections,
306306
and an entry given in IPv6 format will match only IPv6 connections,
307307
even if the represented address is in the IPv4-in-IPv6 range.
308-
Note that entries in IPv6 format will be rejected if the system's
309-
C library does not have support for IPv6 addresses.
310308
</para>
311309

312310
<para>

‎src/backend/libpq/auth.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,13 +3015,8 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por
30153015
intpacketlength;
30163016
pgsocketsock;
30173017

3018-
#ifdefHAVE_IPV6
30193018
structsockaddr_in6localaddr;
30203019
structsockaddr_in6remoteaddr;
3021-
#else
3022-
structsockaddr_inlocaladdr;
3023-
structsockaddr_inremoteaddr;
3024-
#endif
30253020
structaddrinfohint;
30263021
structaddrinfo*serveraddrs;
30273022
intport;
@@ -3131,18 +3126,12 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por
31313126
}
31323127

31333128
memset(&localaddr,0,sizeof(localaddr));
3134-
#ifdefHAVE_IPV6
31353129
localaddr.sin6_family=serveraddrs[0].ai_family;
31363130
localaddr.sin6_addr=in6addr_any;
31373131
if (localaddr.sin6_family==AF_INET6)
31383132
addrsize=sizeof(structsockaddr_in6);
31393133
else
31403134
addrsize=sizeof(structsockaddr_in);
3141-
#else
3142-
localaddr.sin_family=serveraddrs[0].ai_family;
3143-
localaddr.sin_addr.s_addr=INADDR_ANY;
3144-
addrsize=sizeof(structsockaddr_in);
3145-
#endif
31463135

31473136
if (bind(sock, (structsockaddr*)&localaddr,addrsize))
31483137
{
@@ -3245,21 +3234,11 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por
32453234
returnSTATUS_ERROR;
32463235
}
32473236

3248-
#ifdefHAVE_IPV6
32493237
if (remoteaddr.sin6_port!=pg_hton16(port))
3250-
#else
3251-
if (remoteaddr.sin_port!=pg_hton16(port))
3252-
#endif
32533238
{
3254-
#ifdefHAVE_IPV6
32553239
ereport(LOG,
32563240
(errmsg("RADIUS response from %s was sent from incorrect port: %d",
32573241
server,pg_ntoh16(remoteaddr.sin6_port))));
3258-
#else
3259-
ereport(LOG,
3260-
(errmsg("RADIUS response from %s was sent from incorrect port: %d",
3261-
server,pg_ntoh16(remoteaddr.sin_port))));
3262-
#endif
32633242
continue;
32643243
}
32653244

‎src/backend/libpq/hba.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,6 @@ ipv4eq(struct sockaddr_in *a, struct sockaddr_in *b)
645645
return (a->sin_addr.s_addr==b->sin_addr.s_addr);
646646
}
647647

648-
#ifdefHAVE_IPV6
649-
650648
staticbool
651649
ipv6eq(structsockaddr_in6*a,structsockaddr_in6*b)
652650
{
@@ -658,7 +656,6 @@ ipv6eq(struct sockaddr_in6 *a, struct sockaddr_in6 *b)
658656

659657
return true;
660658
}
661-
#endif/* HAVE_IPV6 */
662659

663660
/*
664661
* Check whether host name matches pattern.
@@ -747,7 +744,6 @@ check_hostname(hbaPort *port, const char *hostname)
747744
break;
748745
}
749746
}
750-
#ifdefHAVE_IPV6
751747
elseif (gai->ai_addr->sa_family==AF_INET6)
752748
{
753749
if (ipv6eq((structsockaddr_in6*)gai->ai_addr,
@@ -757,7 +753,6 @@ check_hostname(hbaPort *port, const char *hostname)
757753
break;
758754
}
759755
}
760-
#endif
761756
}
762757
}
763758

‎src/backend/libpq/ifaddr.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ static intrange_sockaddr_AF_INET(const struct sockaddr_in *addr,
3434
conststructsockaddr_in*netaddr,
3535
conststructsockaddr_in*netmask);
3636

37-
#ifdefHAVE_IPV6
3837
staticintrange_sockaddr_AF_INET6(conststructsockaddr_in6*addr,
3938
conststructsockaddr_in6*netaddr,
4039
conststructsockaddr_in6*netmask);
41-
#endif
4240

4341

4442
/*
@@ -56,12 +54,10 @@ pg_range_sockaddr(const struct sockaddr_storage *addr,
5654
returnrange_sockaddr_AF_INET((conststructsockaddr_in*)addr,
5755
(conststructsockaddr_in*)netaddr,
5856
(conststructsockaddr_in*)netmask);
59-
#ifdefHAVE_IPV6
6057
elseif (addr->ss_family==AF_INET6)
6158
returnrange_sockaddr_AF_INET6((conststructsockaddr_in6*)addr,
6259
(conststructsockaddr_in6*)netaddr,
6360
(conststructsockaddr_in6*)netmask);
64-
#endif
6561
else
6662
return0;
6763
}
@@ -78,9 +74,6 @@ range_sockaddr_AF_INET(const struct sockaddr_in *addr,
7874
return0;
7975
}
8076

81-
82-
#ifdefHAVE_IPV6
83-
8477
staticint
8578
range_sockaddr_AF_INET6(conststructsockaddr_in6*addr,
8679
conststructsockaddr_in6*netaddr,
@@ -97,7 +90,6 @@ range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr,
9790

9891
return1;
9992
}
100-
#endif/* HAVE_IPV6 */
10193

10294
/*
10395
*pg_sockaddr_cidr_mask - make a network mask of the appropriate family
@@ -147,7 +139,6 @@ pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family)
147139
break;
148140
}
149141

150-
#ifdefHAVE_IPV6
151142
caseAF_INET6:
152143
{
153144
structsockaddr_in6mask6;
@@ -172,7 +163,7 @@ pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family)
172163
memcpy(mask,&mask6,sizeof(mask6));
173164
break;
174165
}
175-
#endif
166+
176167
default:
177168
return-1;
178169
}
@@ -207,13 +198,11 @@ run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data,
207198
if (((structsockaddr_in*)mask)->sin_addr.s_addr==INADDR_ANY)
208199
mask=NULL;
209200
}
210-
#ifdefHAVE_IPV6
211201
elseif (mask->sa_family==AF_INET6)
212202
{
213203
if (IN6_IS_ADDR_UNSPECIFIED(&((structsockaddr_in6*)mask)->sin6_addr))
214204
mask=NULL;
215205
}
216-
#endif
217206
}
218207

219208
/* If mask is invalid, generate our own fully-set mask */
@@ -437,10 +426,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
437426
{
438427
structsockaddr_inaddr;
439428
structsockaddr_storagemask;
440-
441-
#ifdefHAVE_IPV6
442429
structsockaddr_in6addr6;
443-
#endif
444430

445431
/* addr 127.0.0.1/8 */
446432
memset(&addr,0,sizeof(addr));
@@ -452,7 +438,6 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
452438
(structsockaddr*)&addr,
453439
(structsockaddr*)&mask);
454440

455-
#ifdefHAVE_IPV6
456441
/* addr ::1/128 */
457442
memset(&addr6,0,sizeof(addr6));
458443
addr6.sin6_family=AF_INET6;
@@ -462,7 +447,6 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
462447
run_ifaddr_callback(callback,cb_data,
463448
(structsockaddr*)&addr6,
464449
(structsockaddr*)&mask);
465-
#endif
466450

467451
return0;
468452
}

‎src/backend/libpq/pqcomm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,9 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
413413
caseAF_INET:
414414
familyDesc=_("IPv4");
415415
break;
416-
#ifdefHAVE_IPV6
417416
caseAF_INET6:
418417
familyDesc=_("IPv6");
419418
break;
420-
#endif
421419
caseAF_UNIX:
422420
familyDesc=_("Unix");
423421
break;

‎src/backend/utils/adt/network.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,9 +1725,7 @@ inet_client_addr(PG_FUNCTION_ARGS)
17251725
switch (port->raddr.addr.ss_family)
17261726
{
17271727
caseAF_INET:
1728-
#ifdefHAVE_IPV6
17291728
caseAF_INET6:
1730-
#endif
17311729
break;
17321730
default:
17331731
PG_RETURN_NULL();
@@ -1764,9 +1762,7 @@ inet_client_port(PG_FUNCTION_ARGS)
17641762
switch (port->raddr.addr.ss_family)
17651763
{
17661764
caseAF_INET:
1767-
#ifdefHAVE_IPV6
17681765
caseAF_INET6:
1769-
#endif
17701766
break;
17711767
default:
17721768
PG_RETURN_NULL();
@@ -1801,9 +1797,7 @@ inet_server_addr(PG_FUNCTION_ARGS)
18011797
switch (port->laddr.addr.ss_family)
18021798
{
18031799
caseAF_INET:
1804-
#ifdefHAVE_IPV6
18051800
caseAF_INET6:
1806-
#endif
18071801
break;
18081802
default:
18091803
PG_RETURN_NULL();
@@ -1840,9 +1834,7 @@ inet_server_port(PG_FUNCTION_ARGS)
18401834
switch (port->laddr.addr.ss_family)
18411835
{
18421836
caseAF_INET:
1843-
#ifdefHAVE_IPV6
18441837
caseAF_INET6:
1845-
#endif
18461838
break;
18471839
default:
18481840
PG_RETURN_NULL();
@@ -2102,13 +2094,11 @@ inetmi(PG_FUNCTION_ARGS)
21022094
void
21032095
clean_ipv6_addr(intaddr_family,char*addr)
21042096
{
2105-
#ifdefHAVE_IPV6
21062097
if (addr_family==AF_INET6)
21072098
{
21082099
char*pct=strchr(addr,'%');
21092100

21102101
if (pct)
21112102
*pct='\0';
21122103
}
2113-
#endif
21142104
}

‎src/backend/utils/adt/pgstatfuncs.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,8 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
735735
}
736736
else
737737
{
738-
if (beentry->st_clientaddr.addr.ss_family==AF_INET
739-
#ifdefHAVE_IPV6
740-
||beentry->st_clientaddr.addr.ss_family==AF_INET6
741-
#endif
742-
)
738+
if (beentry->st_clientaddr.addr.ss_family==AF_INET||
739+
beentry->st_clientaddr.addr.ss_family==AF_INET6)
743740
{
744741
charremote_host[NI_MAXHOST];
745742
charremote_port[NI_MAXSERV];
@@ -1105,9 +1102,7 @@ pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS)
11051102
switch (beentry->st_clientaddr.addr.ss_family)
11061103
{
11071104
caseAF_INET:
1108-
#ifdefHAVE_IPV6
11091105
caseAF_INET6:
1110-
#endif
11111106
break;
11121107
default:
11131108
PG_RETURN_NULL();
@@ -1152,9 +1147,7 @@ pg_stat_get_backend_client_port(PG_FUNCTION_ARGS)
11521147
switch (beentry->st_clientaddr.addr.ss_family)
11531148
{
11541149
caseAF_INET:
1155-
#ifdefHAVE_IPV6
11561150
caseAF_INET6:
1157-
#endif
11581151
break;
11591152
caseAF_UNIX:
11601153
PG_RETURN_INT32(-1);

‎src/bin/initdb/initdb.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,6 @@ setup_config(void)
11761176

11771177
conflines=replace_token(conflines,"@remove-line-for-nolocal@","");
11781178

1179-
#ifdefHAVE_IPV6
11801179

11811180
/*
11821181
* Probe to see if there is really any platform support for IPv6, and
@@ -1218,15 +1217,6 @@ setup_config(void)
12181217
"#host replication all ::1");
12191218
}
12201219
}
1221-
#else/* !HAVE_IPV6 */
1222-
/* If we didn't compile IPV6 support at all, always comment it out */
1223-
conflines=replace_token(conflines,
1224-
"host all all ::1",
1225-
"#host all all ::1");
1226-
conflines=replace_token(conflines,
1227-
"host replication all ::1",
1228-
"#host replication all ::1");
1229-
#endif/* HAVE_IPV6 */
12301220

12311221
/* Replace default authentication methods */
12321222
conflines=replace_token(conflines,

‎src/include/pg_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@
241241
/* Define to 1 if you have the global variable 'int timezone'. */
242242
#undef HAVE_INT_TIMEZONE
243243

244-
/* Define to 1 if you have support for IPv6. */
245-
#undef HAVE_IPV6
246-
247244
/* Define to 1 if __builtin_constant_p(x) implies "i"(x) acceptance. */
248245
#undef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P
249246

‎src/include/utils/inet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ typedef struct
3131
* We use these values for the "family" field.
3232
*
3333
* Referencing all of the non-AF_INET types to AF_INET lets us work on
34-
* machines whichmay not have the appropriate address family (like
35-
* inet6 addresses when AF_INET6isn't present) butdoesn't cause a
34+
* machines whichdid not have the appropriate address family (like
35+
* inet6 addresses when AF_INET6wasn't present) butdidn't cause a
3636
* dump/reload requirement. Pre-7.4 databases used AF_INET for the family
3737
* type on disk.
3838
*/

‎src/interfaces/libpq/fe-connect.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,6 @@ getHostaddr(PGconn *conn, char *host_addr, int host_addr_len)
16521652
host_addr,host_addr_len)==NULL)
16531653
host_addr[0]='\0';
16541654
}
1655-
#ifdefHAVE_IPV6
16561655
elseif (addr->ss_family==AF_INET6)
16571656
{
16581657
if (pg_inet_net_ntop(AF_INET6,
@@ -1661,7 +1660,6 @@ getHostaddr(PGconn *conn, char *host_addr, int host_addr_len)
16611660
host_addr,host_addr_len)==NULL)
16621661
host_addr[0]='\0';
16631662
}
1664-
#endif
16651663
else
16661664
host_addr[0]='\0';
16671665
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp