Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 no need for ip6_id.c...



details:   https://anonhg.NetBSD.org/src/rev/d83a3ec44e98
branches:  trunk
changeset: 953420:d83a3ec44e98
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 08 18:22:16 2021 +0000

description:
no need for ip6_id.c...

diffstat:

 sys/netinet6/files.netinet6 |   3 +-
 sys/netinet6/ip6_id.c       |  49 ---------------------------------------------
 sys/netinet6/ip6_var.h      |  20 ++++++++++++++---
 3 files changed, 17 insertions(+), 55 deletions(-)

diffs (112 lines):

diff -r 9ba091dcd2ea -r d83a3ec44e98 sys/netinet6/files.netinet6
--- a/sys/netinet6/files.netinet6       Mon Mar 08 18:17:27 2021 +0000
+++ b/sys/netinet6/files.netinet6       Mon Mar 08 18:22:16 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.netinet6,v 1.13 2018/02/08 11:34:35 maxv Exp $
+#      $NetBSD: files.netinet6,v 1.14 2021/03/08 18:22:16 christos Exp $
 
 defflag        opt_inet6.h     RFC2292 
 
@@ -17,7 +17,6 @@
 file   netinet6/in6_src.c              inet6
 file   netinet6/ip6_flow.c             inet6 & gateway
 file   netinet6/ip6_forward.c          inet6
-file   netinet6/ip6_id.c               inet6
 file   netinet6/ip6_input.c            inet6
 file   netinet6/ip6_mroute.c           inet6
 file   netinet6/ip6_output.c           inet6
diff -r 9ba091dcd2ea -r d83a3ec44e98 sys/netinet6/ip6_id.c
--- a/sys/netinet6/ip6_id.c     Mon Mar 08 18:17:27 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*     $NetBSD: ip6_id.c,v 1.21 2021/03/07 15:03:32 christos Exp $     */
-
-/*-
- * Copyright (c) 2020 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_id.c,v 1.21 2021/03/07 15:03:32 christos Exp $");
-
-#include <sys/types.h>
-#include <sys/cprng.h>
-
-#include <netinet6/ip6_var.h>
-
-uint32_t
-ip6_randomid(void)
-{
-
-       return cprng_fast32();
-}
-
-uint32_t
-ip6_randomflowlabel(void)
-{
-
-       return cprng_fast32() & 0xfffff;
-}
diff -r 9ba091dcd2ea -r d83a3ec44e98 sys/netinet6/ip6_var.h
--- a/sys/netinet6/ip6_var.h    Mon Mar 08 18:17:27 2021 +0000
+++ b/sys/netinet6/ip6_var.h    Mon Mar 08 18:22:16 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_var.h,v 1.88 2021/03/07 15:01:35 christos Exp $    */
+/*     $NetBSD: ip6_var.h,v 1.89 2021/03/08 18:22:16 christos Exp $    */
 /*     $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $        */
 
 /*
@@ -228,6 +228,7 @@
 #ifdef _KERNEL
 
 #include <sys/protosw.h>
+#include <sys/cprng.h>
 
 /*
  * Auxiliary attributes of incoming IPv6 packets, which is initialized when we
@@ -370,10 +371,21 @@
 int    ip6_get_membership(const struct sockopt *, struct ifnet **,
            struct psref *, void *, size_t);
 
-u_int32_t ip6_randomid(void);
-u_int32_t ip6_randomflowlabel(void);
+static __inline uint32_t
+ip6_randomid(void)
+{
+
+       return cprng_fast32();
+}
 
-static inline bool
+static __inline uint32_t
+ip6_randomflowlabel(void)
+{
+
+       return cprng_fast32() && 0xfffff;
+}
+
+static __inline bool
 ip6_dad_enabled(void)
 {
 



Home | Main Index | Thread Index | Old Index