Source-Changes-HG archive

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

[src/trunk]: src/sys correct signedness mixup in pointer passing. sync w/kame



details:   https://anonhg.NetBSD.org/src/rev/f46e567fee65
branches:  trunk
changeset: 536196:f46e567fee65
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Sep 11 02:41:19 2002 +0000

description:
correct signedness mixup in pointer passing.  sync w/kame

diffstat:

 sys/netinet/ip_input.c      |   8 ++++--
 sys/netinet/ip_var.h        |   4 +-
 sys/netinet/tcp_input.c     |   8 +++---
 sys/netinet6/ah_input.c     |   6 ++--
 sys/netinet6/esp_input.c    |   6 ++--
 sys/netinet6/frag6.c        |   6 ++--
 sys/netinet6/in6_ifattach.c |  14 ++++++------
 sys/netinet6/ip6_input.c    |  24 +++++++++++-----------
 sys/netinet6/ip6_output.c   |  12 +++++-----
 sys/netinet6/ip6_var.h      |   4 +-
 sys/netinet6/ipcomp_input.c |   6 ++--
 sys/netinet6/ipsec.c        |  48 ++++++++++++++++++++++----------------------
 sys/netinet6/ipsec.h        |   4 +-
 sys/netinet6/raw_ip6.c      |   8 +++---
 sys/netkey/keydb.h          |   4 +-
 15 files changed, 82 insertions(+), 80 deletions(-)

diffs (truncated from 640 to 300 lines):

diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet/ip_input.c    Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_input.c,v 1.155 2002/08/14 00:23:31 itojun Exp $    */
+/*     $NetBSD: ip_input.c,v 1.156 2002/09/11 02:41:19 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.155 2002/08/14 00:23:31 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.156 2002/09/11 02:41:19 itojun Exp $");
 
 #include "opt_gateway.h"
 #include "opt_pfil_hooks.h"
@@ -192,7 +192,7 @@
 int    ip_directedbcast = IPDIRECTEDBCAST;
 int    ip_allowsrcrt = IPALLOWSRCRT;
 int    ip_mtudisc = IPMTUDISC;
-u_int  ip_mtudisc_timeout = IPMTUDISCTIMEOUT;
+int    ip_mtudisc_timeout = IPMTUDISCTIMEOUT;
 #ifdef DIAGNOSTIC
 int    ipprintfs = 0;
 #endif
@@ -1865,6 +1865,8 @@
        case IPCTL_MTUDISCTIMEOUT:
                error = sysctl_int(oldp, oldlenp, newp, newlen,
                   &ip_mtudisc_timeout);
+               if (ip_mtudisc_timeout < 0)
+                       return (EINVAL);
                if (ip_mtudisc_timeout_q != NULL)
                        rt_timer_queue_change(ip_mtudisc_timeout_q,
                                              ip_mtudisc_timeout);
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet/ip_var.h
--- a/sys/netinet/ip_var.h      Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet/ip_var.h      Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_var.h,v 1.48 2002/06/30 22:40:35 thorpej Exp $      */
+/*     $NetBSD: ip_var.h,v 1.49 2002/09/11 02:41:20 itojun Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -195,7 +195,7 @@
 extern int   ip_defttl;                        /* default IP ttl */
 extern int   ipforwarding;             /* ip forwarding */
 extern int   ip_mtudisc;               /* mtu discovery */
-extern u_int ip_mtudisc_timeout;       /* seconds to timeout mtu discovery */
+extern int   ip_mtudisc_timeout;       /* seconds to timeout mtu discovery */
 extern int   anonportmin;              /* minimum ephemeral port */
 extern int   anonportmax;              /* maximum ephemeral port */
 extern int   lowportmin;               /* minimum reserved port */
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet/tcp_input.c   Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.154 2002/09/05 23:02:18 itojun Exp $   */
+/*     $NetBSD: tcp_input.c,v 1.155 2002/09/11 02:41:21 itojun Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -152,7 +152,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.154 2002/09/05 23:02:18 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.155 2002/09/11 02:41:21 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -780,7 +780,7 @@
        struct ip6_hdr *ip6;
        struct in6pcb *in6p;
 #endif
-       caddr_t optp = NULL;
+       u_int8_t *optp = NULL;
        int optlen = 0;
        int len, tlen, toff, hdroptlen = 0;
        struct tcpcb *tp = 0;
@@ -986,7 +986,7 @@
 #endif
                KASSERT(TCP_HDR_ALIGNED_P(th));
                optlen = off - sizeof (struct tcphdr);
-               optp = ((caddr_t)th) + sizeof(struct tcphdr);
+               optp = ((u_int8_t *)th) + sizeof(struct tcphdr);
                /*
                 * Do quick retrieval of timestamp options ("options
                 * prediction?").  If timestamp is the only option and it's
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet6/ah_input.c
--- a/sys/netinet6/ah_input.c   Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet6/ah_input.c   Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ah_input.c,v 1.35 2002/08/14 00:23:37 itojun Exp $     */
+/*     $NetBSD: ah_input.c,v 1.36 2002/09/11 02:41:22 itojun Exp $     */
 /*     $KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $       */
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ah_input.c,v 1.35 2002/08/14 00:23:37 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ah_input.c,v 1.36 2002/09/11 02:41:22 itojun Exp $");
 
 #include "opt_inet.h"
 
@@ -919,7 +919,7 @@
                /*
                 * strip off AH.
                 */
