Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Move code that is conditional on options INET6 i...
details: https://anonhg.NetBSD.org/src/rev/4385ad6aa9a9
branches: trunk
changeset: 336723:4385ad6aa9a9
user: rtr <rtr%NetBSD.org@localhost>
date: Sat Mar 14 02:08:16 2015 +0000
description:
Move code that is conditional on options INET6 into #ifdef INET6.
* Re-organize some variable declarations to limit #ifdef's.
* Move INET and INET6 code into respective switch cases to simplify
#ifdef INET6.
No intended functional change.
diffstat:
sys/netinet/tcp_input.c | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
diffs (77 lines):
diff -r 4a52e1a3ee85 -r 4385ad6aa9a9 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c Fri Mar 13 22:48:41 2015 +0000
+++ b/sys/netinet/tcp_input.c Sat Mar 14 02:08:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_input.c,v 1.336 2015/02/14 12:57:53 he Exp $ */
+/* $NetBSD: tcp_input.c,v 1.337 2015/03/14 02:08:16 rtr Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.336 2015/02/14 12:57:53 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.337 2015/03/14 02:08:16 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -3191,9 +3191,11 @@
MD5_CTX ctx;
struct ip *ip;
struct ipovly *ipovly;
+#ifdef INET6
struct ip6_hdr *ip6;
+ struct ip6_hdr_pseudo ip6pseudo;
+#endif /* INET6 */
struct ippseudo ippseudo;
- struct ip6_hdr_pseudo ip6pseudo;
struct tcphdr th0;
int l, tcphdrlen;
@@ -3204,20 +3206,8 @@
switch (mtod(m, struct ip *)->ip_v) {
case 4:
+ MD5Init(&ctx);
ip = mtod(m, struct ip *);
- ip6 = NULL;
- break;
- case 6:
- ip = NULL;
- ip6 = mtod(m, struct ip6_hdr *);
- break;
- default:
- return (-1);
- }
-
- MD5Init(&ctx);
-
- if (ip) {
memset(&ippseudo, 0, sizeof(ippseudo));
ipovly = (struct ipovly *)ip;
ippseudo.ippseudo_src = ipovly->ih_src;
@@ -3226,7 +3216,11 @@
ippseudo.ippseudo_p = IPPROTO_TCP;
ippseudo.ippseudo_len = htons(m->m_pkthdr.len - thoff);
MD5Update(&ctx, (char *)&ippseudo, sizeof(ippseudo));
- } else {
+ break;
+#if INET6
+ case 6:
+ MD5Init(&ctx);
+ ip6 = mtod(m, struct ip6_hdr *);
memset(&ip6pseudo, 0, sizeof(ip6pseudo));
ip6pseudo.ip6ph_src = ip6->ip6_src;
in6_clearscope(&ip6pseudo.ip6ph_src);
@@ -3235,6 +3229,10 @@
ip6pseudo.ip6ph_len = htons(m->m_pkthdr.len - thoff);
ip6pseudo.ip6ph_nxt = IPPROTO_TCP;
MD5Update(&ctx, (char *)&ip6pseudo, sizeof(ip6pseudo));
+ break;
+#endif /* INET6 */
+ default:
+ return (-1);
}
th0 = *th;
Home |
Main Index |
Thread Index |
Old Index