From owner-p4-projects@FreeBSD.ORG Sat Jul 4 18:37:09 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id ED59D1065677; Sat, 4 Jul 2009 18:37:08 +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 A6EC51065670 for ; Sat, 4 Jul 2009 18:37:08 +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 7A4EF8FC1E for ; Sat, 4 Jul 2009 18:37:08 +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 n64Ib8IS014770 for ; Sat, 4 Jul 2009 18:37:08 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n64Ib8KN014768 for perforce@freebsd.org; Sat, 4 Jul 2009 18:37:08 GMT (envelope-from anchie@FreeBSD.org) Date: Sat, 4 Jul 2009 18:37:08 GMT Message-Id: <200907041837.n64Ib8KN014768@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 165605 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: Sat, 04 Jul 2009 18:37:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=165605 Change 165605 by anchie@anchie_malimis on 2009/07/04 18:36:59 Write information about the raw socket into snd_ifinfo structure. Affected files ... .. //depot/projects/soc2009/anchie_send/send_0.2/sendd/net.c#11 edit .. //depot/projects/soc2009/anchie_send/send_0.2/sendd/sendd.c#8 edit Differences ... ==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/net.c#11 (text+ko) ==== @@ -92,6 +92,7 @@ int snd_handle_iface(const char *ifname, int ifidx) { + applog(LOG_ERR, "snd_handle_iface"); struct snd_ifinfo *p; if ((p = malloc(sizeof (*p))) == NULL) { @@ -101,7 +102,9 @@ memset(p, 0, sizeof (*p)); snprintf(p->name, sizeof (p->name), "%s", ifname); + DBG(&dbg_snd, "snd_handle_iface -> p->name = %s", p->name); p->ifidx = ifidx; + DBG(&dbg_snd, "snd_handle_iface -> p->ifidx = %d", ifidx); p->snds = -1; list_add_tail(&p->list, &ifaces); @@ -109,14 +112,16 @@ } void -snd_add_fds(fd_set *fds, int *maxfd) +snd_add_fds(fd_set *fds, int *maxfd, int sock) { struct snd_ifinfo *p; list_for_each_entry(p, &ifaces, list) { + DBG(&dbg_snd, "*maxfd = %d, p->snds = %d", *maxfd, p->snds); *maxfd = *maxfd > p->snds ? *maxfd : p->snds; + p->snds = sock; + FD_SET(p->snds, fds); applog(LOG_ERR, "snds added to snd_ifinfo."); - FD_SET(p->snds, fds); } } @@ -128,6 +133,7 @@ applog(LOG_ERR, "SEND must be active on at least one iface"); return (-1); } + return (0); } @@ -335,6 +341,8 @@ applog(LOG_ERR, "%s: routing socket created.", __FUNCTION__); } + applog(LOG_ERR, "*icmp6sock = %d, *sndsock = %d", *icmp6sock, *sndsock); + v = 255; if (setsockopt(*icmp6sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &v, sizeof (v)) < 0) { @@ -361,4 +369,6 @@ __FUNCTION__, strerror(errno)); return (-1); } + + return (0); } ==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/sendd.c#8 (text+ko) ==== @@ -95,9 +95,10 @@ FD_SET(icmps, fds); FD_SET(ctlfd, fds); /* Routing socket instead of using netgraph for ND/SeND */ - FD_SET(snds, fds); + /* FD_SET(snds, fds); */ /* os_specific_add_fds(fds, &maxfd); */ - snd_add_fds(fds, &maxfd); + snd_add_fds(fds, &maxfd, snds); + DBG(&snd_dbg, "after snd_add_fds"); tv = get_next_wait(tvb); if (select(maxfd + 1, fds, NULL, NULL, tv) < 0) { @@ -162,7 +163,7 @@ { const char **lm = applog_get_methods(); - fprintf(stderr, "-> Usage: %s [-fV] [-c ] [-i ] " + fprintf(stderr, "---> Usage: %s [-fV] [-c ] [-i ] " "[-l ]\n", this); fprintf(stderr, " log methods: "); for (; *lm; lm++) { @@ -177,6 +178,8 @@ int r, c, icmps, snds, ctlfd, do_daemon = 1; char *cfile = SNDD_CONF_FILE; + icmps = snds = (int *) malloc(sizeof(int)); + #ifdef DEBUG if (applog_open(L_STDERR, SENDD_NAME) < 0) { exit(1);