Date: Sat, 4 Jul 2009 18:37:08 GMT From: Ana Kukec <anchie@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 165605 for review Message-ID: <200907041837.n64Ib8KN014768@repoman.freebsd.org>
index | next in thread | raw e-mail
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 <conf>] [-i <iface>] " + fprintf(stderr, "---> Usage: %s [-fV] [-c <conf>] [-i <iface>] " "[-l <log method>]\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);help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907041837.n64Ib8KN014768>
