Deleted Added
full compact
key.c (170803) key.c (170805)
1/* $FreeBSD: head/sys/netipsec/key.c 170803 2007-06-15 23:45:39Z bz $ */
1/* $FreeBSD: head/sys/netipsec/key.c 170805 2007-06-16 00:15:14Z bz $ */
2/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane 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

--- 2244 unchanged lines hidden (view full) ---

2254 * others: error number
2255 */
2256int
2257key_spdacquire(sp)
2258 struct secpolicy *sp;
2259{
2260 struct mbuf *result = NULL, *m;
2261 struct secspacq *newspacq;
2/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane 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

--- 2244 unchanged lines hidden (view full) ---

2254 * others: error number
2255 */
2256int
2257key_spdacquire(sp)
2258 struct secpolicy *sp;
2259{
2260 struct mbuf *result = NULL, *m;
2261 struct secspacq *newspacq;
2262 int error;
2263
2264 IPSEC_ASSERT(sp != NULL, ("null secpolicy"));
2265 IPSEC_ASSERT(sp->req == NULL, ("policy exists"));
2266 IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC,
2267 ("policy not IPSEC %u", sp->policy));
2268
2269 /* Get an entry to check whether sent message or not. */
2270 newspacq = key_getspacq(&sp->spidx);

--- 11 unchanged lines hidden (view full) ---

2282 /* make new entry for blocking to send SADB_ACQUIRE. */
2283 newspacq = key_newspacq(&sp->spidx);
2284 if (newspacq == NULL)
2285 return ENOBUFS;
2286 }
2287
2288 /* create new sadb_msg to reply. */
2289 m = key_setsadbmsg(SADB_X_SPDACQUIRE, 0, 0, 0, 0, 0);
2262
2263 IPSEC_ASSERT(sp != NULL, ("null secpolicy"));
2264 IPSEC_ASSERT(sp->req == NULL, ("policy exists"));
2265 IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC,
2266 ("policy not IPSEC %u", sp->policy));
2267
2268 /* Get an entry to check whether sent message or not. */
2269 newspacq = key_getspacq(&sp->spidx);

--- 11 unchanged lines hidden (view full) ---

2281 /* make new entry for blocking to send SADB_ACQUIRE. */
2282 newspacq = key_newspacq(&sp->spidx);
2283 if (newspacq == NULL)
2284 return ENOBUFS;
2285 }
2286
2287 /* create new sadb_msg to reply. */
2288 m = key_setsadbmsg(SADB_X_SPDACQUIRE, 0, 0, 0, 0, 0);
2290 if (!m) {
2291 error = ENOBUFS;
2292 goto fail;
2293 }
2289 if (!m)
2290 return ENOBUFS;
2291
2294 result = m;
2295
2296 result->m_pkthdr.len = 0;
2297 for (m = result; m; m = m->m_next)
2298 result->m_pkthdr.len += m->m_len;
2299
2300 mtod(result, struct sadb_msg *)->sadb_msg_len =
2301 PFKEY_UNIT64(result->m_pkthdr.len);
2302
2303 return key_sendup_mbuf(NULL, m, KEY_SENDUP_REGISTERED);
2292 result = m;
2293
2294 result->m_pkthdr.len = 0;
2295 for (m = result; m; m = m->m_next)
2296 result->m_pkthdr.len += m->m_len;
2297
2298 mtod(result, struct sadb_msg *)->sadb_msg_len =
2299 PFKEY_UNIT64(result->m_pkthdr.len);
2300
2301 return key_sendup_mbuf(NULL, m, KEY_SENDUP_REGISTERED);
2304
2305fail:
2306 if (result)
2307 m_freem(result);
2308 return error;
2309}
2310
2311/*
2312 * SADB_SPDFLUSH processing
2313 * receive
2314 * <base>
2315 * from the user, and free all entries in secpctree.
2316 * and send,

--- 5041 unchanged lines hidden ---
2302}
2303
2304/*
2305 * SADB_SPDFLUSH processing
2306 * receive
2307 * <base>
2308 * from the user, and free all entries in secpctree.
2309 * and send,

--- 5041 unchanged lines hidden ---