Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/netinet Pull up revision 1.136 (requested by itojun):



details:   https://anonhg.NetBSD.org/src/rev/eea7c0e527ec
branches:  netbsd-1-5
changeset: 492955:eea7c0e527ec
user:      he <he%NetBSD.org@localhost>
date:      Wed Mar 20 21:42:32 2002 +0000

description:
Pull up revision 1.136 (requested by itojun):
  Support tcp_log_refused for IPv6.

diffstat:

 sys/netinet/tcp_input.c |  31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diffs (58 lines):

diff -r bc207ac6e3cd -r eea7c0e527ec sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Mon Mar 11 22:45:04 2002 +0000
+++ b/sys/netinet/tcp_input.c   Wed Mar 20 21:42:32 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.108.4.10 2002/01/24 22:44:21 he Exp $  */
+/*     $NetBSD: tcp_input.c,v 1.108.4.11 2002/03/20 21:42:32 he Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -864,23 +864,13 @@
                {
                        ++tcpstat.tcps_noport;
                        if (tcp_log_refused && (tiflags & TH_SYN)) {
-#ifndef INET6
                                char src[4*sizeof "123"];
                                char dst[4*sizeof "123"];
-#else
-                               char src[INET6_ADDRSTRLEN];
-                               char dst[INET6_ADDRSTRLEN];
-#endif
+
                                if (ip) {
                                        strcpy(src, inet_ntoa(ip->ip_src));
                                        strcpy(dst, inet_ntoa(ip->ip_dst));
                                }
-#ifdef INET6
-                               else if (ip6) {
-                                       strcpy(src, ip6_sprintf(&ip6->ip6_src));
-                                       strcpy(dst, ip6_sprintf(&ip6->ip6_dst));
-                               }
-#endif
                                else {
                                        strcpy(src, "(unknown)");
                                        strcpy(dst, "(unknown)");
@@ -925,6 +915,23 @@
                }
                if (in6p == NULL) {
                        ++tcpstat.tcps_noport;
+                       if (tcp_log_refused && (tiflags & TH_SYN)) {
+                               char src[INET6_ADDRSTRLEN];
+                               char dst[INET6_ADDRSTRLEN];
+
+                               if (ip6) {
+                                       strcpy(src, ip6_sprintf(&ip6->ip6_src));
+                                       strcpy(dst, ip6_sprintf(&ip6->ip6_dst));
+                               }
+                               else {
+                                       strcpy(src, "(unknown v6)");
+                                       strcpy(dst, "(unknown v6)");
+                               }
+                               log(LOG_INFO,
+                                   "Connection attempt to TCP [%s]:%d from [%s]:%d\n",
+                                   dst, ntohs(th->th_dport),
+                                   src, ntohs(th->th_sport));
+                       }
                        TCP_FIELDS_TO_HOST(th);
                        goto dropwithreset_ratelim;
                }



Home | Main Index | Thread Index | Old Index