PERFORCE change 167496 for review
Ana Kukec
anchie at FreeBSD.org
Wed Aug 19 09:21:12 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167496
Change 167496 by anchie at anchie_desnimis on 2009/08/19 09:20:46
Minor fixes.
Affected files ...
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/net.c#26 edit
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/proto.c#10 edit
Differences ...
==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/net.c#26 (text+ko) ====
@@ -85,6 +85,7 @@
u_char rtm_version;
u_char rtm_type;
int rtm_seq;
+ int in;
};
void snd_sock_read(struct snd_ifinfo *p);
@@ -150,8 +151,6 @@
pi = (struct snd_packet_info *)(b->head);
DBG(&dbg_snd, "Direction, %s", (pi->rtm_seq == RTM_SND_OUT) ? "SND_OUT" : "SND_IN");
- DBG(&dbg_snd, "rt_msghdr = %d, if_announcemsghdr = %d\n", sizeof (struct rt_msghdr), sizeof (struct if_announcemsghdr));
-
/* buffer starts with IPv6 hdr, roll back to include rtm header */
b->data -= sizeof (struct rt_msghdr);
b->len += sizeof (struct rt_msghdr);
@@ -176,9 +175,7 @@
if (rtm->rtm_flags & M_MCAST)
DBG(&dbg_snd, "M_MCAST!");
- DBG_HEXDUMP(&dbg_snd, "Sending back to kernel: ", rtm, rtm->rtm_msglen);
-
- if (send(sndsock, rtm, b->len, 0) < 0) {
+ if (send(sndsock, b->data, b->len, 0) < 0) {
DBG(&dbg_snd, "Failed to send routing message back to kernel.");
perror("Failed");
snd_put_buf(b);
@@ -286,9 +283,6 @@
goto done;
}
- DBG(&dbg_snd, "rtm->rtm_addrs = %x", rtm->rtm_addrs);
- DBG(&dbg_snd, "rtm->rtm_msglen = %d", rtm->rtm_msglen);
-
switch (rtm->rtm_type) {
case RTM_IFANNOUNCE:
/* XXX: Do we need this? */
@@ -308,11 +302,11 @@
DBG(&dbg_snd, "invalid pkt (not enough for rtm hedaer");
goto done;
}
-
pi->ifinfo = p;
+ pi->in = 1;
+ snd_recv_pkt(b, p->ifidx, SND_IN, pi);
+ break;
- snd_recv_pkt(b, p->ifidx, SND_IN);
- break;
case RTM_SND_OUT:
applog(LOG_ERR, "RTM_SND_OUT");
/* n = RTM hdr + ip6_hdr + icmp6len */
@@ -320,10 +314,9 @@
DBG(&dbg_snd, "invalid pkt (not enough for rtm header");
goto done;
}
-
pi->ifinfo = p;
-
- snd_recv_pkt(b, p->ifidx, SND_OUT);
+ pi->in = 0;
+ snd_recv_pkt(b, p->ifidx, SND_OUT, pi);
break;
}
break;
==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/proto.c#10 (text+ko) ====
@@ -657,15 +657,18 @@
DBG(&dbg, "%s pkt (%d bytes)", drop ? "dropping" : "delivering",
pi->b->len);
+#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);
}
void
+snd_recv_pkt(struct sbuff *b, int ifidx, int in, void *pkt)
#if 0
-snd_recv_pkt(struct sbuff *b, int ifidx, int in, void *pkt)
+snd_recv_pkt(struct sbuff *b, int ifidx, int in)
#endif
-snd_recv_pkt(struct sbuff *b, int ifidx, int in)
{
int tlen, drop = 0;
int changed = 0;
@@ -699,7 +702,7 @@
}
memset(pi, 0, sizeof (*pi));
pi->b = b;
- /* XXX: We don't need this anymore!! -> pi->os_pkt = pkt; */
+ pi->os_pkt = pkt;
pi->ifidx = ifidx;
/* Save packet start and len */
@@ -791,6 +794,7 @@
* to kernel through the input hook.
*/
/* os_specific_deliver_pkt(pkt, b, drop, changed); */
+ snd_deliver_pkt(pkt, b, drop, changed);
}
int
More information about the p4-projects
mailing list