minimize diff with the latest kame tree.
This commit is contained in:
parent
2f928e31d3
commit
8b3234d2f2
@ -1,9 +1,10 @@
|
||||
/* $NetBSD: dest6.c,v 1.7 2000/02/06 12:49:42 itojun Exp $ */
|
||||
/* $NetBSD: dest6.c,v 1.8 2001/01/23 05:21:23 itojun Exp $ */
|
||||
/* $KAME: dest6.c,v 1.14 2001/01/23 05:16:28 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -15,7 +16,7 @@
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT 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
|
||||
@ -58,7 +59,7 @@ dest6_input(mp, offp, proto)
|
||||
struct mbuf **mp;
|
||||
int *offp, proto;
|
||||
{
|
||||
register struct mbuf *m = *mp;
|
||||
struct mbuf *m = *mp;
|
||||
int off = *offp, dstoptlen, optlen;
|
||||
struct ip6_dest *dstopts;
|
||||
u_int8_t *opt;
|
||||
@ -88,34 +89,35 @@ dest6_input(mp, offp, proto)
|
||||
|
||||
/* search header for all options. */
|
||||
for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) {
|
||||
switch(*opt) {
|
||||
case IP6OPT_PAD1:
|
||||
optlen = 1;
|
||||
break;
|
||||
case IP6OPT_PADN:
|
||||
if (dstoptlen < IP6OPT_MINLEN) {
|
||||
ip6stat.ip6s_toosmall++;
|
||||
goto bad;
|
||||
}
|
||||
optlen = *(opt + 1) + 2;
|
||||
break;
|
||||
default: /* unknown option */
|
||||
if (dstoptlen < IP6OPT_MINLEN) {
|
||||
ip6stat.ip6s_toosmall++;
|
||||
goto bad;
|
||||
}
|
||||
if ((optlen = ip6_unknown_opt(opt, m,
|
||||
opt-mtod(m, u_int8_t *))) == -1)
|
||||
return(IPPROTO_DONE);
|
||||
optlen += 2;
|
||||
break;
|
||||
switch (*opt) {
|
||||
case IP6OPT_PAD1:
|
||||
optlen = 1;
|
||||
break;
|
||||
case IP6OPT_PADN:
|
||||
if (dstoptlen < IP6OPT_MINLEN) {
|
||||
ip6stat.ip6s_toosmall++;
|
||||
goto bad;
|
||||
}
|
||||
optlen = *(opt + 1) + 2;
|
||||
break;
|
||||
default: /* unknown option */
|
||||
if (dstoptlen < IP6OPT_MINLEN) {
|
||||
ip6stat.ip6s_toosmall++;
|
||||
goto bad;
|
||||
}
|
||||
optlen = ip6_unknown_opt(opt, m,
|
||||
opt - mtod(m, u_int8_t *));
|
||||
if (optlen == -1)
|
||||
return (IPPROTO_DONE);
|
||||
optlen += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*offp = off;
|
||||
return(dstopts->ip6d_nxt);
|
||||
return (dstopts->ip6d_nxt);
|
||||
|
||||
bad:
|
||||
m_freem(m);
|
||||
return(IPPROTO_DONE);
|
||||
return (IPPROTO_DONE);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user