summaryrefslogtreecommitdiff
path: root/ctdb/common
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2008-09-08 08:57:42 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2008-09-08 08:57:42 +1000
commit7a78a78a1c0de5ef3f470326eee2c1ca7e57e607 (patch)
treee4455b73fa35b57313d0ce47d03830ba2e7baef8 /ctdb/common
parent70c7525a02079c429bdc9fa5278fd9bc8ffee879 (diff)
downloadsamba-7a78a78a1c0de5ef3f470326eee2c1ca7e57e607.tar.gz
From C Cowan.
Patch to make AIX compile with the new ipv6 additions. (This used to be ctdb commit e26ce5140ed005725f8b7ac8ba23a180fd7d5337)
Diffstat (limited to 'ctdb/common')
-rw-r--r--ctdb/common/system_aix.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/ctdb/common/system_aix.c b/ctdb/common/system_aix.c
index 03d997ff6fc..8fe630d8a39 100644
--- a/ctdb/common/system_aix.c
+++ b/ctdb/common/system_aix.c
@@ -199,7 +199,7 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *addr)
int s;
int ret;
- addr->sa.sa_port = 0;
+ addr->ip.sin_port = 0;
s = socket(addr->sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
if (s == -1) {
return false;
@@ -312,6 +312,7 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data,
int ret;
struct ether_header *eth;
struct ip *ip;
+ struct ip6_hdr *ip6;
struct tcphdr *tcp;
struct ctdb_killtcp_connection *conn;
struct pcap_pkthdr pkthdr;
@@ -353,22 +354,44 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data,
tcp = (struct tcphdr *)((ip->ip_hl*4) + (char *)ip);
/* tell the caller which one we've found */
- src->ip.sin_family = AF_INET;
- src->sin_addr.s_addr = ip->ip_src.s_addr;
- src->sin_port = tcp->th_sport;
- dst->ip.sin_family = AF_INET;
- dst->sin_addr.s_addr = ip->ip_dst.s_addr;
- dst->sin_port = tcp->th_dport;
- *ack_seq = tcp->th_ack;
- *seq = tcp->th_seq;
+ src->ip.sin_family = AF_INET;
+ src->ip.sin_addr.s_addr = ip->ip_src.s_addr;
+ src->ip.sin_port = tcp->th_sport;
+ dst->ip.sin_family = AF_INET;
+ dst->ip.sin_addr.s_addr = ip->ip_dst.s_addr;
+ dst->ip.sin_port = tcp->th_dport;
+ *ack_seq = tcp->th_ack;
+ *seq = tcp->th_seq;
return 0;
#ifndef ETHERTYPE_IP6
#define ETHERTYPE_IP6 0x86dd
#endif
- } else if (eth->ether_type == htons(ETHERTYPE_IP)) {
-see system_linux.c for what should go in here
+ } else if (eth->ether_type == htons(ETHERTYPE_IP6)) {
+ /* IP6 */
+ ip6 = (struct ip6_hdr *)(eth+1);
+
+ /* we only want TCP */
+ if (ip6->ip6_nxt != IPPROTO_TCP) {
+ return -1;
+ }
+
+ /* TCP */
+ tcp = (struct tcphdr *)(ip6+1);
+
+ /* tell the caller which one we've found */
+ src->ip6.sin6_family = AF_INET6;
+ src->ip6.sin6_port = tcp->th_sport;
+ src->ip6.sin6_addr = ip6->ip6_src;
+
+ dst->ip6.sin6_family = AF_INET6;
+ dst->ip6.sin6_port = tcp->th_dport;
+ dst->ip6.sin6_addr = ip6->ip6_dst;
+
+ *ack_seq = tcp->th_ack;
+ *seq = tcp->th_seq;
+
return 0;
}