Deleted Added
full compact
keysock.c (283901) keysock.c (283902)
1/* $FreeBSD: stable/10/sys/netipsec/keysock.c 283901 2015-06-02 03:14:42Z ae $ */
1/* $FreeBSD: stable/10/sys/netipsec/keysock.c 283902 2015-06-02 03:43:36Z ae $ */
2/* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 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

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

69 int key_count;
70 int any_count;
71};
72static VNET_DEFINE(struct key_cb, key_cb);
73#define V_key_cb VNET(key_cb)
74
75static struct sockaddr key_src = { 2, PF_KEY, };
76
2/* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 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

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

69 int key_count;
70 int any_count;
71};
72static VNET_DEFINE(struct key_cb, key_cb);
73#define V_key_cb VNET(key_cb)
74
75static struct sockaddr key_src = { 2, PF_KEY, };
76
77static int key_sendup0 __P((struct rawcb *, struct mbuf *, int));
77static int key_sendup0(struct rawcb *, struct mbuf *, int);
78
79VNET_PCPUSTAT_DEFINE(struct pfkeystat, pfkeystat);
80VNET_PCPUSTAT_SYSINIT(pfkeystat);
81
82#ifdef VIMAGE
83VNET_PCPUSTAT_SYSUNINIT(pfkeystat);
84#endif /* VIMAGE */
85

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

132 m_freem(m);
133 return error;
134}
135
136/*
137 * send message to the socket.
138 */
139static int
78
79VNET_PCPUSTAT_DEFINE(struct pfkeystat, pfkeystat);
80VNET_PCPUSTAT_SYSINIT(pfkeystat);
81
82#ifdef VIMAGE
83VNET_PCPUSTAT_SYSUNINIT(pfkeystat);
84#endif /* VIMAGE */
85

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

132 m_freem(m);
133 return error;
134}
135
136/*
137 * send message to the socket.
138 */
139static int
140key_sendup0(rp, m, promisc)
141 struct rawcb *rp;
142 struct mbuf *m;
143 int promisc;
140key_sendup0(struct rawcb *rp, struct mbuf *m, int promisc)
144{
145 int error;
146
147 if (promisc) {
148 struct sadb_msg *pmsg;
149
150 M_PREPEND(m, sizeof(struct sadb_msg), M_NOWAIT);
151 if (m == NULL) {

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

170 } else
171 error = 0;
172 sorwakeup(rp->rcb_socket);
173 return error;
174}
175
176/* XXX this interface should be obsoleted. */
177int
141{
142 int error;
143
144 if (promisc) {
145 struct sadb_msg *pmsg;
146
147 M_PREPEND(m, sizeof(struct sadb_msg), M_NOWAIT);
148 if (m == NULL) {

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

167 } else
168 error = 0;
169 sorwakeup(rp->rcb_socket);
170 return error;
171}
172
173/* XXX this interface should be obsoleted. */
174int
178key_sendup(so, msg, len, target)
179 struct socket *so;
180 struct sadb_msg *msg;
181 u_int len;
182 int target; /*target of the resulting message*/
175key_sendup(struct socket *so, struct sadb_msg *msg, u_int len, int target)
183{
184 struct mbuf *m, *n, *mprev;
185 int tlen;
186
187 /* sanity check */
188 if (so == 0 || msg == 0)
189 panic("%s: NULL pointer was passed.\n", __func__);
190

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

259 PFKEYSTAT_ADD(in_bytes, -len);
260 PFKEYSTAT_ADD(in_msgtype[msg->sadb_msg_type], -1);
261
262 return key_sendup_mbuf(so, m, target);
263}
264
265/* so can be NULL if target != KEY_SENDUP_ONE */
266int
176{
177 struct mbuf *m, *n, *mprev;
178 int tlen;
179
180 /* sanity check */
181 if (so == 0 || msg == 0)
182 panic("%s: NULL pointer was passed.\n", __func__);
183

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

252 PFKEYSTAT_ADD(in_bytes, -len);
253 PFKEYSTAT_ADD(in_msgtype[msg->sadb_msg_type], -1);
254
255 return key_sendup_mbuf(so, m, target);
256}
257
258/* so can be NULL if target != KEY_SENDUP_ONE */
259int
267key_sendup_mbuf(so, m, target)
268 struct socket *so;
269 struct mbuf *m;
270 int target;
260key_sendup_mbuf(struct socket *so, struct mbuf *m, int target)
271{
272 struct mbuf *n;
273 struct keycb *kp;
274 int sendup;
275 struct rawcb *rp;
276 int error = 0;
277
278 if (m == NULL)

--- 303 unchanged lines hidden ---
261{
262 struct mbuf *n;
263 struct keycb *kp;
264 int sendup;
265 struct rawcb *rp;
266 int error = 0;
267
268 if (m == NULL)

--- 303 unchanged lines hidden ---