diff options
author | maxim <maxim@FreeBSD.org> | 2005-02-14 07:37:51 +0000 |
---|---|---|
committer | maxim <maxim@FreeBSD.org> | 2005-02-14 07:37:51 +0000 |
commit | d2ebfe4c1f1998f4bd2184a39cb19cc7ec023001 (patch) | |
tree | a6be9f7597e232f5e70091fea00613f0423dc377 /usr.sbin/tcpdrop | |
parent | 70bda33804e254c8add665f1fd0a4cd42750423d (diff) | |
download | FreeBSD-src-d2ebfe4c1f1998f4bd2184a39cb19cc7ec023001.zip FreeBSD-src-d2ebfe4c1f1998f4bd2184a39cb19cc7ec023001.tar.gz |
o Add handling of an IPv4-mapped IPv6 address.
o Use SYSCTL_IN() macro instead of direct call of copyin(9).
Submitted by: ume
o Move sysctl_drop() implementation to sys/netinet/tcp_subr.c where
most of tcp sysctls live.
o There are net.inet[6].tcp[6].getcred sysctls already, no needs in
a separate struct tcp_ident_mapping.
Suggested by: ume
Diffstat (limited to 'usr.sbin/tcpdrop')
-rw-r--r-- | usr.sbin/tcpdrop/tcpdrop.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/tcpdrop/tcpdrop.c b/usr.sbin/tcpdrop/tcpdrop.c index cfa8c2a..68ef0ef 100644 --- a/usr.sbin/tcpdrop/tcpdrop.c +++ b/usr.sbin/tcpdrop/tcpdrop.c @@ -38,7 +38,8 @@ int main(int argc, char *argv[]) { struct addrinfo hints, *ail, *aif, *laddr, *faddr; - struct tcp_ident_mapping tir; + /* addrs[0] is a foreign socket, addrs[1] is a local one. */ + struct sockaddr_storage addrs[2]; int mib[] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_DROP }; int gaierr, rval = 0; char fhbuf[NI_MAXHOST], fsbuf[NI_MAXSERV], lhbuf[NI_MAXHOST], @@ -61,8 +62,8 @@ main(int argc, char *argv[]) for (aif = faddr; aif; aif = aif->ai_next) { if (ail->ai_family != aif->ai_family) continue; - memcpy(&tir.faddr, aif->ai_addr, aif->ai_addrlen); - memcpy(&tir.laddr, ail->ai_addr, ail->ai_addrlen); + memcpy(&addrs[0], aif->ai_addr, aif->ai_addrlen); + memcpy(&addrs[1], ail->ai_addr, ail->ai_addrlen); if (getnameinfo(aif->ai_addr, aif->ai_addrlen, fhbuf, sizeof(fhbuf), fsbuf, sizeof(fsbuf), @@ -74,7 +75,7 @@ main(int argc, char *argv[]) NI_NUMERICHOST | NI_NUMERICSERV) == -1) err(1, "getnameinfo"); if (sysctl(mib, sizeof (mib) / sizeof (int), NULL, - NULL, &tir, sizeof(tir)) == -1) { + NULL, &addrs, sizeof(addrs)) == -1) { rval = 1; warn("%s %s %s %s", lhbuf, lsbuf, fhbuf, fsbuf); } else |