Merge branch 'master' of git://openvswitch.org/openvswitch
[sliver-openvswitch.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 @@ -130,7 +130,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 @@ -163,6 +164,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 llc_print(const u_char *, u_int, u_int, const u_char *,
19         const u_char *, u_short *);
20  extern int snap_print(const u_char *, u_int, u_int, u_int);
21 --- tcpdump/Makefile.in 2012-06-13 04:56:20.000000000 +1200
22 +++ tcpdump/Makefile.in 2012-08-29 21:36:37.000000000 +1200
23 @@ -43,7 +43,7 @@
24  CC = @CC@
25  PROG = tcpdump
26  CCOPT = @V_CCOPT@
27 -INCLS = -I. @V_INCLS@
28 +INCLS = -I. @V_INCLS@ -I../../include
29  DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
30
31  # Standard CFLAGS
32 @@ -51,10 +51,10 @@
33  FULL_CFLAGS = $(CCOPT) $(DEFS) $(INCLS) $(CFLAGS)
34  
35  # Standard LDFLAGS
36 -LDFLAGS = @LDFLAGS@
37 +LDFLAGS = @LDFLAGS@ -L../../lib
38  
39  # Standard LIBS
40 -LIBS = @LIBS@
41 +LIBS = @LIBS@ -lopenvswitch -lssl -lrt -lm
42  
43  INSTALL = @INSTALL@
44  INSTALL_PROGRAM = @INSTALL_PROGRAM@
45 @@ -93,7 +93,8 @@
46         print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
47         print-timed.c print-tipc.c print-token.c print-udld.c print-udp.c \
48         print-usb.c print-vjc.c print-vqp.c print-vrrp.c print-vtp.c \
49 -       print-wb.c print-zephyr.c signature.c setsignal.c tcpdump.c util.c
50 +       print-wb.c print-zephyr.c signature.c setsignal.c tcpdump.c util.c \
51 +       print-openflow.c
52  
53  LIBNETDISSECT_SRC=print-isakmp.c
54  LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o)
55 --- tcpdump/print-openflow.c    1969-12-31 16:00:00.000000000 -0800
56 +++ tcpdump/print-openflow.c    2009-05-11 15:38:41.000000000 -0700
57 @@ -0,0 +1,45 @@
58 +/* Copyright (C) 2007, 2008, 2009 Nicira, Inc.
59 +
60 +   Redistribution and use in source and binary forms, with or without
61 +   modification, are permitted provided that the following conditions
62 +   are met:
63 +
64 +    1. Redistributions of source code must retain the above copyright
65 +       notice, this list of conditions and the following disclaimer.
66 +    2. Redistributions in binary form must reproduce the above copyright
67 +       notice, this list of conditions and the following disclaimer in
68 +       the documentation and/or other materials provided with the
69 +       distribution.
70 +    3. The names of the authors may not be used to endorse or promote
71 +       products derived from this software without specific prior
72 +       written permission.
73 +
74 +   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
75 +   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
76 +   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
77 + */
78 +
79 +#ifdef HAVE_CONFIG_H
80 +#include "config.h"
81 +#endif
82 +
83 +#include <stdlib.h>
84 +
85 +#include "interface.h"
86 +#include "openflow/openflow.h"
87 +#include "../../lib/ofp-print.h"
88 +
89 +void
90 +openflow_print(const u_char *sp, u_int length)
91 +{
92 +    const struct ofp_header *ofp = (struct ofp_header *)sp;
93 +
94 +    if (!TTEST2(*sp, ntohs(ofp->length)))
95 +            goto trunc;
96 +
97 +    ofp_print(stdout, sp, length, vflag);
98 +    return;
99 +
100 +trunc:
101 +    printf("[|openflow]");
102 +}
103 --- tcpdump/print-tcp.c 2006-09-19 12:07:57.000000000 -0700
104 +++ tcpdump/print-tcp.c 2009-05-11 15:38:25.000000000 -0700
105 @@ -56,6 +56,8 @@
106  
107  #include "nameser.h"
108  
109 +#include "openflow/openflow.h"
110 +
111  #ifdef HAVE_LIBCRYPTO
112  #include <openssl/md5.h>
113  #include <signature.h>
114 @@ -669,7 +672,9 @@
115          }
116          else if (length > 0 && (sport == LDP_PORT || dport == LDP_PORT)) {
117                  ldp_print(bp, length);
118 -        }
119 +        } else if (sport == OFP_TCP_PORT || dport == OFP_TCP_PORT) {
120 +                   openflow_print(bp, length);
121 +        }
122  
123          return;
124   bad: