summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2021-02-17 22:32:04 +0000
committerchristos <christos@NetBSD.org>2021-02-17 22:32:04 +0000
commit32f6d56abd9ec4fdb65ca89352f5b9775f7bc5ee (patch)
tree4f17cf36a15a537591268e2d0b3dad414ca9259a /sys/netinet
parent23754a6e6cf98a6df90b2f47af1dd0251cfbbdc8 (diff)
- pass the alignment instead of the mask (as Roy asked and to match the
other macro) - use alignof to determine that alignment and CTASSERT what we expect - remove unused macros
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/icmp_private.h3
-rw-r--r--sys/netinet/igmp_var.h4
-rw-r--r--sys/netinet/ip_private.h5
-rw-r--r--sys/netinet/tcp_private.h5
-rw-r--r--sys/netinet/udp_private.h5
5 files changed, 11 insertions, 11 deletions
diff --git a/sys/netinet/icmp_private.h b/sys/netinet/icmp_private.h
index 447e8500b6c..183c38848c0 100644
--- a/sys/netinet/icmp_private.h
+++ b/sys/netinet/icmp_private.h
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp_private.h,v 1.4 2021/02/14 20:58:35 christos Exp $ */
+/* $NetBSD: icmp_private.h,v 1.5 2021/02/17 22:32:04 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -44,7 +44,6 @@ extern percpu_t *icmpstat_percpu;
#define ICMP_STATINC(x) _NET_STATINC(icmpstat_percpu, x)
-#define ICMP_HDR_ALIGNMENT 3
#endif /* _KERNEL_ */
#endif /* !_NETINET_ICMP_PRIVATE_H_ */
diff --git a/sys/netinet/igmp_var.h b/sys/netinet/igmp_var.h
index f5a812100f4..fd0413b9388 100644
--- a/sys/netinet/igmp_var.h
+++ b/sys/netinet/igmp_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: igmp_var.h,v 1.26 2021/02/14 20:58:35 christos Exp $ */
+/* $NetBSD: igmp_var.h,v 1.27 2021/02/17 22:32:04 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -105,8 +105,6 @@
*/
#define IGMP_RANDOM_DELAY(X) (cprng_fast32() % (X) + 1)
-#define IGMP_HDR_ALIGNMENT 3
-
void igmp_init(void);
void igmp_input(struct mbuf *, int, int);
int igmp_joingroup(struct in_multi *);
diff --git a/sys/netinet/ip_private.h b/sys/netinet/ip_private.h
index 790ea188955..8fd927fd593 100644
--- a/sys/netinet/ip_private.h
+++ b/sys/netinet/ip_private.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_private.h,v 1.4 2021/02/14 20:58:35 christos Exp $ */
+/* $NetBSD: ip_private.h,v 1.5 2021/02/17 22:32:04 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -43,7 +43,8 @@ extern percpu_t *ipstat_percpu;
#define IP_STATINC(x) _NET_STATINC(ipstat_percpu, x)
#define IP_STATDEC(x) _NET_STATDEC(ipstat_percpu, x)
-#define IP_HDR_ALIGNMENT 3
+#define IP_HDR_ALIGNMENT __alignof(struct ip)
+__CTASSERT(IP_HDR_ALIGNMENT == 4);
#endif /* _KERNEL */
#endif /* !_NETINET_IP_PRIVATE_H_ */
diff --git a/sys/netinet/tcp_private.h b/sys/netinet/tcp_private.h
index b4d1ebd7db5..0b85e8ed7da 100644
--- a/sys/netinet/tcp_private.h
+++ b/sys/netinet/tcp_private.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_private.h,v 1.4 2021/02/14 20:58:35 christos Exp $ */
+/* $NetBSD: tcp_private.h,v 1.5 2021/02/17 22:32:04 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -43,7 +43,8 @@ extern percpu_t *tcpstat_percpu;
#define TCP_STATINC(x) _NET_STATINC(tcpstat_percpu, x)
#define TCP_STATADD(x, v) _NET_STATADD(tcpstat_percpu, x, v)
-#define TCP_HDR_ALIGNMENT 3
+#define TCP_HDR_ALIGNMENT __alignof(struct tcphdr)
+__CTASSERT(TCP_HDR_ALIGNMENT == 4);
#endif /* _KERNEL */
#endif /* !_NETINET_TCP_PRIVATE_H_ */
diff --git a/sys/netinet/udp_private.h b/sys/netinet/udp_private.h
index 7ab6d132db8..283ec39ba0d 100644
--- a/sys/netinet/udp_private.h
+++ b/sys/netinet/udp_private.h
@@ -1,4 +1,4 @@
-/* $NetBSD: udp_private.h,v 1.4 2021/02/14 20:58:35 christos Exp $ */
+/* $NetBSD: udp_private.h,v 1.5 2021/02/17 22:32:04 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,8 @@ extern percpu_t *udpstat_percpu;
#define UDP_STATINC(x) _NET_STATINC(udpstat_percpu, x)
-#define UDP_HDR_ALIGNMENT 3
+#define UDP_HDR_ALIGNMENT __alignof(struct udphdr)
+__CTASSERT(UDP_HDR_ALIGNMENT == 2);
#endif /* _KERNEL */
#endif /* !_NETINET_UDP_PRIVATE_H_ */