From owner-p4-projects@FreeBSD.ORG Tue Jun 30 21:59:50 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5CEBF1065674; Tue, 30 Jun 2009 21:59:50 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D0741065672 for ; Tue, 30 Jun 2009 21:59:50 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E49648FC15 for ; Tue, 30 Jun 2009 21:59:49 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ULxnEF083931 for ; Tue, 30 Jun 2009 21:59:49 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5ULxnCq083929 for perforce@freebsd.org; Tue, 30 Jun 2009 21:59:49 GMT (envelope-from anchie@FreeBSD.org) Date: Tue, 30 Jun 2009 21:59:49 GMT Message-Id: <200906302159.n5ULxnCq083929@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to anchie@FreeBSD.org using -f From: Ana Kukec To: Perforce Change Reviews Cc: Subject: PERFORCE change 165488 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 21:59:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=165488 Change 165488 by anchie@anchie_malimis on 2009/06/30 21:58:56 Changes introduced in order to remove the netgraph usage - added new per-interaface packet data structure: snd_ifinfo. Affected files ... .. //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#2 edit .. //depot/projects/soc2009/anchie_send/send_0.2/sendd/sendd.c#6 edit Differences ... ==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#2 (text+ko) ==== @@ -30,6 +30,9 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." */ +#include +#include + #include "config.h" #include "../os_specific.h" #include "snd_freebsd.h" @@ -37,11 +40,52 @@ extern int linux_rand_init(void); extern void linux_rand_fini(void); +/* Per-interface info */ +struct snd_ifinfo { + struct list_head list; + char name[32]; + int ifidx; + int icmps; +}; +static DEFINE_LIST_HEAD(ifaces); + +int +snd_handle_iface(const char *ifname, int ifidx) +{ + struct snd_ifinfo *p; + + if ((p = malloc(sizeof (*p))) == NULL) { + APPLOG_NOMEM(); + return (-1); + } + memset(p, 0, sizeof (*p)); + + snprintf(p->name, sizeof (p->name), "%s", ifname); + p->ifidx = ifidx; + p->icmps = -1; + list_add_tail(&p->list, &ifaces); + + return (0); +} + int +freebsd_snd_init(void) +{ + + if (list_empty(&ifaces)) { + applog(LOG_ERR, "SEND must be active on at least one iface"); + return (-1); + } + return (0); +} + +int os_specific_init(void) { - if (linux_rand_init() < 0 || + if (linux_rand_init() < 0 || freebsd_snd_init() < 0) { +#if 0 freebsd_netgraph_init() < 0) { +#endif return (-1); } return (0); ==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/sendd.c#6 (text+ko) ==== @@ -92,10 +92,10 @@ if (cfd != -1) FD_SET(cfd, fds); FD_SET(icmps, fds); FD_SET(ctlfd, fds); + /* Routing socket instead of using netgraph for ND/SeND */ + FD_SET(snds, fds); /* os_specific_add_fds(fds, &maxfd); */ /* snd_add_fds(fds, &maxfd); */ - /* Routing socket instead of using netgraph for ND/SeND */ - FD_SET(snds, fds); tv = get_next_wait(tvb); if (select(maxfd + 1, fds, NULL, NULL, tv) < 0) { @@ -256,7 +256,9 @@ snd_ra_init() < 0 || snd_certpath_init() < 0 || snd_addr_init() < 0 || +#if 0 os_specific_init() < 0 || +#endif snd_sigmeth_init() < 0 || snd_replace_non_cga_linklocals() < 0 || (ctlfd = snd_ctl_init()) < 0) {