common: Protocol argument must be in host order for socket() call
authorAmitay Isaacs <amitay@gmail.com>
Thu, 28 Jan 2016 13:05:26 +0000 (00:05 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 7 Mar 2016 08:30:59 +0000 (19:30 +1100)
BUG: 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 9f8395cb7d49b63a82f75bf504f5f83920102b29)

common/system_aix.c
common/system_common.c
common/system_freebsd.c
common/system_gnu.c
common/system_kfreebsd.c
common/system_linux.c

index a98d38205679662ce0bf2f01c58e58be092fbdb3..998a67c0f1cc0f5abe27229c3b62671c46ac35d8 100644 (file)
@@ -44,7 +44,7 @@ int ctdb_sys_open_sending_socket(void)
        int s, ret;
        uint32_t one = 1;
 
-       s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+       s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
        if (s == -1) {
                DEBUG(DEBUG_CRIT,(" failed to open raw socket (%s)\n",
                         strerror(errno)));
@@ -121,7 +121,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
 
 
 
-       s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+       s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
        if (s == -1) {
                DEBUG(DEBUG_CRIT,(" failed to open raw socket (%s)\n",
                         strerror(errno)));
index 899f3b56bebc6927089da675997c30362a4d1dc2..3e30a6cd6eb32ebe38c11f51f324ccd807703183 100644 (file)
@@ -85,7 +85,7 @@ char *ctdb_sys_find_ifname(ctdb_sock_addr *addr)
        struct ifconf ifc;
        char *ptr;
 
-       s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+       s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
        if (s == -1) {
                DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
                         strerror(errno)));
index c5a816bf7af4533de01ce6224c909e8fcedb6bdb..59fc0ac712edada262f68659d45d2df09e3905cf 100644 (file)
@@ -158,7 +158,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip4pkt.tcp.th_sum   = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip);
 
                /* open a raw socket to send this segment from */
-               s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+               s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
                if (s == -1) {
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
                                 strerror(errno)));
index bf8f43c4868d153592681471d8f730489b0f575f..6878e82cd33f12f0257e64463003b93edb401c1a 100644 (file)
@@ -156,7 +156,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip4pkt.tcp.check    = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip);
 
                /* open a raw socket to send this segment from */
-               s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+               s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
                if (s == -1) {
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
                                 strerror(errno)));
index de7c8911c89e0893e398786abe31d60785645858..74f5c585a7190ca0d2adbea9920f446b34c06177 100644 (file)
@@ -156,7 +156,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip4pkt.tcp.check    = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip);
 
                /* open a raw socket to send this segment from */
-               s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+               s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
                if (s == -1) {
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
                                 strerror(errno)));
index 3bc04ba86426c56ae98c31b8340dcac67023c179..32af16f14f9b55c7f44e4dcda4f4b643c21d47fa 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, htons(ETHERTYPE_ARP));
+               s = socket(PF_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, htons(ETHERTYPE_ARP));
+               s = socket(PF_PACKET, SOCK_RAW, ETHERTYPE_ARP);
                if (s == -1){
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
                        return -1;
@@ -363,7 +363,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                ip4pkt.tcp.check    = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip);
 
                /* open a raw socket to send this segment from */
-               s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+               s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
                if (s == -1) {
                        DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
                                 strerror(errno)));
@@ -453,7 +453,7 @@ int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
        int s;
 
        /* Open a socket to capture all traffic */
-       s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+       s = socket(AF_PACKET, SOCK_RAW, ETH_P_ALL);
        if (s == -1) {
                DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
                return -1;