From owner-svn-src-user@FreeBSD.ORG Sat Feb 6 04:20:06 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2383106566B; Sat, 6 Feb 2010 04:20:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C866F8FC15; Sat, 6 Feb 2010 04:20:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o164K6I5049877; Sat, 6 Feb 2010 04:20:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o164K6Ll049875; Sat, 6 Feb 2010 04:20:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <201002060420.o164K6Ll049875@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Feb 2010 04:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203538 - user/kmacy/head_flowtable_v6/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 04:20:07 -0000 Author: kmacy Date: Sat Feb 6 04:20:06 2010 New Revision: 203538 URL: http://svn.freebsd.org/changeset/base/203538 Log: print IP address and ports Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c ============================================================================== --- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 02:04:49 2010 (r203537) +++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Sat Feb 6 04:20:06 2010 (r203538) @@ -810,6 +810,20 @@ flowtable_set_hashkey(struct flentry *fl hashkey[i] = key[i]; } + +static uint32_t * +flowtable_get_hashkey(struct flentry *fle) +{ + uint32_t *hashkey; + + if (fle->f_flags & FL_IPV6) + hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key; + else + hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key; + + return (hashkey); +} + static int flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, uint32_t fibnum, struct route *ro, uint16_t flags) @@ -907,7 +921,10 @@ kern_flowtable_insert(struct flowtable * #endif if (ro->ro_rt == NULL || ro->ro_lle == NULL) return (EINVAL); - +#ifdef FLOWTABLE_DEBUG + printf("kern_flowtable_insert: hash=0x%x fibnum=%d flags=0x%x\n", + hash, fibnum, flags); +#endif return (flowtable_insert(ft, hash, key, fibnum, ro, flags)); } @@ -1470,10 +1487,28 @@ flow_show(struct flowtable *ft, struct f { int idle_time; int rt_valid; + uint16_t sport, dport; + uint32_t *hashkey; + char saddr[4*sizeof "123"], daddr[4*sizeof "123"]; idle_time = (int)(time_uptime - fle->f_uptime); rt_valid = fle->f_rt != NULL; - db_printf("hash=0x%08x idle_time=%03d rt=%p ifp=%p", + + if (fle->f_flags & FL_IPV6) + goto skipaddr; + + hashkey = flowtable_get_hashkey(fle); + inet_ntoa_r(*(struct in_addr *) &hashkey[2], daddr); + if (ft->ft_flags & FL_HASH_ALL) { + inet_ntoa_r(*(struct in_addr *) &hashkey[1], saddr); + sport = ((uint16_t *)hashkey)[0]; + dport = ((uint16_t *)hashkey)[1]; + db_printf("%s:%d->%s:%d\n", saddr, sport, daddr, dport); + } else + db_printf("%s:\n", daddr); + +skipaddr: + db_printf("\thash=0x%08x idle_time=%03d rt=%p ifp=%p", fle->f_fhash, idle_time, fle->f_rt, rt_valid ? fle->f_rt->rt_ifp : NULL); if (rt_valid && (fle->f_rt->rt_flags & RTF_UP))