PERFORCE change 166076 for review
Ana Kukec
anchie at FreeBSD.org
Tue Jul 14 10:44:21 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166076
Change 166076 by anchie at anchie_malimis on 2009/07/14 10:43:50
Preparation functions that return SEND messages back to kernel.
Affected files ...
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/net.c#17 edit
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-linux/rand.c#2 edit
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/proto.c#8 edit
Differences ...
==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/net.c#17 (text+ko) ====
@@ -86,7 +86,7 @@
/* Data packet meta data */
struct snd_packet_info {
struct snd_ifinfo *ifinfo;
- int direction;
+ int in;
};
void
@@ -124,6 +124,30 @@
}
void
+snd_deliver_pkt(void *p, struct sbuff *b, int drop, int changed)
+{
+ struct snd_packet_info *pi;
+ struct rt_msghdr *rtm;
+
+ if (drop) {
+ snd_put_buf(b);
+ return;
+ }
+ pi = (struct snd_packet_info *)(b->head);
+ DBG(&dbg_snd, "Direction, in = %d", pi->in);
+
+ /* buffer starts with IPv6 hdr, roll back to include rtm header */
+ b->data -= sizeof (struct rt_msghdr);
+ b->len += sizeof (struct rt_msghdr);
+
+ DBG(&dbg_snd, "%d bytes on %s", b->len, pi->ifinfo->name);
+
+ rtm = sbuff_data(b);
+ rtm->rtm_msglen = sizeof(struct rt_msghdr) + b->len;
+ DBG(&dbg_snd, "RTM_VERSION = %d", rtm->rtm_version);
+}
+
+void
snd_add_fds(fd_set *fds, int *maxfd, int sock)
{
struct snd_ifinfo *p;
@@ -193,7 +217,7 @@
{
struct rt_msghdr *rtm;
struct if_announcemsghdr *ifan;
- struct sbuff *b, *b1;
+ struct sbuff *b;
struct snd_packet_info *pi;
int n;
@@ -208,9 +232,8 @@
if (n < 0) {
applog(LOG_ERR, "%s: read: %s", __FUNCTION__, strerror(errno));
goto done;
- } else {
- applog(LOG_ERR, "%s: %d bytes read on routing socket.", __FUNCTION__, n);
- }
+ } else
+ DBG(&dbg_snd, "%d bytes received on routing socket.", n);
b->len = n;
@@ -242,6 +265,9 @@
goto done;
}
+ pi->ifinfo = p;
+ pi->in = SND_OUT;
+
snd_recv_pkt(b, p->ifidx, SND_OUT);
break;
}
==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-linux/rand.c#2 (text+ko) ====
@@ -119,6 +119,7 @@
int
linux_rand_init(void)
{
+ applog(LOG_ERR, "linux_rand_init");
if ((rand_buf = malloc(SND_RAND_BUFSIZ)) == NULL) {
applog(LOG_CRIT, "%s: no memory", __FUNCTION__);
return (-1);
==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/proto.c#8 (text+ko) ====
@@ -427,7 +427,10 @@
snd_put_cga_params(pi->params);
if (sig) free(sig);
pi->b->data = pi->start;
+#if 0
os_specific_deliver_pkt(pi->os_pkt, pi->b, drop, 1);
+#endif
+ snd_deliver_pkt(pi->os_pkt, pi->b, drop, 1);
free(pi);
}
@@ -749,7 +752,7 @@
/* skip all options */
sbuff_advance(b, b->len);
b->len = tlen;
- /*
+
if (!snd_is_lcl_cga(pi->cga, ifidx)) {
DBG(&dbg_snd, "outgoing: not CGA, dropping");
if (dad && IN6_IS_ADDR_LINKLOCAL(pi->cga)) {
@@ -758,7 +761,6 @@
}
goto drop;
}
- */
r = handle_outgoing(pi);
}
More information about the p4-projects
mailing list