PERFORCE change 165488 for review

Ana Kukec anchie at FreeBSD.org
Tue Jun 30 21:59:51 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165488

Change 165488 by anchie at anchie_malimis on 2009/06/30 21:58:56

	Changes introduced in order to remove the netgraph usage - added
	new per-interaface packet data structure: snd_ifinfo.	

Affected files ...

.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#2 edit
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/sendd.c#6 edit

Differences ...

==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#2 (text+ko) ====

@@ -30,6 +30,9 @@
  *  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  */
 
+#include <applog.h>
+#include <list.h>
+
 #include "config.h"
 #include "../os_specific.h"
 #include "snd_freebsd.h"
@@ -37,11 +40,52 @@
 extern int linux_rand_init(void);
 extern void linux_rand_fini(void);
 
+/* Per-interface info */
+struct snd_ifinfo {
+	struct list_head list;
+	char            name[32];
+	int             ifidx;
+	int             icmps;
+};
+static DEFINE_LIST_HEAD(ifaces);
+
+int
+snd_handle_iface(const char *ifname, int ifidx)
+{
+	struct snd_ifinfo *p;
+
+	if ((p = malloc(sizeof (*p))) == NULL) {
+		APPLOG_NOMEM();
+		return (-1);
+	}
+	memset(p, 0, sizeof (*p));
+
+	snprintf(p->name, sizeof (p->name), "%s", ifname);
+	p->ifidx = ifidx;
+	p->icmps = -1;
+	list_add_tail(&p->list, &ifaces);
+
+	return (0);
+}
+
 int
+freebsd_snd_init(void)
+{
+
+        if (list_empty(&ifaces)) {
+                applog(LOG_ERR, "SEND must be active on at least one iface");
+                return (-1);
+        }
+	return (0);
+}
+
+int
 os_specific_init(void)
 {
-	if (linux_rand_init() < 0 ||
+	if (linux_rand_init() < 0 || freebsd_snd_init() < 0) {
+#if 0
 	    freebsd_netgraph_init() < 0) {
+#endif
 		return (-1);
 	}
 	return (0);

==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/sendd.c#6 (text+ko) ====

@@ -92,10 +92,10 @@
 		if (cfd != -1) FD_SET(cfd, fds);
 		FD_SET(icmps, fds);
 		FD_SET(ctlfd, fds);
+		/* Routing socket instead of using netgraph for ND/SeND */
+		FD_SET(snds, fds);
 		/* os_specific_add_fds(fds, &maxfd); */
 		/* snd_add_fds(fds, &maxfd); */
-		/* Routing socket instead of using netgraph for ND/SeND */
-		FD_SET(snds, fds);
 
 		tv = get_next_wait(tvb);
 		if (select(maxfd + 1, fds, NULL, NULL, tv) < 0) {
@@ -256,7 +256,9 @@
 	    snd_ra_init() < 0 ||
 	    snd_certpath_init() < 0 ||
 	    snd_addr_init() < 0 ||
+#if 0
 	    os_specific_init() < 0 ||
+#endif
 	    snd_sigmeth_init() < 0 ||
 	    snd_replace_non_cga_linklocals() < 0 ||
 	    (ctlfd = snd_ctl_init()) < 0) {


More information about the p4-projects mailing list