From owner-freebsd-net Fri Jan 24 1:48:54 2003 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49E9B37B401 for ; Fri, 24 Jan 2003 01:48:52 -0800 (PST) Received: from ns.neurolution.com (w246.z064003144.sjc-ca.dsl.cnc.net [64.3.144.246]) by mx1.FreeBSD.org (Postfix) with ESMTP id 65FF243F13 for ; Fri, 24 Jan 2003 01:48:50 -0800 (PST) (envelope-from federico@liquilan.com) Received: from ntt-fedelap.liquilan.com (dhcp229.nttmcl.com [216.69.69.229]) by ns.neurolution.com (8.12.6/8.12.6) with ESMTP id h0O9mVo4006906 for ; Fri, 24 Jan 2003 01:48:32 -0800 (PST) (envelope-from federico@liquilan.com) Message-Id: <5.1.0.14.2.20030124012414.00a9fb88@alicia.nttmcl.com> X-Sender: federico@liquilan.com (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 24 Jan 2003 01:44:11 -0800 To: freebsd-net@freebsd.org From: Federico Andrade Subject: Adding bridge table lookup via sysctl() Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi all, I am doing some work based on the FreeBSD 4.7 bridge code, and want to add some "userland" table lookup capabilities. Right now I did this for a sysctl call: (BTW, sorry if the code aesthetics are not the best, I promise to clean that up later): ############################################################################## #define LOG(x) x : : Stuff in between... : static int sysctl_bridge_tl(SYSCTL_HANDLER_ARGS) { if (do_bridge) { int i,error,index; char str_line[1024]; for (i=0; iif_name, (bdg_t[index].name <= BDG_FORWARD) ? 0 : bdg_t[index].name->if_unit,bdg_t[index].used); error = SYSCTL_OUT(req, str_line, sizeof(str_line)); LOG(log(LOG_DEBUG,str_line);) LOG(log(LOG_DEBUG,"Error code = %d\n",error);) if (error) return (error); } } } } } SYSCTL_DECL(_net_link_ether); SYSCTL_PROC(_net_link_ether, OID_AUTO, bridge_table, CTLTYPE_STRING|CTLFLAG_RD, NULL, 0, &sysctl_bridge_tl, "A", "Bridge table"); ############################################################################## The point is, if I do a "sysctl net.link.ether.bridge_table" on a terminal that is not the console, I don't get any result to this command, but I can see via the log (var/log/messages and the main console) something like this (from the log function): Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: IDX# MAC IF USED for CLUSTER: 256 Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: 292 00:60:ef:20:6e:04 vlan20 0 Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: 306 00:60:ef:20:6e:12 vlan40 1 Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: 1373 00:60:ef:20:aa:7d vlan10 1 Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: 4820 00:50:73:46:61:92 fxp1 1 Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: 5471 00:60:ef:20:9a:7f vlan30 1 Jan 24 01:00:04 eacs6 /kernel.BGE_FW2: IDX# MAC IF USED for CLUSTER: 256 (The 256 I guess is because of the htons(), I'll check it later...) The problem appears to be the function I am using for sending the results to the stdout of the user, but I am not that familiar with sysctl macros and functions... Any suggestions will be appreciated. Regards, Federico. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message