PERFORCE change 182278 for review
Ana Kukec
anchie at FreeBSD.org
Wed Aug 11 22:52:02 UTC 2010
http://p4web.freebsd.org/@@182278?ac=10
Change 182278 by anchie at anchie_malimis on 2010/08/11 22:51:13
Further cleanup, as suggested by Bjoern.
Affected files ...
.. //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#7 edit
Differences ...
==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#7 (text+ko) ====
@@ -35,39 +35,21 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
-#include <arpa/inet.h>
-
#include <net/if.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
#include <netinet6/send.h>
#include <errno.h>
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
-
+#include "snd_freebsd.h"
+#include "../dbg.h"
+#include "../os_specific.h"
#include "../sendd_local.h"
-#include "../os_specific.h"
#include "../snd_proto.h"
-#include "../dbg.h"
-#include "snd_freebsd.h"
#include <applog.h>
#include <sbuff.h>
-static int icmp6sock = -1;
-static int sndsock = -1;
-
-#ifdef DEBUG
-static struct dlog_desc dbg = {
- .desc = "net",
- .ctx = SENDD_NAME
-};
-static char abuf[INET6_ADDRSTRLEN];
-#endif
+static int sndsock = -1;
/* Per-interface info */
struct snd_ifinfo {
@@ -76,6 +58,7 @@
int ifidx;
int snds;
};
+
static DEFINE_LIST_HEAD(ifaces);
/* Data packet meta data */
@@ -88,17 +71,7 @@
extern int linux_rand_init(void);
extern void linux_rand_fini(void);
-int
-os_specific_init(void)
-{
- if (linux_rand_init() < 0 || freebsd_snd_init() < 0) {
- return (-1);
- }
-
- return (0);
-}
-
-int
+static int
freebsd_snd_init(void)
{
if (list_empty(&ifaces)) {
@@ -109,7 +82,7 @@
if ((sndsock = socket(PF_INET6, SOCK_RAW, IPPROTO_SEND)) < 0) {
applog(LOG_ERR, "[%s:%d]: socket: %s", __func__, __LINE__,
strerror(errno));
- return(-1);
+ return (-1);
} else {
applog(LOG_ERR, "%s: SEND socket created: fd=%d", __func__, sndsock);
}
@@ -117,6 +90,16 @@
return (0);
}
+int
+os_specific_init(void)
+{
+ if (linux_rand_init() < 0 || freebsd_snd_init() < 0) {
+ return (-1);
+ }
+
+ return (0);
+}
+
void
os_specific_fini(void)
{
@@ -157,7 +140,7 @@
if ((b = snd_get_buf()) == NULL) {
goto done;
}
-
+
pi = sbuff_data(b);
sbuff_advance(b, sizeof (*pi));
@@ -224,7 +207,7 @@
{
struct snd_packet_info *pi;
struct sockaddr_send sendsrc;
-
+
if (drop) {
snd_put_buf(b);
return;
More information about the p4-projects
mailing list