The branch, 2.5 has been updated via 817199f0535d068a8f3ad558cbccc0f446807ad6 (commit) via 3c5e54d2908752f393f8674e3aea8654fdec1bed (commit) via 08a9afaa7e40e388835b305c9d343bef02dcc940 (commit) from 3d66d7604bfaebb387b5184e9e77d874c633c0b9 (commit)
https://git.samba.org/?p=ctdb.git;a=shortlog;h=2.5 - Log ----------------------------------------------------------------- commit 817199f0535d068a8f3ad558cbccc0f446807ad6 Author: Amitay Isaacs <ami...@gmail.com> Date: Thu Mar 3 14:17:40 2016 +1100 common: For AF_PACKET socket types, protocol is in network order BUG: https://bugzilla.samba.org/show_bug.cgi?id=11770 From man page of packet(7): protocol is the IEEE 802.3 protocol number in network byte order. See the <linux/if_ether.h> include file for a list of allowed protocols. When protocol is set to htons(ETH_P_ALL), then all protocols are received. Protocol argument was changed from network order to host order wrongly in commit 9f8395cb7d49b63a82f75bf504f5f83920102b29. Specifying "protocol" field to socket(AF_PACKET, ...) call only affects the packets that are recevied. So use protocol = 0 when sending raw packets. Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> Autobuild-User(master): Martin Schwenke <mart...@samba.org> Autobuild-Date(master): Fri Mar 4 12:58:50 CET 2016 on sn-devel-144 (Imported from commit f5b6a5b13406c245ab9cc8c1699483af9eb21f88) commit 3c5e54d2908752f393f8674e3aea8654fdec1bed Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Jan 29 00:06:18 2016 +1100 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 <ami...@gmail.com> Reviewed-by: Volker Lendecke <v...@samba.org> (Imported from commit 9f94620a308a3b17c1886c2c4807b34b8d5edacb) commit 08a9afaa7e40e388835b305c9d343bef02dcc940 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Jan 29 00:05:26 2016 +1100 common: Protocol argument must be in host order for socket() call BUG: https://bugzilla.samba.org/show_bug.cgi?id=11705 Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Volker Lendecke <v...@samba.org> (Imported from commit 9f8395cb7d49b63a82f75bf504f5f83920102b29) ----------------------------------------------------------------------- Summary of changes: common/system_aix.c | 4 ++-- common/system_common.c | 2 +- common/system_freebsd.c | 4 ++-- common/system_gnu.c | 4 ++-- common/system_kfreebsd.c | 4 ++-- common/system_linux.c | 10 +++++----- tools/ctdb.c | 4 ++-- utils/smnotify/smnotify.c | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) Changeset truncated at 500 lines: diff --git a/common/system_aix.c b/common/system_aix.c index a98d382..998a67c 100644 --- a/common/system_aix.c +++ b/common/system_aix.c @@ -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))); diff --git a/common/system_common.c b/common/system_common.c index 899f3b5..3e30a6c 100644 --- a/common/system_common.c +++ b/common/system_common.c @@ -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))); diff --git a/common/system_freebsd.c b/common/system_freebsd.c index c5a816b..ce275e2 100644 --- a/common/system_freebsd.c +++ b/common/system_freebsd.c @@ -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))); @@ -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; diff --git a/common/system_gnu.c b/common/system_gnu.c index bf8f43c..457047d 100644 --- a/common/system_gnu.c +++ b/common/system_gnu.c @@ -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))); @@ -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; diff --git a/common/system_kfreebsd.c b/common/system_kfreebsd.c index de7c891..1cc8b35 100644 --- a/common/system_kfreebsd.c +++ b/common/system_kfreebsd.c @@ -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))); @@ -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; diff --git a/common/system_linux.c b/common/system_linux.c index 3bc04ba..3c525da 100644 --- a/common/system_linux.c +++ b/common/system_linux.c @@ -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(AF_PACKET, SOCK_RAW, 0); 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(AF_PACKET, SOCK_RAW, 0); 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))); @@ -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")); diff --git a/tools/ctdb.c b/tools/ctdb.c index a836455..3d36633 100644 --- a/tools/ctdb.c +++ b/tools/ctdb.c @@ -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); diff --git a/utils/smnotify/smnotify.c b/utils/smnotify/smnotify.c index d7fd546..d5c5a4c 100644 --- a/utils/smnotify/smnotify.c +++ b/utils/smnotify/smnotify.c @@ -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); -- CTDB repository