route6.c (65406) | route6.c (78064) |
---|---|
1/* $FreeBSD: head/sys/netinet6/route6.c 65406 2000-09-03 13:43:13Z itojun $ */ 2/* $KAME: route6.c,v 1.15 2000/06/23 16:18:20 itojun Exp $ */ | 1/* $FreeBSD: head/sys/netinet6/route6.c 78064 2001-06-11 12:39:29Z ume $ */ 2/* $KAME: route6.c,v 1.24 2001/03/14 03:07:05 itojun Exp $ */ |
3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 21 unchanged lines hidden (view full) --- 32 33#include "opt_inet.h" 34#include "opt_inet6.h" 35 36#include <sys/param.h> 37#include <sys/mbuf.h> 38#include <sys/socket.h> 39#include <sys/systm.h> | 3 4/* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 21 unchanged lines hidden (view full) --- 32 33#include "opt_inet.h" 34#include "opt_inet6.h" 35 36#include <sys/param.h> 37#include <sys/mbuf.h> 38#include <sys/socket.h> 39#include <sys/systm.h> |
40#include <sys/queue.h> |
|
40 41#include <net/if.h> 42 43#include <netinet/in.h> 44#include <netinet6/in6_var.h> 45#include <netinet/ip6.h> 46#include <netinet6/ip6_var.h> 47 48#include <netinet/icmp6.h> 49 50static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, 51 struct ip6_rthdr0 *)); 52 53int 54route6_input(mp, offp, proto) 55 struct mbuf **mp; 56 int *offp, proto; /* proto is unused */ 57{ | 41 42#include <net/if.h> 43 44#include <netinet/in.h> 45#include <netinet6/in6_var.h> 46#include <netinet/ip6.h> 47#include <netinet6/ip6_var.h> 48 49#include <netinet/icmp6.h> 50 51static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, 52 struct ip6_rthdr0 *)); 53 54int 55route6_input(mp, offp, proto) 56 struct mbuf **mp; 57 int *offp, proto; /* proto is unused */ 58{ |
58 register struct ip6_hdr *ip6; 59 register struct mbuf *m = *mp; 60 register struct ip6_rthdr *rh; | 59 struct ip6_hdr *ip6; 60 struct mbuf *m = *mp; 61 struct ip6_rthdr *rh; |
61 int off = *offp, rhlen; | 62 int off = *offp, rhlen; |
63 struct mbuf *n; |
|
62 | 64 |
65 n = ip6_findaux(m); 66 if (n) { 67 struct ip6aux *ip6a = mtod(n, struct ip6aux *); 68 /* XXX reject home-address option before rthdr */ 69 if (ip6a->ip6a_flags & IP6A_SWAP) { 70 ip6stat.ip6s_badoptions++; 71 m_freem(m); 72 return IPPROTO_DONE; 73 } 74 } 75 |
|
63#ifndef PULLDOWN_TEST 64 IP6_EXTHDR_CHECK(m, off, sizeof(*rh), IPPROTO_DONE); 65 ip6 = mtod(m, struct ip6_hdr *); 66 rh = (struct ip6_rthdr *)((caddr_t)ip6 + off); 67#else 68 ip6 = mtod(m, struct ip6_hdr *); 69 IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); 70 if (rh == NULL) { --- 43 unchanged lines hidden (view full) --- 114 } 115 116 *offp += rhlen; 117 return(rh->ip6r_nxt); 118} 119 120/* 121 * Type0 routing header processing | 76#ifndef PULLDOWN_TEST 77 IP6_EXTHDR_CHECK(m, off, sizeof(*rh), IPPROTO_DONE); 78 ip6 = mtod(m, struct ip6_hdr *); 79 rh = (struct ip6_rthdr *)((caddr_t)ip6 + off); 80#else 81 ip6 = mtod(m, struct ip6_hdr *); 82 IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh)); 83 if (rh == NULL) { --- 43 unchanged lines hidden (view full) --- 127 } 128 129 *offp += rhlen; 130 return(rh->ip6r_nxt); 131} 132 133/* 134 * Type0 routing header processing |
135 * 136 * RFC2292 backward compatibility warning: no support for strict/loose bitmap, 137 * as it was dropped between RFC1883 and RFC2460. |
|
122 */ 123static int 124ip6_rthdr0(m, ip6, rh0) 125 struct mbuf *m; 126 struct ip6_hdr *ip6; 127 struct ip6_rthdr0 *rh0; 128{ 129 int addrs, index; --- 41 unchanged lines hidden (view full) --- 171 IN6_IS_ADDR_V4COMPAT(nextaddr)) { 172 ip6stat.ip6s_badoptions++; 173 m_freem(m); 174 return(-1); 175 } 176 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || 177 IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || 178 IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst) || | 138 */ 139static int 140ip6_rthdr0(m, ip6, rh0) 141 struct mbuf *m; 142 struct ip6_hdr *ip6; 143 struct ip6_rthdr0 *rh0; 144{ 145 int addrs, index; --- 41 unchanged lines hidden (view full) --- 187 IN6_IS_ADDR_V4COMPAT(nextaddr)) { 188 ip6stat.ip6s_badoptions++; 189 m_freem(m); 190 return(-1); 191 } 192 if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || 193 IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || 194 IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst) || |
179 IN6_IS_ADDR_V4COMPAT(nextaddr)) { | 195 IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { |
180 ip6stat.ip6s_badoptions++; 181 m_freem(m); 182 return(-1); 183 } 184 185 /* 186 * Swap the IPv6 destination address and nextaddr. Forward the packet. 187 */ --- 19 unchanged lines hidden --- | 196 ip6stat.ip6s_badoptions++; 197 m_freem(m); 198 return(-1); 199 } 200 201 /* 202 * Swap the IPv6 destination address and nextaddr. Forward the packet. 203 */ --- 19 unchanged lines hidden --- |