Replace PF_* constants with AF_*
AF_* constants appear to be more standardized, and in practice there's always a one to one relationship between AF_* and PF_*, so let's use AF_* instead of PF_*. * xlat/domains.in: Remove. * net.c: Do not define PF_UNSPEC. Stop including "xlat/domains.h". Replace PF_* with AF_*. Replace domains with addrfams. * tests/inet-cmsg.c: Replace PF_INET with AF_INET. * tests/net-yy-inet.c: Likewise. * tests/netlink_inet_diag.c: Likewise. * tests/net-accept-connect.c: Replace PF_LOCAL with AF_LOCAL. * tests/net-y-unix.c: Likewise. * tests/net-yy-unix.c: Likewise. * tests/netlink_unix_diag.c: Likewise. * tests/net.expected: Replace PF_ with AF_.
This commit is contained in:
parent
2aa9b32d81
commit
71fe62e6b7
32
net.c
32
net.c
@ -83,11 +83,7 @@
|
||||
# include <bluetooth/rfcomm.h>
|
||||
# include <bluetooth/sco.h>
|
||||
#endif
|
||||
#ifndef PF_UNSPEC
|
||||
# define PF_UNSPEC AF_UNSPEC
|
||||
#endif
|
||||
|
||||
#include "xlat/domains.h"
|
||||
#include "xlat/addrfams.h"
|
||||
#include "xlat/socktypes.h"
|
||||
#include "xlat/sock_type_flags.h"
|
||||
@ -99,7 +95,7 @@
|
||||
|
||||
#include "xlat/inet_protocols.h"
|
||||
|
||||
#ifdef PF_NETLINK
|
||||
#ifdef AF_NETLINK
|
||||
# if !defined NETLINK_SOCK_DIAG && defined NETLINK_INET_DIAG
|
||||
# define NETLINK_SOCK_DIAG NETLINK_INET_DIAG
|
||||
# endif
|
||||
@ -790,32 +786,32 @@ tprint_sock_type(int flags)
|
||||
|
||||
SYS_FUNC(socket)
|
||||
{
|
||||
printxval(domains, tcp->u_arg[0], "PF_???");
|
||||
printxval(addrfams, tcp->u_arg[0], "AF_???");
|
||||
tprints(", ");
|
||||
tprint_sock_type(tcp->u_arg[1]);
|
||||
tprints(", ");
|
||||
switch (tcp->u_arg[0]) {
|
||||
case PF_INET:
|
||||
#ifdef PF_INET6
|
||||
case PF_INET6:
|
||||
case AF_INET:
|
||||
#ifdef AF_INET6
|
||||
case AF_INET6:
|
||||
#endif
|
||||
printxval(inet_protocols, tcp->u_arg[2], "IPPROTO_???");
|
||||
break;
|
||||
#ifdef PF_IPX
|
||||
case PF_IPX:
|
||||
#ifdef AF_IPX
|
||||
case AF_IPX:
|
||||
/* BTW: I don't believe this.. */
|
||||
tprints("[");
|
||||
printxval(domains, tcp->u_arg[2], "PF_???");
|
||||
printxval(addrfams, tcp->u_arg[2], "AF_???");
|
||||
tprints("]");
|
||||
break;
|
||||
#endif /* PF_IPX */
|
||||
#ifdef PF_NETLINK
|
||||
case PF_NETLINK:
|
||||
#endif /* AF_IPX */
|
||||
#ifdef AF_NETLINK
|
||||
case AF_NETLINK:
|
||||
printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
|
||||
break;
|
||||
#endif
|
||||
#if defined(PF_BLUETOOTH) && defined(HAVE_BLUETOOTH_BLUETOOTH_H)
|
||||
case PF_BLUETOOTH:
|
||||
#if defined(AF_BLUETOOTH) && defined(HAVE_BLUETOOTH_BLUETOOTH_H)
|
||||
case AF_BLUETOOTH:
|
||||
printxval(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
|
||||
break;
|
||||
#endif
|
||||
@ -1126,7 +1122,7 @@ SYS_FUNC(pipe2)
|
||||
SYS_FUNC(socketpair)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printxval(domains, tcp->u_arg[0], "PF_???");
|
||||
printxval(addrfams, tcp->u_arg[0], "AF_???");
|
||||
tprints(", ");
|
||||
tprint_sock_type(tcp->u_arg[1]);
|
||||
tprintf(", %lu", tcp->u_arg[2]);
|
||||
|
@ -95,7 +95,7 @@ main(void)
|
||||
assert(!close(0));
|
||||
assert(!close(3));
|
||||
|
||||
if (socket(PF_INET, SOCK_DGRAM, 0))
|
||||
if (socket(AF_INET, SOCK_DGRAM, 0))
|
||||
perror_msg_and_skip("socket");
|
||||
struct sockaddr_in addr = {
|
||||
.sin_family = AF_INET,
|
||||
@ -106,7 +106,7 @@ main(void)
|
||||
perror_msg_and_skip("bind");
|
||||
assert(!getsockname(0, (struct sockaddr *) &addr, &len));
|
||||
|
||||
assert(socket(PF_INET, SOCK_DGRAM, 0) == 3);
|
||||
assert(socket(AF_INET, SOCK_DGRAM, 0) == 3);
|
||||
assert(!connect(3, (struct sockaddr *) &addr, len));
|
||||
|
||||
const int opt_1 = htonl(0x01000000);
|
||||
|
@ -62,7 +62,7 @@ main(int ac, const char **av)
|
||||
close(0);
|
||||
close(1);
|
||||
|
||||
if (socket(PF_LOCAL, SOCK_STREAM, 0))
|
||||
if (socket(AF_LOCAL, SOCK_STREAM, 0))
|
||||
perror_msg_and_skip("socket");
|
||||
if (bind(0, (struct sockaddr *) &addr, len))
|
||||
perror_msg_and_skip("bind");
|
||||
@ -93,7 +93,7 @@ main(int ac, const char **av)
|
||||
|
||||
assert(sigprocmask(SIG_BLOCK, &set, NULL) == 0);
|
||||
assert(signal(SIGUSR1, handler) != SIG_ERR);
|
||||
assert(socket(PF_LOCAL, SOCK_STREAM, 0) == 1);
|
||||
assert(socket(AF_LOCAL, SOCK_STREAM, 0) == 1);
|
||||
assert(close(0) == 0);
|
||||
assert(connect(1, (struct sockaddr *) &addr, len) == 0);
|
||||
assert(sigprocmask(SIG_UNBLOCK, &set, NULL) == 0);
|
||||
|
@ -54,11 +54,11 @@ main(int ac, const char **av)
|
||||
if (*len > sizeof(addr))
|
||||
*len = sizeof(addr);
|
||||
|
||||
int listen_fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
int listen_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (listen_fd < 0)
|
||||
perror_msg_and_skip("socket");
|
||||
unsigned long listen_inode = inode_of_sockfd(listen_fd);
|
||||
printf("socket(PF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
|
||||
printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
|
||||
listen_fd, listen_inode);
|
||||
|
||||
(void) unlink(av[1]);
|
||||
@ -87,11 +87,11 @@ main(int ac, const char **av)
|
||||
", sun_path=\"%s\"}, [%u]) = 0\n", listen_fd, listen_inode,
|
||||
av[1], (unsigned) *len);
|
||||
|
||||
int connect_fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
int connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (connect_fd < 0)
|
||||
perror_msg_and_fail("socket");
|
||||
unsigned long connect_inode = inode_of_sockfd(connect_fd);
|
||||
printf("socket(PF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
|
||||
printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
|
||||
connect_fd, connect_inode);
|
||||
|
||||
if (connect(connect_fd, listen_sa, *len))
|
||||
@ -141,11 +141,11 @@ main(int ac, const char **av)
|
||||
assert(close(accept_fd) == 0);
|
||||
printf("close(%d<socket:[%lu]>) = 0\n", accept_fd, accept_inode);
|
||||
|
||||
connect_fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (connect_fd < 0)
|
||||
perror_msg_and_fail("socket");
|
||||
connect_inode = inode_of_sockfd(connect_fd);
|
||||
printf("socket(PF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
|
||||
printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
|
||||
connect_fd, connect_inode);
|
||||
|
||||
*optval = 1;
|
||||
|
@ -49,11 +49,11 @@ main(void)
|
||||
socklen_t * const len = tail_alloc(sizeof(socklen_t));
|
||||
*len = sizeof(addr);
|
||||
|
||||
const int listen_fd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
const int listen_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (listen_fd < 0)
|
||||
perror_msg_and_skip("socket");
|
||||
const unsigned long listen_inode = inode_of_sockfd(listen_fd);
|
||||
printf("socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = %d<TCP:[%lu]>\n",
|
||||
printf("socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = %d<TCP:[%lu]>\n",
|
||||
listen_fd, listen_inode);
|
||||
|
||||
if (bind(listen_fd, listen_sa, *len))
|
||||
@ -85,11 +85,11 @@ main(void)
|
||||
", [%u], [%u]) = 0\n",
|
||||
listen_fd, listen_port, *optval, (unsigned) *len);
|
||||
|
||||
const int connect_fd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
const int connect_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (connect_fd < 0)
|
||||
perror_msg_and_fail("socket");
|
||||
const unsigned long connect_inode = inode_of_sockfd(connect_fd);
|
||||
printf("socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = %d<TCP:[%lu]>\n",
|
||||
printf("socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = %d<TCP:[%lu]>\n",
|
||||
connect_fd, connect_inode);
|
||||
|
||||
*len = sizeof(addr);
|
||||
|
@ -54,11 +54,11 @@ main(int ac, const char **av)
|
||||
if (*len > sizeof(addr))
|
||||
*len = sizeof(addr);
|
||||
|
||||
int listen_fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
int listen_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (listen_fd < 0)
|
||||
perror_msg_and_skip("socket");
|
||||
unsigned long listen_inode = inode_of_sockfd(listen_fd);
|
||||
printf("socket(PF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
|
||||
printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
|
||||
listen_fd, listen_inode);
|
||||
|
||||
(void) unlink(av[1]);
|
||||
@ -88,11 +88,11 @@ main(int ac, const char **av)
|
||||
", sun_path=\"%s\"}, [%u]) = 0\n", listen_fd, listen_inode,
|
||||
av[1], av[1], (unsigned) *len);
|
||||
|
||||
int connect_fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
int connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (connect_fd < 0)
|
||||
perror_msg_and_fail("socket");
|
||||
unsigned long connect_inode = inode_of_sockfd(connect_fd);
|
||||
printf("socket(PF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
|
||||
printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
|
||||
connect_fd, connect_inode);
|
||||
|
||||
if (connect(connect_fd, listen_sa, *len))
|
||||
@ -144,11 +144,11 @@ main(int ac, const char **av)
|
||||
printf("close(%d<UNIX:[%lu->%lu,\"%s\"]>) = 0\n",
|
||||
accept_fd, accept_inode, connect_inode, av[1]);
|
||||
|
||||
connect_fd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (connect_fd < 0)
|
||||
perror_msg_and_fail("socket");
|
||||
connect_inode = inode_of_sockfd(connect_fd);
|
||||
printf("socket(PF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
|
||||
printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
|
||||
connect_fd, connect_inode);
|
||||
|
||||
*optval = 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 0
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +socket\(AF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 0
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +socket\(AF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +bind\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, 19\) += 0
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +listen\(0, 5\) += 0
|
||||
[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +getsockname\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="net-local-stream"\}, \[19\]\) += 0
|
||||
|
@ -126,8 +126,8 @@ int main(void)
|
||||
close(0);
|
||||
close(1);
|
||||
|
||||
if (socket(PF_INET, SOCK_STREAM, 0))
|
||||
perror_msg_and_skip("socket PF_INET");
|
||||
if (socket(AF_INET, SOCK_STREAM, 0))
|
||||
perror_msg_and_skip("socket AF_INET");
|
||||
if (bind(0, (struct sockaddr *) &addr, len))
|
||||
perror_msg_and_skip("bind");
|
||||
if (listen(0, 5))
|
||||
|
@ -134,8 +134,8 @@ int main(void)
|
||||
close(1);
|
||||
|
||||
(void) unlink(SUN_PATH);
|
||||
if (socket(PF_LOCAL, SOCK_STREAM, 0))
|
||||
perror_msg_and_skip("socket PF_LOCAL");
|
||||
if (socket(AF_LOCAL, SOCK_STREAM, 0))
|
||||
perror_msg_and_skip("socket AF_LOCAL");
|
||||
if (bind(0, (struct sockaddr *) &addr, len))
|
||||
perror_msg_and_skip("bind");
|
||||
if (listen(0, 5))
|
||||
|
@ -1,43 +0,0 @@
|
||||
PF_UNSPEC
|
||||
PF_LOCAL
|
||||
PF_UNIX
|
||||
PF_INET
|
||||
PF_AX25
|
||||
PF_IPX
|
||||
PF_APPLETALK
|
||||
PF_NETROM
|
||||
PF_BRIDGE
|
||||
PF_ATMPVC
|
||||
PF_X25
|
||||
PF_INET6
|
||||
PF_ROSE
|
||||
PF_DECnet
|
||||
PF_NETBEUI
|
||||
PF_SECURITY
|
||||
PF_KEY
|
||||
PF_NETLINK
|
||||
PF_ROUTE
|
||||
PF_PACKET
|
||||
PF_ASH
|
||||
PF_ECONET
|
||||
PF_ATMSVC
|
||||
PF_RDS
|
||||
PF_SNA
|
||||
PF_IRDA
|
||||
PF_PPPOX
|
||||
PF_WANPIPE
|
||||
PF_LLC
|
||||
PF_IB
|
||||
PF_MPLS
|
||||
PF_CAN
|
||||
PF_TIPC
|
||||
PF_BLUETOOTH
|
||||
PF_IUCV
|
||||
PF_RXRPC
|
||||
PF_ISDN
|
||||
PF_PHONET
|
||||
PF_IEEE802154
|
||||
PF_CAIF
|
||||
PF_ALG
|
||||
PF_NFC
|
||||
PF_VSOCK
|
Loading…
x
Reference in New Issue
Block a user