PERFORCE change 166137 for review
Ana Kukec
anchie at FreeBSD.org
Wed Jul 15 16:38:38 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166137
Change 166137 by anchie at anchie_malimis on 2009/07/15 16:38:14
Pass mbuf containing SEND message to if_output().
Affected files ...
.. //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#8 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#15 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#16 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.h#15 edit
Differences ...
==== //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#8 (text+ko) ====
@@ -506,7 +506,6 @@
info.rti_info[RTAX_DST]->sa_family >= AF_MAX ||
(info.rti_info[RTAX_GATEWAY] != NULL &&
info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) {
- printf("EINVAL 3");
senderr(EINVAL);
}
}
@@ -525,7 +524,12 @@
case RTM_SND:
printf("RTM_SND!");
-
+ m_adj(m, sizeof (struct rt_msghdr));
+ printf("rtm->rtm_index = %d\n", rtm->rtm_index);
+ ifp = ifnet_byindex(rtm->rtm_index);
+ if (ifp)
+ send_output_hook(m, ifp, SND_OUT);
+ break;
case RTM_ADD:
if (info.rti_info[RTAX_GATEWAY] == NULL)
senderr(EINVAL);
==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#15 (text+ko) ====
@@ -113,8 +113,8 @@
static struct sockaddr_in6 all1_sa;
-int (*send_input_hook)(struct mbuf*, struct ifnet *, int, int);
-int (*send_output_hook)(void);
+int (*send_input_hook)(struct mbuf *, struct ifnet *, int, int);
+int (*send_output_hook)(struct mbuf *, struct ifnet *, int);
static int nd6_is_new_addr_neighbor __P((struct sockaddr_in6 *,
struct ifnet *));
@@ -1958,12 +1958,11 @@
*/
if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
- printf("%s %d: if_output()...\n", __FUNCTION__, __LINE__);
return ((*ifp->if_output)(origifp, m, (struct sockaddr *)dst,
NULL));
}
+ error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, NULL);
printf("%s %d: nakon if_output()\n", __FUNCTION__, __LINE__);
- error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, NULL);
}
return (error);
==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#16 (text+ko) ====
@@ -4,24 +4,40 @@
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/mbuf.h>
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+
#include <net/route.h>
+#include <net/if.h>
#include <netinet6/send.h>
+#include <netinet6/ip6_var.h>
static int
-send_output-ok(void)
+send_output(struct mbuf *m, struct ifnet *ifp, int in)
{
+ struct ip6_hdr *ip6;
+
+ printf("send_output\n");
/*
- * Receive incoming (SEND-protected) or outgoing traffic (SEND-validated)
- * from the SEND user space application.
+ * Receive incoming (SEND-protected) or outgoing traffic
+ * (SEND-validated) from the SEND user space application.
* Outgoing packets are sent out using if_output().
- */
+ */
+
+ ip6 = mtod(m, struct ip6_hdr *);
+ struct in6_addr dst = ip6->ip6_dst;
- return (0);
+ /*
+ * From nd6.c: nd6_output_lle().
+ * ToFix: kernel panic: Duplicate free of item (mbuf).
+ */
+ return (*ifp->if_output)(ifp, m, (struct sockaddr *)&dst, NULL);
}
static int
==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.h#15 (text+ko) ====
@@ -1,6 +1,6 @@
/* send.c */
extern int (*send_input_hook)(struct mbuf *, struct ifnet *, int, int);
-extern int (*send_output_hook)(void);
+extern int (*send_output_hook)(struct mbuf *, struct ifnet *, int);
/* Message formats for messages from ND to applications (i.e. sendd) via the
* routing socket. These messages are appended to an if_announcemsghdr
More information about the p4-projects
mailing list