common: Use documented names for protocol family in socket()
authorAmitay Isaacs <amitay@gmail.com>
Thu, 28 Jan 2016 13:06:18 +0000 (00:06 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 7 Mar 2016 08:32:18 +0000 (19:32 +1100)
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>
(Imported from commit 9f94620a308a3b17c1886c2c4807b34b8d5edacb)

common/system_freebsd.c
common/system_gnu.c
common/system_kfreebsd.c
common/system_linux.c
tools/ctdb.c
utils/smnotify/smnotify.c

index 59fc0ac712edada262f68659d45d2df09e3905cf..ce275e27b071918b4ed06f326c90c32367f5e150 100644 (file)
@@ -208,7 +208,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip6pkt.tcp.th_win   = htons(1234);
                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) {
                        DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
                        return -1;
index 6878e82cd33f12f0257e64463003b93edb401c1a..457047df8e53f530e04309ec70e4873814c8d2d9 100644 (file)
@@ -203,7 +203,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip6pkt.tcp.window   = htons(1234);
                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) {
                        DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
                        return -1;
index 74f5c585a7190ca0d2adbea9920f446b34c06177..1cc8b35327f4b423ec5a0287b07c35be717a79dc 100644 (file)
@@ -203,7 +203,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip6pkt.tcp.window   = htons(1234);
                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) {
                        DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
                        return -1;
index 32af16f14f9b55c7f44e4dcda4f4b643c21d47fa..08eab5f853334493f6a1e19fbcd38b887710af8c 100644 (file)
@@ -93,7 +93,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
 
        switch (addr->ip.sin_family) {
        case AF_INET:
-               s = socket(PF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
+               s = socket(AF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
                if (s == -1){
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
                        return -1;
@@ -187,7 +187,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
                close(s);
                break;
        case AF_INET6:
-               s = socket(PF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
+               s = socket(AF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
                if (s == -1){
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
                        return -1;
@@ -412,7 +412,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip6pkt.tcp.window   = htons(1234);
                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) {
                        DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
                        return -1;
@@ -574,7 +574,7 @@ bool ctdb_sys_check_iface_exists(const char *iface)
        int s;
        struct ifreq ifr;
 
-       s = socket(PF_PACKET, SOCK_RAW, 0);
+       s = socket(AF_PACKET, SOCK_RAW, 0);
        if (s == -1){
                /* We dont know if the interface exists, so assume yes */
                DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
index a83645589b404f510dda1bd7017f8eb0fa108e56..3d36633ecd08d7a28ce659400f28599362e8b1d5 100644 (file)
@@ -4538,7 +4538,7 @@ static int control_chktcpport(struct ctdb_context *ctdb, int argc, const char **
 
        port = atoi(argv[0]);
 
-       s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+       s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (s == -1) {
                printf("Failed to open local socket\n");
                return errno;
@@ -4550,7 +4550,7 @@ static int control_chktcpport(struct ctdb_context *ctdb, int argc, const char **
        }
 
        bzero(&sin, sizeof(sin));
-       sin.sin_family = PF_INET;
+       sin.sin_family = AF_INET;
        sin.sin_port   = htons(port);
        ret = bind(s, (struct sockaddr *)&sin, sizeof(sin));
        close(s);
index d7fd54626e24c63214a4945c8e6894fabd717126..d5c5a4c6270391d524511f7eee8ab5f578a86ed8 100644 (file)
@@ -43,14 +43,14 @@ static int create_socket(const char *addr, int port)
        int s;
         struct sockaddr_in sock_in;
 
-       s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+       s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        if (s == -1) {
                printf("Failed to open local socket\n");
                exit(10);
        }
 
        bzero(&sock_in, sizeof(sock_in));
-       sock_in.sin_family = PF_INET;
+       sock_in.sin_family = AF_INET;
        sock_in.sin_port   = htons(port);
        inet_aton(addr, &sock_in.sin_addr);
        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 */
        bzero(&sock_cl, sizeof(sock_cl));
-       sock_cl.sin_family = PF_INET;
+       sock_cl.sin_family = AF_INET;
        sock_cl.sin_port   = htons(clientport);
        inet_aton(client, &sock_cl.sin_addr);