| version 1.20, 2000/04/12 10:36:45 |
version 1.21, 2000/05/19 20:09:27 |
|
|
| /* $NetBSD$ */ |
/* $NetBSD$ */ |
| /* $KAME: ip6_input.c,v 1.72 2000/03/21 09:23:19 itojun Exp $ */ |
/* $KAME: ip6_input.c,v 1.89 2000/05/19 19:59:05 itojun Exp $ */ |
| |
|
| /* |
/* |
| * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| * All rights reserved. |
* All rights reserved. |
| * |
* |
| * Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
* modification, are permitted provided that the following conditions |
| * are met: |
* are met: |
|
|
| * 3. Neither the name of the project nor the names of its contributors |
* 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 |
* may be used to endorse or promote products derived from this software |
| * without specific prior written permission. |
* without specific prior written permission. |
| * |
* |
| * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
| * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| Line 146 static void ip6_init2 __P((void *)); |
|
| Line 146 static void ip6_init2 __P((void *)); |
|
| |
|
| static int ip6_hopopts_input __P((u_int32_t *, u_int32_t *, struct mbuf **, int *)); |
static int ip6_hopopts_input __P((u_int32_t *, u_int32_t *, struct mbuf **, int *)); |
| |
|
| #ifdef PTR |
|
| extern int ip6_protocol_tr; |
|
| |
|
| int ptr_in6 __P((struct mbuf *, struct mbuf **)); |
|
| extern void ip_forward __P((struct mbuf *, int)); |
|
| #endif |
|
| |
|
| /* |
/* |
| * IP6 initialization: fill in IP6 protocol switch table. |
* IP6 initialization: fill in IP6 protocol switch table. |
| * All protocols not implemented in kernel go to raw IP6 protocol handler. |
* All protocols not implemented in kernel go to raw IP6 protocol handler. |
| Line 196 ip6_init2(dummy) |
|
| Line 189 ip6_init2(dummy) |
|
| { |
{ |
| /* |
/* |
| * to route local address of p2p link to loopback, |
* to route local address of p2p link to loopback, |
| * assign loopback address first. |
* assign loopback address first. |
| */ |
*/ |
| in6_ifattach(&loif[0], NULL); |
in6_ifattach(&loif[0], NULL); |
| |
|
|
|
| } |
} |
| } |
} |
| |
|
| if (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) { |
#ifndef FAKE_LOOPBACK_IF |
| if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) { |
if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) |
| ours = 1; |
#else |
| deliverifp = m->m_pkthdr.rcvif; |
if (1) |
| goto hbhcheck; |
#endif |
| } |
{ |
| } else { |
|
| if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) |
if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) |
| ip6->ip6_src.s6_addr16[1] |
ip6->ip6_src.s6_addr16[1] |
| = htons(m->m_pkthdr.rcvif->if_index); |
= htons(m->m_pkthdr.rcvif->if_index); |
|
|
| = htons(m->m_pkthdr.rcvif->if_index); |
= htons(m->m_pkthdr.rcvif->if_index); |
| } |
} |
| |
|
| #ifdef PTR |
|
| /* |
/* |
| * |
* XXX we need this since we do not have "goto ours" hack route |
| |
* for some of our ifaddrs on loopback interface. |
| |
* we should correct it by changing in6_ifattach to install |
| |
* "goto ours" hack route. |
| */ |
*/ |
| if (ip6_protocol_tr) |
if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) != 0) { |
| { |
if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) { |
| struct mbuf *m1 = NULL; |
ours = 1; |
| |
deliverifp = m->m_pkthdr.rcvif; |
| switch (ptr_in6(m, &m1)) |
goto hbhcheck; |
| { |
} |
| case IPPROTO_IP: goto mcastcheck; |
|
| case IPPROTO_IPV4: ip_forward(m1, 0); break; |
|
| case IPPROTO_IPV6: ip6_forward(m1, 0); break; |
|
| case IPPROTO_MAX: /* discard this packet */ |
|
| default: |
|
| } |
|
| |
|
| if (m != m1) |
|
| m_freem(m); |
|
| |
|
| return; |
|
| } |
} |
| |
|
| mcastcheck: |
|
| #endif |
|
| |
|
| /* |
/* |
| * Multicast check |
* Multicast check |
| */ |
*/ |