Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Synchronize the code between raw_ip6.c<->icmp6.c<->raw_i...
details: https://anonhg.NetBSD.org/src/rev/63bfab6a09b3
branches: trunk
changeset: 321973:63bfab6a09b3
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Apr 12 07:28:10 2018 +0000
description:
Synchronize the code between raw_ip6.c<->icmp6.c<->raw_ip.c, so that it is
the same everywhere.
diffstat:
sys/netinet/raw_ip.c | 13 +++++++----
sys/netinet6/icmp6.c | 51 +++++++++++++++++++++++++++----------------------
sys/netinet6/raw_ip6.c | 46 ++++++++++++++++++++++++--------------------
3 files changed, 61 insertions(+), 49 deletions(-)
diffs (214 lines):
diff -r 4bb7aa18f0bf -r 63bfab6a09b3 sys/netinet/raw_ip.c
--- a/sys/netinet/raw_ip.c Thu Apr 12 06:49:39 2018 +0000
+++ b/sys/netinet/raw_ip.c Thu Apr 12 07:28:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_ip.c,v 1.173 2018/04/12 06:49:39 maxv Exp $ */
+/* $NetBSD: raw_ip.c,v 1.174 2018/04/12 07:28:10 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.173 2018/04/12 06:49:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.174 2018/04/12 07:28:10 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -199,11 +199,13 @@
if (!in_nullhost(inp->inp_faddr) &&
!in_hosteq(inp->inp_faddr, ip->ip_src))
continue;
- if (last == NULL)
+
+ if (last == NULL) {
;
+ }
#if defined(IPSEC)
else if (ipsec_used && ipsec_in_reject(m, last)) {
- /* do not inject data to pcb */
+ /* do not inject data into pcb */
}
#endif
else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
@@ -211,6 +213,7 @@
n);
opts = NULL;
}
+
last = inp;
}
@@ -218,7 +221,7 @@
if (ipsec_used && last != NULL && ipsec_in_reject(m, last)) {
m_freem(m);
IP_STATDEC(IP_STAT_DELIVERED);
- /* do not inject data to pcb */
+ /* do not inject data into pcb */
} else
#endif
if (last != NULL) {
diff -r 4bb7aa18f0bf -r 63bfab6a09b3 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Thu Apr 12 06:49:39 2018 +0000
+++ b/sys/netinet6/icmp6.c Thu Apr 12 07:28:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.225 2018/04/12 06:49:39 maxv Exp $ */
+/* $NetBSD: icmp6.c,v 1.226 2018/04/12 07:28:10 maxv Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.225 2018/04/12 06:49:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.226 2018/04/12 07:28:10 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1965,7 +1965,7 @@
struct in6pcb *last = NULL;
struct sockaddr_in6 rip6src;
struct icmp6_hdr *icmp6;
- struct mbuf *opts = NULL;
+ struct mbuf *n, *opts = NULL;
IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6));
if (icmp6 == NULL) {
@@ -1995,31 +1995,36 @@
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
!IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
continue;
- if (in6p->in6p_icmp6filt
- && ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
- in6p->in6p_icmp6filt))
+ if (in6p->in6p_icmp6filt &&
+ ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
+ in6p->in6p_icmp6filt))
continue;
- if (last) {
- struct mbuf *n;
+
+ if (last == NULL) {
+ ;
+ }
#ifdef IPSEC
- if (!ipsec_used || !ipsec_in_reject(m, last))
+ else if (ipsec_used && ipsec_in_reject(m, last)) {
+ /* do not inject data into pcb */
+ }
#endif
- if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
- if (last->in6p_flags & IN6P_CONTROLOPTS)
- ip6_savecontrol(last, &opts, ip6, n);
- /* strip intermediate headers */
- m_adj(n, off);
- if (sbappendaddr(&last->in6p_socket->so_rcv,
- sin6tosa(&rip6src), n, opts) == 0) {
- soroverflow(last->in6p_socket);
- m_freem(n);
- if (opts)
- m_freem(opts);
- } else
- sorwakeup(last->in6p_socket);
- opts = NULL;
+ else if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+ if (last->in6p_flags & IN6P_CONTROLOPTS)
+ ip6_savecontrol(last, &opts, ip6, n);
+ /* strip intermediate headers */
+ m_adj(n, off);
+ if (sbappendaddr(&last->in6p_socket->so_rcv,
+ sin6tosa(&rip6src), n, opts) == 0) {
+ soroverflow(last->in6p_socket);
+ m_freem(n);
+ if (opts)
+ m_freem(opts);
+ } else {
+ sorwakeup(last->in6p_socket);
}
+ opts = NULL;
}
+
last = in6p;
}
diff -r 4bb7aa18f0bf -r 63bfab6a09b3 sys/netinet6/raw_ip6.c
--- a/sys/netinet6/raw_ip6.c Thu Apr 12 06:49:39 2018 +0000
+++ b/sys/netinet6/raw_ip6.c Thu Apr 12 07:28:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_ip6.c,v 1.167 2018/04/12 06:49:39 maxv Exp $ */
+/* $NetBSD: raw_ip6.c,v 1.168 2018/04/12 07:28:10 maxv Exp $ */
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.167 2018/04/12 06:49:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.168 2018/04/12 07:28:10 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@@ -149,7 +149,7 @@
struct in6pcb *in6p;
struct in6pcb *last = NULL;
struct sockaddr_in6 rip6src;
- struct mbuf *opts = NULL;
+ struct mbuf *n, *opts = NULL;
RIP6_STATINC(RIP6_STAT_IPACKETS);
@@ -189,29 +189,33 @@
continue;
}
}
- if (last) {
- struct mbuf *n;
+ if (last == NULL) {
+ ;
+ }
#ifdef IPSEC
- if (!ipsec_used || !ipsec_in_reject(m, last))
+ else if (ipsec_used && ipsec_in_reject(m, last)) {
+ /* do not inject data into pcb */
+ }
#endif
- if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
- if (last->in6p_flags & IN6P_CONTROLOPTS)
- ip6_savecontrol(last, &opts, ip6, n);
- /* strip intermediate headers */
- m_adj(n, *offp);
- if (sbappendaddr(&last->in6p_socket->so_rcv,
- sin6tosa(&rip6src), n, opts) == 0) {
- soroverflow(last->in6p_socket);
- m_freem(n);
- if (opts)
- m_freem(opts);
- RIP6_STATINC(RIP6_STAT_FULLSOCK);
- } else
- sorwakeup(last->in6p_socket);
- opts = NULL;
+ else if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+ if (last->in6p_flags & IN6P_CONTROLOPTS)
+ ip6_savecontrol(last, &opts, ip6, n);
+ /* strip intermediate headers */
+ m_adj(n, *offp);
+ if (sbappendaddr(&last->in6p_socket->so_rcv,
+ sin6tosa(&rip6src), n, opts) == 0) {
+ soroverflow(last->in6p_socket);
+ m_freem(n);
+ if (opts)
+ m_freem(opts);
+ RIP6_STATINC(RIP6_STAT_FULLSOCK);
+ } else {
+ sorwakeup(last->in6p_socket);
}
+ opts = NULL;
}
+
last = in6p;
}
Home |
Main Index |
Thread Index |
Old Index