003 File Manager
Current Path:
/usr/src/contrib/tcpdump
usr
/
src
/
contrib
/
tcpdump
/
π
..
π
CHANGES
(57.87 KB)
π
CONTRIBUTING
(5.93 KB)
π
CREDITS
(14.57 KB)
π
INSTALL.txt
(5.25 KB)
π
LICENSE
(873 B)
π
Makefile-devel-adds
(614 B)
π
Makefile.in
(9.96 KB)
π
PLATFORMS
(567 B)
π
README
(9.04 KB)
π
README.md
(9.04 KB)
π
VERSION
(6 B)
π
addrtoname.c
(33.19 KB)
π
addrtoname.h
(2.78 KB)
π
addrtostr.c
(5.64 KB)
π
addrtostr.h
(2.03 KB)
π
af.c
(1.96 KB)
π
af.h
(1.81 KB)
π
ah.h
(2.34 KB)
π
appletalk.h
(4.06 KB)
π
ascii_strcasecmp.c
(3.5 KB)
π
ascii_strcasecmp.h
(1.49 KB)
π
atime.awk
(529 B)
π
atm.h
(1.14 KB)
π
bpf_dump.c
(1.9 KB)
π
chdlc.h
(1.31 KB)
π
checksum.c
(5.25 KB)
π
config.guess
(43.17 KB)
π
config.h.in
(11.19 KB)
π
config.sub
(34.93 KB)
π
configure
(255.88 KB)
π
configure.ac
(25.05 KB)
π
configure.in
(25.66 KB)
π
cpack.c
(3.92 KB)
π
cpack.h
(2.37 KB)
π
ether.h
(2.34 KB)
π
ethertype.h
(5.58 KB)
π
extract.h
(11.48 KB)
π
funcattrs.h
(4.42 KB)
π
getopt_long.h
(2.52 KB)
π
gmpls.c
(5.82 KB)
π
gmpls.h
(1.38 KB)
π
gmt2local.c
(2.01 KB)
π
gmt2local.h
(1.21 KB)
π
in_cksum.c
(6.44 KB)
π
install-sh
(5.45 KB)
π
interface.h
(2.29 KB)
π
ip.h
(5.75 KB)
π
ip6.h
(7.6 KB)
π
ipproto.c
(16.49 KB)
π
ipproto.h
(4.72 KB)
π
l2vpn.c
(3.36 KB)
π
l2vpn.h
(781 B)
π
lbl
π
llc.h
(3.72 KB)
π
machdep.c
(2.58 KB)
π
machdep.h
(1.24 KB)
π
makemib
(6.41 KB)
π
mib.h
(26.33 KB)
π
missing
π
mkdep
(2.43 KB)
π
mpls.h
(1.93 KB)
π
nameser.h
(10.8 KB)
π
netdissect-stdinc.h
(9.93 KB)
π
netdissect.c
(3.38 KB)
π
netdissect.h
(30.13 KB)
π
nfs.h
(13.37 KB)
π
nfsfh.h
(2.57 KB)
π
nlpid.c
(1.27 KB)
π
nlpid.h
(1.3 KB)
π
openflow.h
(2.14 KB)
π
ospf.h
(10.21 KB)
π
oui.c
(3.83 KB)
π
oui.h
(4.06 KB)
π
packetdat.awk
(1.39 KB)
π
parsenfsfh.c
(12.87 KB)
π
pcap-missing.h
(1.8 KB)
π
pcap_dump_ftell.c
(1.29 KB)
π
ppp.h
(3.07 KB)
π
print-802_11.c
(91.47 KB)
π
print-802_15_4.c
(5.5 KB)
π
print-ah.c
(2.02 KB)
π
print-ahcp.c
(10.73 KB)
π
print-aodv.c
(15.98 KB)
π
print-aoe.c
(11.13 KB)
π
print-ap1394.c
(4 KB)
π
print-arcnet.c
(8.83 KB)
π
print-arp.c
(14.57 KB)
π
print-ascii.c
(6.23 KB)
π
print-atalk.c
(16.76 KB)
π
print-atm.c
(16.81 KB)
π
print-babel.c
(23.79 KB)
π
print-beep.c
(1.71 KB)
π
print-bfd.c
(16.5 KB)
π
print-bgp.c
(99.77 KB)
π
print-bootp.c
(30.07 KB)
π
print-bt.c
(2.21 KB)
π
print-calm-fast.c
(1.81 KB)
π
print-carp.c
(2.43 KB)
π
print-cdp.c
(11.16 KB)
π
print-cfm.c
(24.19 KB)
π
print-chdlc.c
(5.88 KB)
π
print-cip.c
(2.5 KB)
π
print-cnfp.c
(13.69 KB)
π
print-dccp.c
(17.75 KB)
π
print-decnet.c
(37.63 KB)
π
print-dhcp6.c
(23.22 KB)
π
print-domain.c
(18.44 KB)
π
print-dtp.c
(3.03 KB)
π
print-dvmrp.c
(8.98 KB)
π
print-eap.c
(9.26 KB)
π
print-egp.c
(8.69 KB)
π
print-eigrp.c
(19.49 KB)
π
print-enc.c
(4.2 KB)
π
print-esp.c
(21.46 KB)
π
print-ether.c
(12.91 KB)
π
print-fddi.c
(10.51 KB)
π
print-forces.c
(45.01 KB)
π
print-fr.c
(31.99 KB)
π
print-frag6.c
(2.36 KB)
π
print-ftp.c
(973 B)
π
print-geneve.c
(6.13 KB)
π
print-geonet.c
(6.72 KB)
π
print-gre.c
(9.72 KB)
π
print-hncp.c
(26.39 KB)
π
print-hsrp.c
(4.57 KB)
π
print-http.c
(1.51 KB)
π
print-icmp.c
(22.7 KB)
π
print-icmp6.c
(59.81 KB)
π
print-igmp.c
(10.05 KB)
π
print-igrp.c
(4.64 KB)
π
print-ip.c
(17.04 KB)
π
print-ip6.c
(10.57 KB)
π
print-ip6opts.c
(5.53 KB)
π
print-ipcomp.c
(2.32 KB)
π
print-ipfc.c
(4.41 KB)
π
print-ipnet.c
(2.78 KB)
π
print-ipx.c
(6.42 KB)
π
print-isakmp.c
(81.72 KB)
π
print-isoclns.c
(107.61 KB)
π
print-juniper.c
(48.42 KB)
π
print-krb.c
(6.26 KB)
π
print-l2tp.c
(23.94 KB)
π
print-lane.c
(3.04 KB)
π
print-ldp.c
(24.35 KB)
π
print-lisp.c
(15.23 KB)
π
print-llc.c
(16.68 KB)
π
print-lldp.c
(57.26 KB)
π
print-lmp.c
(38.11 KB)
π
print-loopback.c
(3.63 KB)
π
print-lspping.c
(51.64 KB)
π
print-lwapp.c
(13.01 KB)
π
print-lwres.c
(14.08 KB)
π
print-m3ua.c
(10.92 KB)
π
print-medsa.c
(5.57 KB)
π
print-mobile.c
(3.28 KB)
π
print-mobility.c
(9.74 KB)
π
print-mpcp.c
(7.87 KB)
π
print-mpls.c
(5.31 KB)
π
print-mptcp.c
(13.68 KB)
π
print-msdp.c
(2.69 KB)
π
print-msnlb.c
(2.39 KB)
π
print-nflog.c
(4.4 KB)
π
print-nfs.c
(42.84 KB)
π
print-nsh.c
(5.39 KB)
π
print-ntp.c
(13.34 KB)
π
print-null.c
(4.01 KB)
π
print-olsr.c
(23.42 KB)
π
print-openflow-1.0.c
(76.63 KB)
π
print-openflow.c
(4.77 KB)
π
print-ospf.c
(39.49 KB)
π
print-ospf6.c
(29.86 KB)
π
print-otv.c
(2.1 KB)
π
print-pflog.c
(4.86 KB)
π
print-pfsync.c
(12.53 KB)
π
print-pgm.c
(22.17 KB)
π
print-pim.c
(32.59 KB)
π
print-pktap.c
(5.18 KB)
π
print-ppi.c
(2.68 KB)
π
print-ppp.c
(46.16 KB)
π
print-pppoe.c
(5.65 KB)
π
print-pptp.c
(25.9 KB)
π
print-radius.c
(35.1 KB)
π
print-raw.c
(1.52 KB)
π
print-resp.c
(16.5 KB)
π
print-rip.c
(9.19 KB)
π
print-ripng.c
(6 KB)
π
print-rpki-rtr.c
(10.83 KB)
π
print-rrcp.c
(4.56 KB)
π
print-rsvp.c
(78.61 KB)
π
print-rt6.c
(2.66 KB)
π
print-rtsp.c
(1.16 KB)
π
print-rx.c
(66.92 KB)
π
print-sctp.c
(23.13 KB)
π
print-sflow.c
(31.91 KB)
π
print-sip.c
(1.29 KB)
π
print-sl.c
(6.95 KB)
π
print-sll.c
(9.2 KB)
π
print-slow.c
(25.17 KB)
π
print-smb.c
(43.19 KB)
π
print-smtp.c
(983 B)
π
print-snmp.c
(43.17 KB)
π
print-stp.c
(17.18 KB)
π
print-sunatm.c
(3.27 KB)
π
print-sunrpc.c
(7.85 KB)
π
print-symantec.c
(3.78 KB)
π
print-syslog.c
(3.96 KB)
π
print-tcp.c
(35.84 KB)
π
print-telnet.c
(15.02 KB)
π
print-tftp.c
(5.2 KB)
π
print-timed.c
(4.74 KB)
π
print-tipc.c
(11.53 KB)
π
print-token.c
(7.96 KB)
π
print-udld.c
(5.47 KB)
π
print-udp.c
(21.28 KB)
π
print-usb.c
(4.18 KB)
π
print-vjc.c
(4.45 KB)
π
print-vqp.c
(6.8 KB)
π
print-vrrp.c
(6.37 KB)
π
print-vtp.c
(13.56 KB)
π
print-vxlan-gpe.c
(3.46 KB)
π
print-vxlan.c
(2.21 KB)
π
print-wb.c
(10.93 KB)
π
print-zephyr.c
(8.03 KB)
π
print-zeromq.c
(7.5 KB)
π
print.c
(11.54 KB)
π
print.h
(1.78 KB)
π
rpc_auth.h
(2.77 KB)
π
rpc_msg.h
(3.19 KB)
π
rpl.h
(4.88 KB)
π
send-ack.awk
(1.56 KB)
π
setsignal.c
(3.27 KB)
π
setsignal.h
(1.24 KB)
π
signature.c
(5.58 KB)
π
signature.h
(1.12 KB)
π
slcompress.h
(3.55 KB)
π
smb.h
(5.38 KB)
π
smbutil.c
(63.88 KB)
π
stime.awk
(567 B)
π
strtoaddr.c
(5.34 KB)
π
strtoaddr.h
(992 B)
π
tcp.h
(5.02 KB)
π
tcpdump.1.in
(60.82 KB)
π
tcpdump.c
(69.76 KB)
π
timeval-operations.h
(3.19 KB)
π
udp.h
(8.25 KB)
π
util-print.c
(23.75 KB)
π
vfprintf.c
(1.62 KB)
Editing: addrtostr.c
/* * Copyright (c) 1999 Kungliga Tekniska HΓΆgskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Kungliga Tekniska * HΓΆgskolan and its contributors. * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <netdissect-stdinc.h> #include "addrtostr.h" #include <stdio.h> #include <string.h> /* * */ #ifndef IN6ADDRSZ #define IN6ADDRSZ 16 /* IPv6 T_AAAA */ #endif #ifndef INT16SZ #define INT16SZ 2 /* word size */ #endif const char * addrtostr (const void *src, char *dst, size_t size) { const u_char *srcaddr = (const u_char *)src; const char digits[] = "0123456789"; int i; const char *orig_dst = dst; if (size < INET_ADDRSTRLEN) { errno = ENOSPC; return NULL; } for (i = 0; i < 4; ++i) { int n = *srcaddr++; int non_zerop = 0; if (non_zerop || n / 100 > 0) { *dst++ = digits[n / 100]; n %= 100; non_zerop = 1; } if (non_zerop || n / 10 > 0) { *dst++ = digits[n / 10]; n %= 10; non_zerop = 1; } *dst++ = digits[n]; if (i != 3) *dst++ = '.'; } *dst++ = '\0'; return orig_dst; } /* * Convert IPv6 binary address into presentation (printable) format. */ const char * addrtostr6 (const void *src, char *dst, size_t size) { /* * Note that int32_t and int16_t need only be "at least" large enough * to contain a value of the specified size. On some systems, like * Crays, there is no such thing as an integer variable with 16 bits. * Keep this in mind if you think this function should have been coded * to use pointer overlays. All the world's not a VAX. */ const u_char *srcaddr = (const u_char *)src; char *dp; size_t space_left, added_space; int snprintfed; struct { int base; int len; } best, cur; uint16_t words [IN6ADDRSZ / INT16SZ]; int i; /* Preprocess: * Copy the input (bytewise) array into a wordwise array. * Find the longest run of 0x00's in src[] for :: shorthanding. */ for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) words[i] = (srcaddr[2*i] << 8) | srcaddr[2*i + 1]; best.len = 0; best.base = -1; cur.len = 0; cur.base = -1; for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++) { if (words[i] == 0) { if (cur.base == -1) cur.base = i, cur.len = 1; else cur.len++; } else if (cur.base != -1) { if (best.base == -1 || cur.len > best.len) best = cur; cur.base = -1; } } if ((cur.base != -1) && (best.base == -1 || cur.len > best.len)) best = cur; if (best.base != -1 && best.len < 2) best.base = -1; /* Format the result. */ dp = dst; space_left = size; #define APPEND_CHAR(c) \ { \ if (space_left == 0) { \ errno = ENOSPC; \ return (NULL); \ } \ *dp++ = c; \ space_left--; \ } for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++) { /* Are we inside the best run of 0x00's? */ if (best.base != -1 && i >= best.base && i < (best.base + best.len)) { if (i == best.base) APPEND_CHAR(':'); continue; } /* Are we following an initial run of 0x00s or any real hex? */ if (i != 0) APPEND_CHAR(':'); /* Is this address an encapsulated IPv4? */ if (i == 6 && best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { if (!addrtostr(srcaddr+12, dp, space_left)) { errno = ENOSPC; return (NULL); } added_space = strlen(dp); dp += added_space; space_left -= added_space; break; } snprintfed = snprintf (dp, space_left, "%x", words[i]); if (snprintfed < 0) return (NULL); if ((size_t) snprintfed >= space_left) { errno = ENOSPC; return (NULL); } dp += snprintfed; space_left -= snprintfed; } /* Was it a trailing run of 0x00's? */ if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) APPEND_CHAR(':'); APPEND_CHAR('\0'); return (dst); }
Upload File
Create Folder