ip6_input.c (112130) | ip6_input.c (120386) |
---|---|
1/* $FreeBSD: head/sys/netinet6/ip6_input.c 112130 2003-03-12 06:08:48Z sam $ */ | 1/* $FreeBSD: head/sys/netinet6/ip6_input.c 120386 2003-09-23 17:54:04Z sam $ */ |
2/* $KAME: ip6_input.c,v 1.259 2002/01/21 04:58:09 jinmei 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 --- 128 unchanged lines hidden (view full) --- 138extern struct callout in6_tmpaddrtimer_ch; 139 140int ip6_forward_srcrt; /* XXX */ 141int ip6_sourcecheck; /* XXX */ 142int ip6_sourcecheck_interval; /* XXX */ 143 144int ip6_ours_check_algorithm; 145 | 2/* $KAME: ip6_input.c,v 1.259 2002/01/21 04:58:09 jinmei 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 --- 128 unchanged lines hidden (view full) --- 138extern struct callout in6_tmpaddrtimer_ch; 139 140int ip6_forward_srcrt; /* XXX */ 141int ip6_sourcecheck; /* XXX */ 142int ip6_sourcecheck_interval; /* XXX */ 143 144int ip6_ours_check_algorithm; 145 |
146#ifdef PFIL_HOOKS 147struct pfil_head inet6_pfil_hook; 148#endif |
|
146 147/* firewall hooks */ 148ip6_fw_chk_t *ip6_fw_chk_ptr; 149ip6_fw_ctl_t *ip6_fw_ctl_ptr; 150int ip6_fw_enable = 1; 151 152struct ip6stat ip6stat; 153 --- 25 unchanged lines hidden (view full) --- 179 panic("ip6_init"); 180 for (i = 0; i < IPPROTO_MAX; i++) 181 ip6_protox[i] = pr - inet6sw; 182 for (pr = (struct ip6protosw *)inet6domain.dom_protosw; 183 pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) 184 if (pr->pr_domain->dom_family == PF_INET6 && 185 pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) 186 ip6_protox[pr->pr_protocol] = pr - inet6sw; | 149 150/* firewall hooks */ 151ip6_fw_chk_t *ip6_fw_chk_ptr; 152ip6_fw_ctl_t *ip6_fw_ctl_ptr; 153int ip6_fw_enable = 1; 154 155struct ip6stat ip6stat; 156 --- 25 unchanged lines hidden (view full) --- 182 panic("ip6_init"); 183 for (i = 0; i < IPPROTO_MAX; i++) 184 ip6_protox[i] = pr - inet6sw; 185 for (pr = (struct ip6protosw *)inet6domain.dom_protosw; 186 pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) 187 if (pr->pr_domain->dom_family == PF_INET6 && 188 pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) 189 ip6_protox[pr->pr_protocol] = pr - inet6sw; |
190#ifdef PFIL_HOOKS 191 inet6_pfil_hook.ph_type = PFIL_TYPE_AF; 192 inet6_pfil_hook.ph_af = AF_INET6; 193 if ((i = pfil_head_register(&inet6_pfil_hook)) != 0) 194 printf("%s: WARNING: unable to register pfil hook, " 195 "error %d\n", __func__, i); 196#endif /* PFIL_HOOKS */ |
|
187 ip6intrq.ifq_maxlen = ip6qmaxlen; 188 mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF); 189 netisr_register(NETISR_IPV6, ip6_input, &ip6intrq); 190 nd6_init(); 191 frag6_init(); 192 /* 193 * in many cases, random() here does NOT return random number 194 * as initialization during bootstrap time occur in fixed order. --- 41 unchanged lines hidden (view full) --- 236 struct mbuf *m; 237{ 238 struct ip6_hdr *ip6; 239 int off = sizeof(struct ip6_hdr), nest; 240 u_int32_t plen; 241 u_int32_t rtalert = ~0; 242 int nxt, ours = 0; 243 struct ifnet *deliverifp = NULL; | 197 ip6intrq.ifq_maxlen = ip6qmaxlen; 198 mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF); 199 netisr_register(NETISR_IPV6, ip6_input, &ip6intrq); 200 nd6_init(); 201 frag6_init(); 202 /* 203 * in many cases, random() here does NOT return random number 204 * as initialization during bootstrap time occur in fixed order. --- 41 unchanged lines hidden (view full) --- 246 struct mbuf *m; 247{ 248 struct ip6_hdr *ip6; 249 int off = sizeof(struct ip6_hdr), nest; 250 u_int32_t plen; 251 u_int32_t rtalert = ~0; 252 int nxt, ours = 0; 253 struct ifnet *deliverifp = NULL; |
244#ifdef PFIL_HOOKS 245 struct packet_filter_hook *pfh; 246 struct mbuf *m0; 247 int rv; 248#endif /* PFIL_HOOKS */ | |
249 250#ifdef IPSEC 251 /* 252 * should the inner packet be considered authentic? 253 * see comment in ah4_input(). 254 */ 255 if (m) { 256 m->m_flags &= ~M_AUTHIPHDR; --- 78 unchanged lines hidden (view full) --- 335 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { 336 ip6stat.ip6s_badvers++; 337 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); 338 goto bad; 339 } 340 341#ifdef PFIL_HOOKS 342 /* | 254 255#ifdef IPSEC 256 /* 257 * should the inner packet be considered authentic? 258 * see comment in ah4_input(). 259 */ 260 if (m) { 261 m->m_flags &= ~M_AUTHIPHDR; --- 78 unchanged lines hidden (view full) --- 340 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { 341 ip6stat.ip6s_badvers++; 342 in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); 343 goto bad; 344 } 345 346#ifdef PFIL_HOOKS 347 /* |
343 * Run through list of hooks for input packets. If there are any 344 * filters which require that additional packets in the flow are 345 * not fast-forwarded, they must clear the M_CANFASTFWD flag. 346 * Note that filters must _never_ set this flag, as another filter 347 * in the list may have previously cleared it. | 348 * Run through list of hooks for input packets. |
348 */ | 349 */ |
349 m0 = m; 350 pfh = pfil_hook_get(PFIL_IN, &inet6sw[ip6_protox[IPPROTO_IPV6]].pr_pfh); 351 for (; pfh; pfh = pfh->pfil_link.tqe_next) 352 if (pfh->pfil_func) { 353 rv = pfh->pfil_func(ip6, sizeof(*ip6), 354 m->m_pkthdr.rcvif, 0, &m0); 355 if (rv) 356 return; 357 m = m0; 358 if (m == NULL) 359 return; 360 ip6 = mtod(m, struct ip6_hdr *); 361 } | 350 if (pfil_run_hooks(&inet6_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN)) 351 return; 352 if (m == NULL) /* consumed by filter */ 353 return; 354 ip6 = mtod(m, struct ip6_hdr *); |
362#endif /* PFIL_HOOKS */ 363 364 ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; 365 366 /* 367 * Check with the firewall... 368 */ 369 if (ip6_fw_enable && ip6_fw_chk_ptr) { --- 1274 unchanged lines hidden --- | 355#endif /* PFIL_HOOKS */ 356 357 ip6stat.ip6s_nxthist[ip6->ip6_nxt]++; 358 359 /* 360 * Check with the firewall... 361 */ 362 if (ip6_fw_enable && ip6_fw_chk_ptr) { --- 1274 unchanged lines hidden --- |