ctdb-system: Fix typo in ctdb_get_peer_pid
[ambi/samba-autobuild/.git] / ctdb / common / system_aix.c
index 4c131060bfd56f5a64ab408947c0ca0c038e2607..de69b9ee687ee074f20a123ff794e3b74e474544 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "lib/util/debug.h"
 
-#include "ctdb_private.h"
+#include "protocol/protocol.h"
 
 #include <netinet/if_ether.h>
 #include <netinet/ip6.h>
@@ -50,7 +50,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)));
@@ -127,7 +127,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)));
@@ -269,9 +269,10 @@ static int aix_get_mac_addr(const char *device_name, uint8_t mac[6])
        return -1;
 }
 
-int ctdb_sys_read_tcp_packet(int s, void *private_data, 
-                       ctdb_sock_addr *src, ctdb_sock_addr *dst,
-                       uint32_t *ack_seq, uint32_t *seq)
+int ctdb_sys_read_tcp_packet(int s, void *private_data,
+                            ctdb_sock_addr *src, ctdb_sock_addr *dst,
+                            uint32_t *ack_seq, uint32_t *seq,
+                            int *rst, uint16_t *window)
 {
        int ret;
        struct ether_header *eth;
@@ -326,7 +327,12 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data,
                dst->ip.sin_port        = tcp->th_dport;
                *ack_seq                = tcp->th_ack;
                *seq                    = tcp->th_seq;
-
+               if (window != NULL) {
+                       *window = tcp->th_win;
+               }
+               if (rst != NULL) {
+                       *rst = tcp->th_flags & TH_RST;
+               }
 
                return 0;
 #ifndef ETHERTYPE_IP6
@@ -355,6 +361,12 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data,
 
                *ack_seq             = tcp->th_ack;
                *seq                 = tcp->th_seq;
+               if (window != NULL) {
+                       *window = tcp->th_win;
+               }
+               if (rst != NULL) {
+                       *rst = tcp->th_flags & TH_RST;
+               }
 
                return 0;
        }
@@ -374,14 +386,8 @@ int ctdb_get_peer_pid(const int fd, pid_t *peer_pid)
        struct peercred_struct cr;
        socklen_t crl = sizeof(struct peercred_struct);
        int ret;
-       if ((ret = getsockopt(fd, SOL_SOCKET, SO_PEERID, &cr, &crl) == 0)) {
+       if ((ret = getsockopt(fd, SOL_SOCKET, SO_PEERID, &cr, &crl)) == 0) {
                *peer_pid = cr.pid;
        }
        return ret;
 }
-
-int ctdb_set_process_name(const char *name)
-{
-       /* FIXME AIX: set_process_name not implemented */
-       return -ENOSYS;
-}