Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec Remove broken MROUTING code, rename ipo->ip4, a...



details:   https://anonhg.NetBSD.org/src/rev/2570937f2a11
branches:  trunk
changeset: 829862:2570937f2a11
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Feb 15 10:41:51 2018 +0000

description:
Remove broken MROUTING code, rename ipo->ip4, and simplify.

diffstat:

 sys/netipsec/xform_ipip.c |  35 +++++++++--------------------------
 1 files changed, 9 insertions(+), 26 deletions(-)

diffs (103 lines):

diff -r d4beee0e7718 -r 2570937f2a11 sys/netipsec/xform_ipip.c
--- a/sys/netipsec/xform_ipip.c Thu Feb 15 10:28:49 2018 +0000
+++ b/sys/netipsec/xform_ipip.c Thu Feb 15 10:41:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipip.c,v 1.62 2018/02/15 10:28:49 maxv Exp $     */
+/*     $NetBSD: xform_ipip.c,v 1.63 2018/02/15 10:41:51 maxv Exp $     */
 /*     $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
 /*     $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.62 2018/02/15 10:28:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.63 2018/02/15 10:41:51 maxv Exp $");
 
 /*
  * IP-inside-IP processing
@@ -74,10 +74,6 @@
 
 #include <netipsec/ipip_var.h>
 
-#ifdef MROUTING
-#include <netinet/ip_mroute.h>
-#endif
-
 #ifdef INET6
 #include <netinet/ip6.h>
 #include <netipsec/ipsec6.h>
@@ -130,7 +126,7 @@
        register struct ifnet *ifp;
        register struct ifaddr *ifa;
        pktqueue_t *pktq = NULL;
-       struct ip *ipo;
+       struct ip *ip4 = NULL;
 #ifdef INET6
        register struct sockaddr_in6 *sin6;
        struct ip6_hdr *ip6 = NULL;
@@ -172,23 +168,11 @@
                }
        }
 
-       ipo = mtod(m, struct ip *);
-
-#ifdef MROUTING
-       /* XXX: DEAD AND BROKEN! */
-       if (ipo->ip_v == IPVERSION && ipo->ip_p == IPPROTO_IPV4) {
-               if (IN_MULTICAST(((struct ip *)((char *)ipo + iphlen))->ip_dst.s_addr)) {
-                       ipip_mroute_input(m, iphlen);
-                       return;
-               }
-       }
-#endif
-
        /* Keep outer ecn field. */
        switch (v >> 4) {
 #ifdef INET
        case 4:
-               otos = ipo->ip_tos;
+               otos = mtod(m, struct ip *)->ip_tos;
                break;
 #endif
 #ifdef INET6
@@ -254,18 +238,17 @@
        switch (v >> 4) {
 #ifdef INET
        case 4:
-               ipo = mtod(m, struct ip *);
-               ip_ecn_egress(ip4_ipsec_ecn, &otos, &ipo->ip_tos);
+               ip4 = mtod(m, struct ip *);
+               ip_ecn_egress(ip4_ipsec_ecn, &otos, &ip4->ip_tos);
                break;
 #endif
 #ifdef INET6
        case 6:
-               ipo = NULL;
                ip6 = mtod(m, struct ip6_hdr *);
                itos = (ntohl(ip6->ip6_flow) >> 20) & 0xff;
                ip_ecn_egress(ip6_ipsec_ecn, &otos, &itos);
                ip6->ip6_flow &= ~htonl(0xff << 20);
-               ip6->ip6_flow |= htonl((uint32_t) itos << 20);
+               ip6->ip6_flow |= htonl((uint32_t)itos << 20);
                break;
 #endif
        default:
@@ -280,7 +263,7 @@
                IFNET_READER_FOREACH(ifp) {
                        IFADDR_READER_FOREACH(ifa, ifp) {
 #ifdef INET
-                               if (ipo) {
+                               if (ip4) {
                                        if (ifa->ifa_addr->sa_family !=
                                            AF_INET)
                                                continue;
@@ -288,7 +271,7 @@
                                        sin = (struct sockaddr_in *) ifa->ifa_addr;
 
                                        if (sin->sin_addr.s_addr ==
-                                           ipo->ip_src.s_addr) {
+                                           ip4->ip_src.s_addr) {
                                                pserialize_read_exit(s);
                                                IPIP_STATINC(IPIP_STAT_SPOOF);
                                                m_freem(m);



Home | Main Index | Thread Index | Old Index