fatal-signal: Fix bug in call_hooks() recursion detection.
[sliver-openvswitch.git] / third-party / ofp-tcpdump.patch
1 diff -rNu tcpdump/interface.h tcpdump/interface.h
2 --- tcpdump/interface.h 2007-06-13 18:03:20.000000000 -0700
3 +++ tcpdump/interface.h 2008-02-06 15:06:30.000000000 -0800
4 @@ -148,7 +148,8 @@
5  
6  extern const char *dnaddr_string(u_short);
7  
8 -extern void error(const char *, ...)
9 +#define error(fmt, args...)   tcpdump_error(fmt, ## args)
10 +extern void tcpdump_error(const char *, ...)
11      __attribute__((noreturn, format (printf, 1, 2)));
12  extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2)));
13  
14 @@ -176,6 +177,7 @@
15  extern void hex_print_with_offset(const char *, const u_char *, u_int, u_int);
16  extern void hex_print(const char *, const u_char *, u_int);
17  extern void telnet_print(const u_char *, u_int);
18 +extern void openflow_print(const u_char *, u_int);
19  extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
20  extern int llc_print(const u_char *, u_int, u_int, const u_char *,
21         const u_char *, u_short *);
22 diff -rNu tcpdump/Makefile.in tcpdump/Makefile.in
23 --- tcpdump/Makefile.in 2007-09-25 18:59:52.000000000 -0700
24 +++ tcpdump/Makefile.in 2008-02-07 11:46:03.000000000 -0800
25 @@ -49,10 +49,10 @@
26  CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
27  
28  # Standard LDFLAGS
29 -LDFLAGS = @LDFLAGS@
30 +LDFLAGS = @LDFLAGS@ -L../../lib
31  
32  # Standard LIBS
33 -LIBS = @LIBS@
34 +LIBS = @LIBS@ -lopenflow
35  
36  INSTALL = @INSTALL@
37  INSTALL_PROGRAM = @INSTALL_PROGRAM@
38 @@ -87,7 +87,8 @@
39         print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
40         print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
41         print-timed.c print-token.c print-udp.c print-vjc.c print-vrrp.c \
42 -       print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
43 +       print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c \
44 +       print-openflow.c
45  
46  LOCALSRC = @LOCALSRC@
47  GENSRC = version.c
48 diff -rNu tcpdump/print-openflow.c tcpdump/print-openflow.c
49 --- tcpdump/print-openflow.c    1969-12-31 16:00:00.000000000 -0800
50 +++ tcpdump/print-openflow.c    2008-02-07 11:29:01.000000000 -0800
51 @@ -0,0 +1,46 @@
52 +/* Copyright (C) 2007, 2008 Board of Trustees, Leland Stanford Jr. University.
53 + *
54 + * Permission is hereby granted, free of charge, to any person obtaining a copy
55 + * of this software and associated documentation files (the "Software"), to
56 + * deal in the Software without restriction, including without limitation the
57 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
58 + * sell copies of the Software, and to permit persons to whom the Software is
59 + * furnished to do so, subject to the following conditions:
60 + *
61 + * The above copyright notice and this permission notice shall be included in
62 + * all copies or substantial portions of the Software.
63 + *
64 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
65 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
66 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
67 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
68 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
69 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
70 + * IN THE SOFTWARE.
71 + */
72 +
73 +
74 +#ifdef HAVE_CONFIG_H
75 +#include "config.h"
76 +#endif
77 +
78 +#include <stdlib.h>
79 +
80 +#include "interface.h"
81 +#include "../../include/openflow/openflow.h"
82 +#include "../../include/ofp-print.h"
83 +
84 +void
85 +openflow_print(const u_char *sp, u_int length)
86 +{
87 +    const struct ofp_header *ofp = (struct ofp_header *)sp;
88 +
89 +    if (!TTEST2(*sp, ntohs(ofp->length)))
90 +            goto trunc;
91 +
92 +    ofp_print(stdout, sp, length, vflag);
93 +    return;
94 +
95 +trunc:
96 +    printf("[|openflow]");
97 +}
98 diff -rNu tcpdump/print-tcp.c tcpdump/print-tcp.c
99 --- tcpdump/print-tcp.c 2006-09-19 12:07:57.000000000 -0700
100 +++ tcpdump/print-tcp.c 2008-02-07 13:07:58.000000000 -0800
101 @@ -52,6 +52,8 @@
102  
103  #include "nameser.h"
104  
105 +#include "../../include/openflow.h"
106 +
107  #ifdef HAVE_LIBCRYPTO
108  #include <openssl/md5.h>
109  
110 @@ -680,7 +682,8 @@
111                 }
112                  else if (length > 0 && (sport == LDP_PORT || dport == LDP_PORT)) {
113                          ldp_print(bp, length);
114 -               }
115 +               } else if (sport == OFP_TCP_PORT || dport == OFP_TCP_PORT)
116 +                       openflow_print(bp, length);
117         }
118         return;
119  bad: