summaryrefslogtreecommitdiff
path: root/ctdb/common
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-08-17 21:33:39 +1000
committerAmitay Isaacs <amitay@samba.org>2018-08-30 07:50:04 +0200
commit58b8f2a31e30a9fe9180f3758acaebf7deffbd91 (patch)
tree3af96677dfd607bd913fe56888f32a3509f4e35e /ctdb/common
parent53ceac9694f2f530e875ec56ec15867205ae088e (diff)
downloadsamba-58b8f2a31e30a9fe9180f3758acaebf7deffbd91.tar.gz
ctdb-common: Clean up comments in TCP packet parsing
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Thu Aug 30 07:50:04 CEST 2018 on sn-devel-144
Diffstat (limited to 'ctdb/common')
-rw-r--r--ctdb/common/system_socket.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c
index 9336eb50713..668c0454619 100644
--- a/ctdb/common/system_socket.c
+++ b/ctdb/common/system_socket.c
@@ -752,18 +752,17 @@ static int tcp4_extract(const uint8_t *ip_pkt,
return EMSGSIZE;
}
- /* IP */
ip = (const struct ip *)ip_pkt;
- /* We only want IPv4 packets */
+ /* IPv4 only */
if (ip->ip_v != 4) {
return ENOMSG;
}
- /* Dont look at fragments */
+ /* Don't look at fragments */
if ((ntohs(ip->ip_off)&0x1fff) != 0) {
return ENOMSG;
}
- /* we only want TCP */
+ /* TCP only */
if (ip->ip_p != IPPROTO_TCP) {
return ENOMSG;
}
@@ -774,10 +773,8 @@ static int tcp4_extract(const uint8_t *ip_pkt,
return EMSGSIZE;
}
- /* TCP */
tcp = (const struct tcphdr *)(ip_pkt + (ip->ip_hl * sizeof(uint32_t)));
- /* tell the caller which one we've found */
src->sin_family = AF_INET;
src->sin_addr.s_addr = ip->ip_src.s_addr;
src->sin_port = tcp->th_sport;
@@ -815,7 +812,6 @@ static int tcp6_extract(const uint8_t *ip_pkt,
return EMSGSIZE;
}
- /* IP6 */
ip6 = (const struct ip6_hdr *)ip_pkt;
/* IPv6 only */
@@ -823,15 +819,13 @@ static int tcp6_extract(const uint8_t *ip_pkt,
return ENOMSG;
}
- /* we only want TCP */
+ /* TCP only */
if (ip6->ip6_nxt != IPPROTO_TCP) {
return ENOMSG;
}
- /* TCP */
tcp = (const struct tcphdr *)(ip_pkt + sizeof(struct ip6_hdr));
- /* tell the caller which one we've found */
src->sin6_family = AF_INET6;
src->sin6_port = tcp->th_sport;
src->sin6_addr = ip6->ip6_src;