1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
|
--- libpcap-0.7.2.orig/nametoaddr.c
+++ libpcap-0.7.2/nametoaddr.c
@@ -310,7 +310,7 @@
e = ep = (u_char *)malloc(6);
while (*s) {
- if (*s == ':')
+ if (*s == ':' || *s == '.')
s += 1;
d = xdtoi(*s++);
if (isxdigit((unsigned char)*s)) {
--- libpcap-0.7.2.orig/debian/libpcap0.postinst
+++ libpcap-0.7.2/debian/libpcap0.postinst
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+if [ "$1" = "configure" ]; then
+ ldconfig
+fi
+
+#DEBHELPER#
--- libpcap-0.7.2.orig/debian/copyright
+++ libpcap-0.7.2/debian/copyright
@@ -0,0 +1,37 @@
+This package was debianized by Anand Kumria <wildfire@progsoc.org> on
+Sun, 12 Nov 2000 03:19:44 +1100.
+
+It was downloaded from http://www.tcpdump.org/
+
+Upstream Author(s): patches@tcpdump.org
+
+Copyright:
+
+The licence-style of this software is BSD. However this version (0.5)
+fails to include a file containing the licence. A similar version
+of the licence is available in /usr/share/common-licenses/BSD.
+Future versions of libpcap will contain the licence located at
+<URL: http://cvs.tcpdump.org/cgi-bin/cvsweb/libpcap/LICENSE?rev=1.1>
+which is what I describe below.
+
+The differences are:
+ - Item 3, replace "University" with "Authors"
+ - The LEGALESE (uppercase portion) ends after
+ the words "A PARTICULAR PURPOSE"
+ - The copyright holders are listed below (the CREDITS
+ file is canonical, this is merely a convienent listing)
+
+people who contributed to libpcap or tcpdump:
+ Bill Fenner <fenner@research.att.com>
+ Assar Westerlund <assar@sics.se>
+ Alexei <kuznet@ms2.inr.ac.ru>
+ Jun-ichiro itojun Hagino <itojun@iijlab.net>
+ Guy Harris <gharris@flashcom.net>
+ Torsten Landschoff <t.landschoff@gmx.net>
+ Michael Richardson <mcr@sandelman.ottawa.on.ca>
+
+The original LBL crew:
+ Steve McCanne
+ Craig Leres
+ Van Jacobson
+
--- libpcap-0.7.2.orig/debian/libpcap0.postrm
+++ libpcap-0.7.2/debian/libpcap0.postrm
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+if [ "$1" = "remove" ]; then
+ ldconfig
+fi
+
+#DEBHELPER#
--- libpcap-0.7.2.orig/debian/libpcap-dev.dirs
+++ libpcap-0.7.2/debian/libpcap-dev.dirs
@@ -0,0 +1,4 @@
+usr/lib
+usr/include
+usr/include/net
+usr/share/man/man3
--- libpcap-0.7.2.orig/debian/README.Debian
+++ libpcap-0.7.2/debian/README.Debian
@@ -0,0 +1,13 @@
+libpcap for Debian
+------------------
+
+ If you receive messages telling you the packet type is not supported
+ or is deprecated check that CONFIG_PACKET is set to either `Y' or `M'.
+
+ You should also check that /etc/modules.conf has the line
+
+ alias net-pf-17 af_packet
+
+ Feel free to report bugs.
+
+ -- Anand Kumria <wildfire@progsoc.org>, Tue, 28 Nov 2000 02:04:28 EST
--- libpcap-0.7.2.orig/debian/libpcap0.docs
+++ libpcap-0.7.2/debian/libpcap0.docs
@@ -0,0 +1,2 @@
+README
+CREDITS
--- libpcap-0.7.2.orig/debian/libpcap0.7.postinst
+++ libpcap-0.7.2/debian/libpcap0.7.postinst
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+if [ "$1" = "configure" ]; then
+ ldconfig
+fi
+
+#DEBHELPER#
+
--- libpcap-0.7.2.orig/debian/libpcap0.7.postrm
+++ libpcap-0.7.2/debian/libpcap0.7.postrm
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+if [ "$1" = "remove" ]; then
+ ldconfig
+fi
+
+#DEBHELPER#
+
--- libpcap-0.7.2.orig/debian/changelog
+++ libpcap-0.7.2/debian/changelog
@@ -0,0 +1,135 @@
+libpcap (0.7.2-1) unstable; urgency=low
+
+ * New upstream release (closes: #145538).
+ * debian/rules: Build the library with _FILE_OFFSET_BITS set to 64
+ to allow for files bigger than 2GB (closes: #129213).
+ * Rename the library package to libpcap0.7 and change the SONAME so that we
+ can account for interface changes (closes: #132359).
+ * Run ldconfig as appropriate (lintian).
+ * Remove watch.ex template and the silly symlink from libpcap-dev's
+ documentation to libpcap0 (lintian).
+
+ -- Torsten Landschoff <torsten@debian.org> Sat, 3 Aug 2002 23:33:56 +0200
+
+libpcap (0.6.2-2) unstable; urgency=low
+
+ * debian/control: Change section of libpcap0 from net to libs
+ (Debian installer message).
+ * aclocal.m4: Treat the ia64 as a cpu which can't handle unaligned
+ memory access (closes: #112152). Thanks for the report go to
+ John R. Daily.
+
+ -- Torsten Landschoff <torsten@debian.org> Fri, 14 Sep 2001 10:15:52 +0200
+
+libpcap (0.6.2-1) unstable; urgency=medium
+
+ * New upstream release.
+ * debian/control: Removed Build-Depends already satisfied by the
+ build-essential package.
+ * gencode.c (gen_scode): Add the missing default branch of the protocol
+ family switch (closes: 88688).
+ * debian/libpcap.post{rm,inst}: Run ldconfig (lintian).
+ * debian/copyright: Fix the "similiar" typo (lintian).
+
+ -- Torsten Landschoff <torsten@debian.org> Tue, 6 Mar 2001 04:27:27 +0100
+
+libpcap (0.6.1-2) unstable; urgency=low
+
+ * debian/rules: Changed the shlibs info so that only pcap 0.6
+ is okay for packages linked against this version.
+
+ -- Torsten Landschoff <torsten@debian.org> Thu, 18 Jan 2001 01:13:20 +0100
+
+libpcap (0.6.1-1) unstable; urgency=low
+
+ * Taking back the package. Kudos to Anand for helping out.
+ * debian/rules: Pass --enable-ipv6 to configure (closes: #80223).
+
+ -- Torsten Landschoff <torsten@debian.org> Tue, 16 Jan 2001 15:40:37 +0100
+
+libpcap (0.5.2-2) unstable; urgency=low
+
+ * Update config.guess and config.sub (Closes #26031)
+ * Source builds would not always work. Fix that.
+ * Kernel interface problem is really a module not loaded problem.
+ Note this in README.Debian. (Closes #21356)
+
+ -- Anand Kumria <wildfire@progsoc.org> Tue, 28 Nov 2000 02:03:25 +1100
+
+libpcap (0.5.2-1) unstable; urgency=low
+
+ * New upstream release
+ * New maintainer
+ * Migrate to Debhelper and insert Build-Depends
+
+ -- Anand Kumria <wildfire@progsoc.org> Sun, 12 Nov 2000 03:19:44 +1100
+
+libpcap (0.4a6-3) unstable; urgency=low
+
+ * New maintainer.
+ * scanner.l: Allow a 12 digit hex number as ether address as well as
+ BB.BB.BB.BB.BB.BB (closes: #48735)
+ * nametoaddr.c (pcap_ether_aton): Adjust for change in scanner.l
+
+ -- Torsten Landschoff <torsten@debian.org> Mon, 22 Nov 1999 02:39:45 +0100
+
+libpcap (0.4a6-2.1) unstable; urgency=low
+
+ * Non maintainer upload.
+ config.{guess,sub} changed to recognize a Arm architecture.
+
+ -- Turbo Fredriksson <turbo@debian.org> Thu, 20 Aug 1998 23:12:36 -0400
+
+libpcap (0.4a6-2) frozen unstable; urgency=low
+
+ * renamed /usr/doc/libpcap to /usr/doc/libpcap0 (should fix several
+ lintian warnings)
+ * updated standards-version
+ * rebuild with latest debmake
+
+ -- Peter Tobias <tobias@et-inf.fho-emden.de> Mon, 30 Mar 1998 00:46:44 +0200
+
+
+libpcap (0.4a6-1) unstable; urgency=low
+
+ * upgraded to latest upstream version, fixes: Bug#17164
+ * added patch from Michael Alan Dorman <mdorman@mdorman.law.miami.edu>
+ for building libpcap on alpha systems, fixes: Bug#15556
+ * fixed aclocal.m4 script
+
+ -- Peter Tobias <tobias@et-inf.fho-emden.de> Sat, 31 Jan 1998 23:19:42 +0100
+
+
+libpcap (0.4a2-2) unstable; urgency=low
+
+ * fixed detection of IFF_LOOPBACK for linux systems
+ * link shared library with -l
+
+ -- Peter Tobias <tobias@et-inf.fho-emden.de> Wed, 19 Nov 1997 23:44:34 +0100
+
+
+libpcap (0.4a2-1) unstable; urgency=low
+
+ * new maintainer
+ * latest upstream release
+ * libc6 version
+ * compiled with _REENTRANT
+
+ -- Peter Tobias <tobias@et-inf.fho-emden.de> Wed, 17 Sep 1997 20:40:01 +0200
+
+
+libpcap (0.3.1a3-1) unstable; urgency=low
+
+ * Latest upstream release. Fixes bug #6670.
+
+ -- Karl Sackett <krs@debian.org> Wed, 2 Apr 1997 10:19:28 -0600
+
+
+libpcap (0.3-1) unstable; urgency=low
+
+ * First Debian release.
+ * Makefile.in: supports libpcap.so target.
+
+ -- Karl Sackett <krs@debian.org> Wed, 8 Jan 1997 09:38:31 -0600
+
+
--- libpcap-0.7.2.orig/debian/rules
+++ libpcap-0.7.2/debian/rules
@@ -0,0 +1,87 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=2
+
+# shared library versions, option 1
+version=0.7.2
+major=0.7
+# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
+#version=`ls src/.libs/lib*.so.* | \
+# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
+#major=`ls src/.libs/lib*.so.* | \
+# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+ CFLAGS=-D_FILE_OFFSET_BITS=64 ./configure --prefix=/usr --mandir=\$${prefix}/share/man \
+ --enable-ipv6 --infodir=\$${prefix}/share/info
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) distclean
+
+ rm -f net/net
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(MAKE) install prefix=`pwd`/debian/libpcap-dev/usr
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# dh_testversion
+ dh_testdir
+ dh_testroot
+ #
+ # build libpcap${major} package by moving files from libpcap-dev
+ #
+ dh_movefiles -plibpcap$(major) --sourcedir=debian/libpcap-dev \
+ usr/lib/libpcap.so.$(major) \
+ usr/lib/libpcap.so.$(version)
+
+# dh_installdebconf
+ dh_installdocs
+ dh_installexamples
+ dh_installmenu
+ dh_installmanpages -plibpcap-dev
+ dh_installinfo
+# dh_undocumented
+ dh_installchangelogs CHANGES
+ dh_link -plibpcap-dev
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- libpcap-0.7.2.orig/debian/control
+++ libpcap-0.7.2/debian/control
@@ -0,0 +1,30 @@
+Source: libpcap
+Section: devel
+Priority: optional
+Maintainer: Torsten Landschoff <torsten@debian.org>
+Build-Depends: debhelper, flex, bison
+Standards-Version: 3.0.1
+
+Package: libpcap-dev
+Section: devel
+Architecture: any
+Depends: libpcap0.7 (= ${Source-Version}), libc6-dev
+Description: Development library for libpcap.
+ Includes headers, static libraries, and documentation.
+
+Package: libpcap0.7
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: System interface for user-level packet capture.
+ libpcap (Packet CAPture) provides a portable framework for low-level
+ network monitoring. Applications include network statistics collection,
+ security monitoring, network debugging, etc.
+ .
+ Since almost every system vendor provides a different interface for
+ packet capture, and since there are several tools that require this
+ functionality, we've created this system-independent API to ease in
+ porting and to alleviate the need for several system-dependent packet
+ capture modules in each application.
+ .
+ Further information is available at <URL: http://www.tcpdump.org/>
--- libpcap-0.7.2.orig/scanner.l
+++ libpcap-0.7.2/scanner.l
@@ -75,6 +75,7 @@
N ([0-9]+|(0X|0x)[0-9A-Fa-f]+)
B ([0-9A-Fa-f][0-9A-Fa-f]?)
W ([0-9A-Fa-f][0-9A-Fa-f]?[0-9A-Fa-f]?[0-9A-Fa-f]?)
+X [0-9A-Fa-f]
%a 15000
%o 17000
@@ -261,7 +262,7 @@
{N} { yylval.i = stoi((char *)yytext); return NUM; }
({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) {
yylval.s = sdup((char *)yytext); return HID; }
-{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext);
+({B}:{B}:{B}:{B}:{B}:{B})|({B}\.{B}\.{B}\.{B}\.{B}\.{B}) { yylval.e = pcap_ether_aton((char *)yytext);
return EID; }
{V6} {
#ifdef INET6
@@ -279,6 +280,8 @@
#endif /*INET6*/
}
{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); }
+{X}{12} { yylval.e = pcap_ether_aton((char *)yytext); return EID;}
+
icmptype { yylval.i = 0; return NUM; }
icmpcode { yylval.i = 1; return NUM; }
icmp-echoreply { yylval.i = 0; return NUM; }
--- libpcap-0.7.2.orig/Makefile.in
+++ libpcap-0.7.2/Makefile.in
@@ -37,6 +37,15 @@
srcdir = @srcdir@
VPATH = @srcdir@
+# some defines for shared library compilation - FIXME
+MAJ=0.7
+MIN=2
+VERSION=$(MAJ).$(MIN)
+LIBNAME=pcap
+LIBRARY=lib$(LIBNAME).a
+SOLIBRARY=lib$(LIBNAME).so
+SHAREDLIB=$(SOLIBRARY).$(VERSION)
+
#
# You shouldn't need to edit anything below.
#
@@ -48,6 +57,7 @@
# Standard CFLAGS
CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -67,7 +77,11 @@
# problem if you don't own the file but can write to the directory.
.c.o:
@rm -f $@
- $(CC) $(CFLAGS) -c $(srcdir)/$*.c
+ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
+
+%_pic.o: %.c
+ @rm -f $@
+ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
PSRC = pcap-@V_PCAP@.c
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
@@ -80,6 +94,7 @@
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
# hack the extra indirection
OBJ = $(PSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) # $(LIBOBJS)
+OBJ_PIC = $(PSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
ethertype.h gencode.h gnuc.h
GENHDR = \
@@ -91,15 +106,22 @@
TAGFILES = \
$(SRC) $(HDR) $(TAGHDR)
-CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
+CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so*
-all: libpcap.a
+all: libpcap.a $(SHAREDLIB)
libpcap.a: $(OBJ)
@rm -f $@
ar rc $@ $(OBJ)
$(RANLIB) $@
+$(SHAREDLIB): $(OBJ_PIC)
+ -@rm -f $@
+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
+ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
+
scanner.c: $(srcdir)/scanner.l
@rm -f $@
$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
@@ -107,6 +129,9 @@
scanner.o: scanner.c tokdefs.h
$(CC) $(CFLAGS) -c scanner.c
+scanner_pic.o: scanner.c tokdefs.h
+ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
+
tokdefs.h: grammar.c
grammar.c: $(srcdir)/grammar.y
@rm -f grammar.c tokdefs.h
@@ -118,9 +143,16 @@
@rm -f $@
$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
+grammar_pic.o: grammar.c
+ @rm -f $@
+ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
+
version.o: version.c
$(CC) $(CFLAGS) -c version.c
+version_pic.o: version.c
+ $(CC) -fPIC $(CFLAGS) -c version.c -o $@
+
snprintf.o: $(srcdir)/../tcpdump/missing/snprintf.c
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/../tcpdump/missing/snprintf.c
@@ -135,10 +167,16 @@
bpf_filter.o: bpf_filter.c
$(CC) $(CFLAGS) -c bpf_filter.c
+bpf_filter_pic.o: bpf_filter.c
+ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
+
install:
[ -d $(DESTDIR)$(libdir) ] || \
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
[ -d $(DESTDIR)$(includedir) ] || \
(mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
|