summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump/print-tcp.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2016-10-22 20:55:05 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2016-10-22 20:55:05 +0000
commit8a1873a49e25051c3c25a6f25c196fc08b14ce52 (patch)
tree41f78d56d5e79fc90fa023856da678ddf9af26d9 /usr.sbin/tcpdump/print-tcp.c
parent5cdb0da77cc99b4123b68724cc60667c2b3de4cb (diff)
Teach tcpdump(8) how to read OpenFlow packets. This initial implementation
supports the following message types: hello, error, echo request/reply, feature request/reply, set config, packet-in, packet-out, flow removed and flow mod. We currently only support printing this messages for OpenFlow 1.3.5, however it is possible to reuse some functions and get other versions working too. ok deraadt@
Diffstat (limited to 'usr.sbin/tcpdump/print-tcp.c')
-rw-r--r--usr.sbin/tcpdump/print-tcp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/tcpdump/print-tcp.c b/usr.sbin/tcpdump/print-tcp.c
index 8ebc1af3b76..1655ef21406 100644
--- a/usr.sbin/tcpdump/print-tcp.c
+++ b/usr.sbin/tcpdump/print-tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-tcp.c,v 1.35 2015/11/16 00:16:39 mmcc Exp $ */
+/* $OpenBSD: print-tcp.c,v 1.36 2016/10/22 20:55:04 rzalamena Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -123,6 +123,10 @@ static struct tcp_seq_hash tcp_seq_hash[TSEQ_HASHSIZE];
#endif
#define NETBIOS_SSN_PORT 139
+/* OpenFlow TCP ports. */
+#define OLD_OFP_PORT 6633
+#define OFP_PORT 6653
+
static int tcp_cksum(const struct ip *ip, const struct tcphdr *tp, int len)
{
union phu {
@@ -665,6 +669,9 @@ tcp_print(const u_char *bp, u_int length, const u_char *bp2)
} else {
if (sport == BGP_PORT || dport == BGP_PORT)
bgp_print(bp, length);
+ else if (sport == OLD_OFP_PORT || dport == OLD_OFP_PORT ||
+ sport == OFP_PORT || dport == OFP_PORT)
+ ofp_print(bp);
#if 0
else if (sport == NETBIOS_SSN_PORT || dport == NETBIOS_SSN_PORT)
nbt_tcp_print(bp, length);