Setting tag sliver-openvswitch-2.2.90-1
[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 @@ -363,7 +364,7 @@ all: $(PROG)
56  
57  $(PROG): $(OBJ) 
58         @rm -f $@
59 -       $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
60 +       libtool --mode=link $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
61  
62  $(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
63         @rm -f $@
64 --- tcpdump/print-openflow.c    1969-12-31 16:00:00.000000000 -0800
65 +++ tcpdump/print-openflow.c    2009-05-11 15:38:41.000000000 -0700
66 @@ -0,0 +1,45 @@
67 +/* Copyright (C) 2007, 2008, 2009 Nicira, Inc.
68 +
69 +   Redistribution and use in source and binary forms, with or without
70 +   modification, are permitted provided that the following conditions
71 +   are met:
72 +
73 +    1. Redistributions of source code must retain the above copyright
74 +       notice, this list of conditions and the following disclaimer.
75 +    2. Redistributions in binary form must reproduce the above copyright
76 +       notice, this list of conditions and the following disclaimer in
77 +       the documentation and/or other materials provided with the
78 +       distribution.
79 +    3. The names of the authors may not be used to endorse or promote
80 +       products derived from this software without specific prior
81 +       written permission.
82 +
83 +   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
84 +   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
85 +   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
86 + */
87 +
88 +#ifdef HAVE_CONFIG_H
89 +#include "config.h"
90 +#endif
91 +
92 +#include <stdlib.h>
93 +
94 +#include "interface.h"
95 +#include "openflow/openflow.h"
96 +#include "../../lib/ofp-print.h"
97 +
98 +void
99 +openflow_print(const u_char *sp, u_int length)
100 +{
101 +    const struct ofp_header *ofp = (struct ofp_header *)sp;
102 +
103 +    if (!TTEST2(*sp, ntohs(ofp->length)))
104 +            goto trunc;
105 +
106 +    ofp_print(stdout, sp, length, vflag);
107 +    return;
108 +
109 +trunc:
110 +    printf("[|openflow]");
111 +}
112 --- tcpdump/print-tcp.c 2006-09-19 12:07:57.000000000 -0700
113 +++ tcpdump/print-tcp.c 2009-05-11 15:38:25.000000000 -0700
114 @@ -56,6 +56,8 @@
115  
116  #include "nameser.h"
117  
118 +#include "openflow/openflow.h"
119 +
120  #ifdef HAVE_LIBCRYPTO
121  #include <openssl/md5.h>
122  #include <signature.h>
123 @@ -669,7 +672,9 @@
124          }
125          else if (length > 0 && (sport == LDP_PORT || dport == LDP_PORT)) {
126                  ldp_print(bp, length);
127 -        }
128 +        } else if (sport == OFP_OLD_PORT || dport == OFP_OLD_PORT) {
129 +                   openflow_print(bp, length);
130 +        }
131  
132          return;
133   bad: