]> git.proxmox.com Git - ovs.git/blob - third-party/ofp-tcpdump.patch
ofproto: Improve abstraction by adding function ofproto_parse_name().
[ovs.git] / third-party / ofp-tcpdump.patch
1 --- tcpdump/interface.h 2007-06-13 18:03:20.000000000 -0700
2 +++ tcpdump/interface.h 2008-04-15 18:28:55.000000000 -0700
3 @@ -148,7 +148,8 @@
4
5 extern const char *dnaddr_string(u_short);
6
7 -extern void error(const char *, ...)
8 +#define error(fmt, args...) tcpdump_error(fmt, ## args)
9 +extern void tcpdump_error(const char *, ...)
10 __attribute__((noreturn, format (printf, 1, 2)));
11 extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2)));
12
13 @@ -176,6 +177,7 @@
14 extern void hex_print_with_offset(const char *, const u_char *, u_int, u_int);
15 extern void hex_print(const char *, const u_char *, u_int);
16 extern void telnet_print(const u_char *, u_int);
17 +extern void openflow_print(const u_char *, u_int);
18 extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
19 extern int llc_print(const u_char *, u_int, u_int, const u_char *,
20 const u_char *, u_short *);
21 --- tcpdump/Makefile.in 2007-09-25 18:59:52.000000000 -0700
22 +++ tcpdump/Makefile.in 2009-05-11 15:59:28.000000000 -0700
23 @@ -49,10 +49,10 @@
24 CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
25
26 # Standard LDFLAGS
27 -LDFLAGS = @LDFLAGS@
28 +LDFLAGS = @LDFLAGS@ -L../../lib
29
30 # Standard LIBS
31 -LIBS = @LIBS@
32 +LIBS = @LIBS@ -lopenvswitch
33
34 INSTALL = @INSTALL@
35 INSTALL_PROGRAM = @INSTALL_PROGRAM@
36 @@ -87,7 +87,8 @@
37 print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
38 print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
39 print-timed.c print-token.c print-udp.c print-vjc.c print-vrrp.c \
40 - print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
41 + print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c \
42 + print-openflow.c
43
44 LOCALSRC = @LOCALSRC@
45 GENSRC = version.c
46 --- tcpdump/print-openflow.c 1969-12-31 16:00:00.000000000 -0800
47 +++ tcpdump/print-openflow.c 2009-05-11 15:38:41.000000000 -0700
48 @@ -0,0 +1,46 @@
49 +/* Copyright (C) 2007, 2008, 2009 Nicira Networks.
50 +
51 + Redistribution and use in source and binary forms, with or without
52 + modification, are permitted provided that the following conditions
53 + are met:
54 +
55 + 1. Redistributions of source code must retain the above copyright
56 + notice, this list of conditions and the following disclaimer.
57 + 2. Redistributions in binary form must reproduce the above copyright
58 + notice, this list of conditions and the following disclaimer in
59 + the documentation and/or other materials provided with the
60 + distribution.
61 + 3. The names of the authors may not be used to endorse or promote
62 + products derived from this software without specific prior
63 + written permission.
64 +
65 + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
66 + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
67 + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
68 + */
69 + *
70 +
71 +#ifdef HAVE_CONFIG_H
72 +#include "config.h"
73 +#endif
74 +
75 +#include <stdlib.h>
76 +
77 +#include "interface.h"
78 +#include "../../include/openflow/openflow.h"
79 +#include "../../lib/ofp-print.h"
80 +
81 +void
82 +openflow_print(const u_char *sp, u_int length)
83 +{
84 + const struct ofp_header *ofp = (struct ofp_header *)sp;
85 +
86 + if (!TTEST2(*sp, ntohs(ofp->length)))
87 + goto trunc;
88 +
89 + ofp_print(stdout, sp, length, vflag);
90 + return;
91 +
92 +trunc:
93 + printf("[|openflow]");
94 +}
95 --- tcpdump/print-tcp.c 2006-09-19 12:07:57.000000000 -0700
96 +++ tcpdump/print-tcp.c 2009-05-11 15:38:25.000000000 -0700
97 @@ -52,6 +52,8 @@
98
99 #include "nameser.h"
100
101 +#include "../../include/openflow/openflow.h"
102 +
103 #ifdef HAVE_LIBCRYPTO
104 #include <openssl/md5.h>
105
106 @@ -680,7 +682,8 @@
107 }
108 else if (length > 0 && (sport == LDP_PORT || dport == LDP_PORT)) {
109 ldp_print(bp, length);
110 - }
111 + } else if (sport == OFP_TCP_PORT || dport == OFP_TCP_PORT)
112 + openflow_print(bp, length);
113 }
114 return;
115 bad: