1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ctdb-common: Use documented names for protocol family in socket()

Instead of using PF_*, use AF_*.

https://bugzilla.samba.org/show_bug.cgi?id=11705

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Amitay Isaacs 2016-01-29 00:06:18 +11:00 committed by Volker Lendecke
parent 9f8395cb7d
commit 9f94620a30
6 changed files with 12 additions and 12 deletions

View File

@ -214,7 +214,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
ip6pkt.tcp.th_win = htons(1234); ip6pkt.tcp.th_win = htons(1234);
ip6pkt.tcp.th_sum = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6); ip6pkt.tcp.th_sum = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6);
s = socket(PF_INET6, SOCK_RAW, IPPROTO_RAW); s = socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
if (s == -1) { if (s == -1) {
DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n")); DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
return -1; return -1;

View File

@ -209,7 +209,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
ip6pkt.tcp.window = htons(1234); ip6pkt.tcp.window = htons(1234);
ip6pkt.tcp.check = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6); ip6pkt.tcp.check = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6);
s = socket(PF_INET6, SOCK_RAW, IPPROTO_RAW); s = socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
if (s == -1) { if (s == -1) {
DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n")); DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
return -1; return -1;

View File

@ -209,7 +209,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
ip6pkt.tcp.window = htons(1234); ip6pkt.tcp.window = htons(1234);
ip6pkt.tcp.check = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6); ip6pkt.tcp.check = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6);
s = socket(PF_INET6, SOCK_RAW, IPPROTO_RAW); s = socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
if (s == -1) { if (s == -1) {
DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n")); DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
return -1; return -1;

View File

@ -100,7 +100,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
switch (addr->ip.sin_family) { switch (addr->ip.sin_family) {
case AF_INET: case AF_INET:
s = socket(PF_PACKET, SOCK_RAW, ETHERTYPE_ARP); s = socket(AF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
if (s == -1){ if (s == -1){
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n")); DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
return -1; return -1;
@ -194,7 +194,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
close(s); close(s);
break; break;
case AF_INET6: case AF_INET6:
s = socket(PF_PACKET, SOCK_RAW, ETHERTYPE_ARP); s = socket(AF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
if (s == -1){ if (s == -1){
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n")); DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
return -1; return -1;
@ -419,7 +419,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
ip6pkt.tcp.window = htons(1234); ip6pkt.tcp.window = htons(1234);
ip6pkt.tcp.check = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6); ip6pkt.tcp.check = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6);
s = socket(PF_INET6, SOCK_RAW, IPPROTO_RAW); s = socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
if (s == -1) { if (s == -1) {
DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n")); DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
return -1; return -1;
@ -581,7 +581,7 @@ bool ctdb_sys_check_iface_exists(const char *iface)
int s; int s;
struct ifreq ifr; struct ifreq ifr;
s = socket(PF_PACKET, SOCK_RAW, 0); s = socket(AF_PACKET, SOCK_RAW, 0);
if (s == -1){ if (s == -1){
/* We don't know if the interface exists, so assume yes */ /* We don't know if the interface exists, so assume yes */
DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n")); DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));

View File

@ -4365,7 +4365,7 @@ static int control_chktcpport(struct ctdb_context *ctdb, int argc, const char **
port = atoi(argv[0]); port = atoi(argv[0]);
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == -1) { if (s == -1) {
printf("Failed to open local socket\n"); printf("Failed to open local socket\n");
return errno; return errno;
@ -4377,7 +4377,7 @@ static int control_chktcpport(struct ctdb_context *ctdb, int argc, const char **
} }
bzero(&sin, sizeof(sin)); bzero(&sin, sizeof(sin));
sin.sin_family = PF_INET; sin.sin_family = AF_INET;
sin.sin_port = htons(port); sin.sin_port = htons(port);
ret = bind(s, (struct sockaddr *)&sin, sizeof(sin)); ret = bind(s, (struct sockaddr *)&sin, sizeof(sin));
close(s); close(s);

View File

@ -43,14 +43,14 @@ static int create_socket(const char *addr, int port)
int s; int s;
struct sockaddr_in sock_in; struct sockaddr_in sock_in;
s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1) { if (s == -1) {
printf("Failed to open local socket\n"); printf("Failed to open local socket\n");
exit(10); exit(10);
} }
bzero(&sock_in, sizeof(sock_in)); bzero(&sock_in, sizeof(sock_in));
sock_in.sin_family = PF_INET; sock_in.sin_family = AF_INET;
sock_in.sin_port = htons(port); sock_in.sin_port = htons(port);
inet_aton(addr, &sock_in.sin_addr); inet_aton(addr, &sock_in.sin_addr);
if (bind(s, (struct sockaddr *)&sock_in, sizeof(sock_in)) == -1) { if (bind(s, (struct sockaddr *)&sock_in, sizeof(sock_in)) == -1) {
@ -124,7 +124,7 @@ int main(int argc, const char *argv[])
/* Setup a sockaddr_in for the client we want to notify */ /* Setup a sockaddr_in for the client we want to notify */
bzero(&sock_cl, sizeof(sock_cl)); bzero(&sock_cl, sizeof(sock_cl));
sock_cl.sin_family = PF_INET; sock_cl.sin_family = AF_INET;
sock_cl.sin_port = htons(clientport); sock_cl.sin_port = htons(clientport);
inet_aton(client, &sock_cl.sin_addr); inet_aton(client, &sock_cl.sin_addr);