Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec style



details:   https://anonhg.NetBSD.org/src/rev/7fcbf256a3dd
branches:  trunk
changeset: 322112:7fcbf256a3dd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Apr 18 06:43:10 2018 +0000

description:
style

diffstat:

 sys/netipsec/ipsec_output.c |  31 ++++++++++++++++---------------
 sys/netipsec/xform_ipip.c   |  22 +++++++++++-----------
 2 files changed, 27 insertions(+), 26 deletions(-)

diffs (200 lines):

diff -r 469f79204391 -r 7fcbf256a3dd sys/netipsec/ipsec_output.c
--- a/sys/netipsec/ipsec_output.c       Wed Apr 18 06:37:17 2018 +0000
+++ b/sys/netipsec/ipsec_output.c       Wed Apr 18 06:43:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec_output.c,v 1.71 2018/03/05 11:50:25 maxv Exp $   */
+/*     $NetBSD: ipsec_output.c,v 1.72 2018/04/18 06:52:35 maxv Exp $   */
 
 /*
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.71 2018/03/05 11:50:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.72 2018/04/18 06:52:35 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -89,7 +89,7 @@
  * processed this packet.
  */
 static int
-ipsec_register_done(struct mbuf *m, int * error)
+ipsec_register_done(struct mbuf *m, int *error)
 {
        struct m_tag *mtag;
 
@@ -144,14 +144,14 @@
        struct secasindex *saidx;
        int error;
 #ifdef INET
-       struct ip * ip;
+       struct ip *ip;
 #endif
 #ifdef INET6
-       struct ip6_hdr * ip6;
+       struct ip6_hdr *ip6;
 #endif
-       struct mbuf * mo;
+       struct mbuf *mo;
        struct udphdr *udp = NULL;
-       uint64_t * data = NULL;
+       uint64_t *data = NULL;
        int hlen, roff;
 
        IPSEC_SPLASSERT_SOFTNET("ipsec_process_done");
@@ -175,7 +175,7 @@
                        IPSECLOG(LOG_DEBUG,
                            "failed to inject %u byte UDP for SA %s/%08lx\n",
                            hlen, ipsec_address(&saidx->dst, buf, sizeof(buf)),
-                           (u_long) ntohl(sav->spi));
+                           (u_long)ntohl(sav->spi));
                        error = ENOBUFS;
                        goto bad;
                }
@@ -196,10 +196,12 @@
                udp->uh_ulen = htons(m->m_pkthdr.len - (ip->ip_hl << 2));
        }
 
+       /*
+        * Fix the header length, for AH processing.
+        */
        switch (saidx->dst.sa.sa_family) {
 #ifdef INET
        case AF_INET:
-               /* Fix the header length, for AH processing. */
                ip = mtod(m, struct ip *);
                ip->ip_len = htons(m->m_pkthdr.len);
                if (sav->natt_type != 0)
@@ -208,7 +210,6 @@
 #endif
 #ifdef INET6
        case AF_INET6:
-               /* Fix the header length, for AH processing. */
                if (m->m_pkthdr.len < sizeof(struct ip6_hdr)) {
                        error = ENXIO;
                        goto bad;
@@ -260,9 +261,9 @@
        }
 
        /*
-        * We're done with IPsec processing,
-        * mark that we have already processed the packet
-        * transmit it packet using the appropriate network protocol (IP or IPv6).
+        * We're done with IPsec processing, mark the packet as processed,
+        * and transmit it using the appropriate network protocol
+        * (IPv4/IPv6).
         */
 
        if (ipsec_register_done(m, &error) < 0)
@@ -412,8 +413,8 @@
                    ipsec_get_reqlevel(isr));
                isr = isr->next;
                /*
-                * No more rules to apply, return NULL isr and no error
-                * It can happen when the last rules are USE rules
+                * No more rules to apply, return NULL isr and no error.
+                * It can happen when the last rules are USE rules.
                 */
                if (isr == NULL) {
                        *ret = NULL;
diff -r 469f79204391 -r 7fcbf256a3dd sys/netipsec/xform_ipip.c
--- a/sys/netipsec/xform_ipip.c Wed Apr 18 06:37:17 2018 +0000
+++ b/sys/netipsec/xform_ipip.c Wed Apr 18 06:43:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipip.c,v 1.63 2018/02/15 10:41:51 maxv Exp $     */
+/*     $NetBSD: xform_ipip.c,v 1.64 2018/04/18 06:43:10 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.63 2018/02/15 10:41:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.64 2018/04/18 06:43:10 maxv Exp $");
 
 /*
  * IP-inside-IP processing
@@ -268,7 +268,7 @@
                                            AF_INET)
                                                continue;
 
-                                       sin = (struct sockaddr_in *) ifa->ifa_addr;
+                                       sin = (struct sockaddr_in *)ifa->ifa_addr;
 
                                        if (sin->sin_addr.s_addr ==
                                            ip4->ip_src.s_addr) {
@@ -278,7 +278,7 @@
                                                return;
                                        }
                                }
-#endif /* INET */
+#endif
 
 #ifdef INET6
                                if (ip6) {
@@ -286,7 +286,7 @@
                                            AF_INET6)
                                                continue;
 
-                                       sin6 = (struct sockaddr_in6 *) ifa->ifa_addr;
+                                       sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
 
                                        if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &ip6->ip6_src)) {
                                                pserialize_read_exit(s);
@@ -296,7 +296,7 @@
                                        }
 
                                }
-#endif /* INET6 */
+#endif
                        }
                }
                pserialize_read_exit(s);
@@ -355,7 +355,7 @@
                        DPRINTF(("%s: unspecified tunnel endpoint "
                            "address in SA %s/%08lx\n", __func__,
                            ipsec_address(&saidx->dst, buf, sizeof(buf)),
-                           (u_long) ntohl(sav->spi)));
+                           (u_long)ntohl(sav->spi)));
                        IPIP_STATINC(IPIP_STAT_UNSPEC);
                        error = EINVAL;
                        goto bad;
@@ -411,7 +411,7 @@
                        ipo->ip_p = IPPROTO_IPV6;
                        ipo->ip_off = 0;
                }
-#endif /* INET6 */
+#endif
                else {
                        goto nofamily;
                }
@@ -430,7 +430,7 @@
                        DPRINTF(("%s: unspecified tunnel endpoint "
                            "address in SA %s/%08lx\n", __func__,
                            ipsec_address(&saidx->dst, buf, sizeof(buf)),
-                           (u_long) ntohl(sav->spi)));
+                           (u_long)ntohl(sav->spi)));
                        IPIP_STATINC(IPIP_STAT_UNSPEC);
                        error = ENOBUFS;
                        goto bad;
@@ -479,7 +479,7 @@
                        /* This is really IPVERSION. */
                        ip6o->ip6_nxt = IPPROTO_IPIP;
                } else
-#endif /* INET */
+#endif
                if (tp == (IPV6_VERSION >> 4)) {
                        uint32_t itos32;
 
@@ -496,7 +496,7 @@
 
                otos = 0;
                ip_ecn_ingress(ECN_ALLOWED, &otos, &itos);
-               ip6o->ip6_flow |= htonl((uint32_t) otos << 20);
+               ip6o->ip6_flow |= htonl((uint32_t)otos << 20);
                break;
 #endif /* INET6 */
 



Home | Main Index | Thread Index | Old Index