-               char *prvnxtp;
+               u_int8_t *prvnxtp;
 
                /*
                 * Copy the value of the next header field of AH to the
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet6/esp_input.c
--- a/sys/netinet6/esp_input.c  Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet6/esp_input.c  Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esp_input.c,v 1.24 2002/08/21 23:12:01 itojun Exp $    */
+/*     $NetBSD: esp_input.c,v 1.25 2002/09/11 02:41:23 itojun Exp $    */
 /*     $KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $      */
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esp_input.c,v 1.24 2002/08/21 23:12:01 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp_input.c,v 1.25 2002/09/11 02:41:23 itojun Exp $");
 
 #include "opt_inet.h"
 
@@ -826,7 +826,7 @@
                 * we can always compute checksum for AH correctly.
                 */
                size_t stripsiz;
-               char *prvnxtp;
+               u_int8_t *prvnxtp;
 
                /*
                 * Set the next header field of the previous header correctly.
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet6/frag6.c
--- a/sys/netinet6/frag6.c      Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet6/frag6.c      Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frag6.c,v 1.20 2002/06/09 14:43:11 itojun Exp $        */
+/*     $NetBSD: frag6.c,v 1.21 2002/09/11 02:41:23 itojun Exp $        */
 /*     $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.20 2002/06/09 14:43:11 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.21 2002/09/11 02:41:23 itojun Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -570,7 +570,7 @@
         * Store NXT to the original.
         */
        {
-               char *prvnxtp = ip6_get_prevhdr(m, offset); /* XXX */
+               u_int8_t *prvnxtp = ip6_get_prevhdr(m, offset); /* XXX */
                *prvnxtp = nxt;
        }
 
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c       Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet6/in6_ifattach.c       Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_ifattach.c,v 1.49 2002/06/11 07:28:06 itojun Exp $ */
+/*     $NetBSD: in6_ifattach.c,v 1.50 2002/09/11 02:41:24 itojun Exp $ */
 /*     $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.49 2002/06/11 07:28:06 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.50 2002/09/11 02:41:24 itojun Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,7 +103,7 @@
        /* generate 8 bytes of pseudo-random value. */
        bzero(&ctxt, sizeof(ctxt));
        MD5Init(&ctxt);
-       MD5Update(&ctxt, hostname, hostnamelen);
+       MD5Update(&ctxt, (u_char *)hostname, hostnamelen);
        MD5Final(digest, &ctxt);
 
        /* assumes sizeof(digest) > sizeof(ifid) */
@@ -130,7 +130,7 @@
 {
        struct ifaddr *ifa;
        struct sockaddr_dl *sdl;
-       u_int8_t *addr;
+       char *addr;
        size_t addrlen;
        static u_int8_t allzero[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
        static u_int8_t allone[8] =
@@ -525,8 +525,8 @@
        u_char *q;
        MD5_CTX ctxt;
        u_int8_t digest[16];
-       char l;
-       char n[64];     /* a single label must not exceed 63 chars */
+       u_int8_t l;
+       u_int8_t n[64]; /* a single label must not exceed 63 chars */
 
        if (!namelen || !name)
                return -1;
@@ -537,7 +537,7 @@
        if (p - name > sizeof(n) - 1)
                return -1;      /* label too long */
        l = p - name;
-       strncpy(n, name, l);
+       strncpy((char *)n, name, l);
        n[(int)l] = '\0';
        for (q = n; *q; q++) {
                if ('A' <= *q && *q <= 'Z')
diff -r 6fc4fada2a49 -r f46e567fee65 sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c  Wed Sep 11 02:22:49 2002 +0000
+++ b/sys/netinet6/ip6_input.c  Wed Sep 11 02:41:19 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_input.c,v 1.57 2002/06/30 22:40:39 thorpej Exp $   */
+/*     $NetBSD: ip6_input.c,v 1.58 2002/09/11 02:41:25 itojun Exp $    */
 /*     $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $     */
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.57 2002/06/30 22:40:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.58 2002/09/11 02:41:25 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -811,11 +811,11 @@
 
        if (ip6_process_hopopts(m, (u_int8_t *)hbh + sizeof(struct ip6_hbh),
                                hbhlen, rtalertp, plenp) < 0)
-               return(-1);
+               return (-1);
 
        *offp = off;
        *mp = m;
-       return(0);
+       return (0);
 }
 
 /*
@@ -975,14 +975,14 @@
 
        switch (IP6OPT_TYPE(*optp)) {
        case IP6OPT_TYPE_SKIP: /* ignore the option */
-               return((int)*(optp + 1));
+               return ((int)*(optp + 1));
        case IP6OPT_TYPE_DISCARD:       /* silently discard */
                m_freem(m);
-               return(-1);
+               return (-1);
        case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */
                ip6stat.ip6s_badoptions++;
                icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off);
-               return(-1);
+               return (-1);
        case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */
                ip6stat.ip6s_badoptions++;
                ip6 = mtod(m, struct ip6_hdr *);
@@ -992,11 +992,11 @@
                else
                        icmp6_error(m, ICMP6_PARAM_PROB,
                                    ICMP6_PARAMPROB_OPTION, off);
-               return(-1);
+               return (-1);
        }
 
        m_freem(m);             /* XXX: NOTREACHED */
-       return(-1);
+       return (-1);
 }
 
 /*
@@ -1243,7 +1243,7 @@
  * carefully. Moreover, it will not be used in the near future when
  * we develop `neater' mechanism to process extension headers.
  */
-char *
+u_int8_t *
 ip6_get_prevhdr(m, off)
        struct mbuf *m;
        int off;



Home | Main Index | Thread Index | Old Index