ip6_output.c (121811) | ip6_output.c (122062) |
---|---|
1/* $FreeBSD: head/sys/netinet6/ip6_output.c 121811 2003-10-31 16:32:12Z ume $ */ | 1/* $FreeBSD: head/sys/netinet6/ip6_output.c 122062 2003-11-04 16:02:05Z ume $ */ |
2/* $KAME: ip6_output.c,v 1.279 2002/01/26 06:12:30 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 --- 169 unchanged lines hidden (view full) --- 179 u_long mtu; 180 int alwaysfrag, dontfrag; 181 u_int32_t optlen = 0, plen = 0, unfragpartlen = 0; 182 struct ip6_exthdrs exthdrs; 183 struct in6_addr finaldst; 184 struct route_in6 *ro_pmtu = NULL; 185 int hdrsplit = 0; 186 int needipsec = 0; | 2/* $KAME: ip6_output.c,v 1.279 2002/01/26 06:12:30 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 --- 169 unchanged lines hidden (view full) --- 179 u_long mtu; 180 int alwaysfrag, dontfrag; 181 u_int32_t optlen = 0, plen = 0, unfragpartlen = 0; 182 struct ip6_exthdrs exthdrs; 183 struct in6_addr finaldst; 184 struct route_in6 *ro_pmtu = NULL; 185 int hdrsplit = 0; 186 int needipsec = 0; |
187#ifdef FAST_IPSEC 188 int needipsectun = 0; 189 struct secpolicy *sp = NULL; 190#endif /* FAST_IPSEC */ |
|
187#ifdef IPSEC 188 int needipsectun = 0; | 191#ifdef IPSEC 192 int needipsectun = 0; |
193 struct socket *so; |
|
189 struct secpolicy *sp = NULL; 190 | 194 struct secpolicy *sp = NULL; 195 |
191 ip6 = mtod(m, struct ip6_hdr *); | 196 /* for AH processing. stupid to have "socket" variable in IP layer... */ 197 so = ipsec_getsocket(m); 198 (void)ipsec_setsocket(m, NULL); |
192#endif /* IPSEC */ | 199#endif /* IPSEC */ |
193#ifdef FAST_IPSEC 194 int needipsectun = 0; 195 struct secpolicy *sp = NULL; | |
196 197 ip6 = mtod(m, struct ip6_hdr *); | 200 201 ip6 = mtod(m, struct ip6_hdr *); |
198#endif /* FAST_IPSEC */ | |
199 200#define MAKE_EXTHDR(hp, mp) \ 201 do { \ 202 if (hp) { \ 203 struct ip6_ext *eh = (struct ip6_ext *)(hp); \ 204 error = ip6_copyexthdr((mp), (caddr_t)(hp), \ 205 ((eh)->ip6e_len + 1) << 3); \ 206 if (error) \ --- 23 unchanged lines hidden (view full) --- 230 /* Routing header */ 231 MAKE_EXTHDR(opt->ip6po_rthdr, &exthdrs.ip6e_rthdr); 232 /* Destination options header(2nd part) */ 233 MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2); 234 } 235 236#ifdef IPSEC 237 /* get a security policy for this packet */ | 202 203#define MAKE_EXTHDR(hp, mp) \ 204 do { \ 205 if (hp) { \ 206 struct ip6_ext *eh = (struct ip6_ext *)(hp); \ 207 error = ip6_copyexthdr((mp), (caddr_t)(hp), \ 208 ((eh)->ip6e_len + 1) << 3); \ 209 if (error) \ --- 23 unchanged lines hidden (view full) --- 233 /* Routing header */ 234 MAKE_EXTHDR(opt->ip6po_rthdr, &exthdrs.ip6e_rthdr); 235 /* Destination options header(2nd part) */ 236 MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2); 237 } 238 239#ifdef IPSEC 240 /* get a security policy for this packet */ |
238 if (inp == NULL) | 241 if (so == NULL) |
239 sp = ipsec6_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, 0, &error); 240 else | 242 sp = ipsec6_getpolicybyaddr(m, IPSEC_DIR_OUTBOUND, 0, &error); 243 else |
241 sp = ipsec6_getpolicybypcb(m, IPSEC_DIR_OUTBOUND, inp, &error); | 244 sp = ipsec6_getpolicybysock(m, IPSEC_DIR_OUTBOUND, so, &error); |
242 243 if (sp == NULL) { 244 ipsec6stat.out_inval++; 245 goto freehdrs; 246 } 247 248 error = 0; 249 --- 3198 unchanged lines hidden --- | 245 246 if (sp == NULL) { 247 ipsec6stat.out_inval++; 248 goto freehdrs; 249 } 250 251 error = 0; 252 --- 3198 unchanged lines hidden --- |