summaryrefslogtreecommitdiffstats
path: root/lib/libnetgraph/internal.h
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-11-14 08:09:01 +0000
committerharti <harti@FreeBSD.org>2003-11-14 08:09:01 +0000
commit5afef437ec54d7ed580bdaa624ab0b12f3ee34cc (patch)
tree4d988635293cd2327c4c416a4d2f0a7470cb6301 /lib/libnetgraph/internal.h
parent1f9203cd5b28f620e81b7be1684d19b587cf56c3 (diff)
downloadFreeBSD-src-5afef437ec54d7ed580bdaa624ab0b12f3ee34cc.zip
FreeBSD-src-5afef437ec54d7ed580bdaa624ab0b12f3ee34cc.tar.gz
Use the new defines that include the trailing '\0' in the code.
Replace occurences of the magic constant 2 with an offsetof macro call that computes the size of the leading members of the sockaddr. Use strlcpy instead of sprintf where appropriate. Document the new changes in the man page.
Diffstat (limited to 'lib/libnetgraph/internal.h')
-rw-r--r--lib/libnetgraph/internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libnetgraph/internal.h b/lib/libnetgraph/internal.h
index 99b5ecc..0c947e5 100644
--- a/lib/libnetgraph/internal.h
+++ b/lib/libnetgraph/internal.h
@@ -46,6 +46,7 @@
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/linker.h>
+#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
@@ -55,6 +56,10 @@
#include <ctype.h>
#include <err.h>
+/* the 'sockaddr overhead' for a netgraph address. This is everything before
+ * the string that constitutes the address. */
+#define NGSA_OVERHEAD (offsetof(struct sockaddr_ng, sg_data))
+
extern int _gNgDebugLevel;
extern void (*_NgLog)(const char *fmt, ...);
OpenPOWER on IntegriCloud