MCPcopy Create free account
hub / github.com/F-Stack/f-stack / send_input

Function send_input

freebsd/netinet6/send.c:260–303  ·  view source on GitHub ↗

* Send a SeND message to user space, that was either received and has to be * validated or was about to be send out and has to be handled by the SEND * daemon adding SeND ICMPv6 options. */

Source from the content-addressed store, hash-verified

258 * daemon adding SeND ICMPv6 options.
259 */
260static int
261send_input(struct mbuf *m, struct ifnet *ifp, int direction, int msglen __unused)
262{
263 struct ip6_hdr *ip6;
264 struct sockaddr_send sendsrc;
265
266 SEND_LOCK();
267 if (V_send_so == NULL) {
268 SEND_UNLOCK();
269 return (-1);
270 }
271
272 /*
273 * Make sure to clear any possible internally embedded scope before
274 * passing the packet to user space for SeND cryptographic signature
275 * validation to succeed.
276 */
277 ip6 = mtod(m, struct ip6_hdr *);
278 in6_clearscope(&ip6->ip6_src);
279 in6_clearscope(&ip6->ip6_dst);
280
281 bzero(&sendsrc, sizeof(sendsrc));
282 sendsrc.send_len = sizeof(sendsrc);
283 sendsrc.send_family = AF_INET6;
284 sendsrc.send_direction = direction;
285 sendsrc.send_ifidx = ifp->if_index;
286
287 /*
288 * Send incoming or outgoing traffic to user space either to be
289 * protected (outgoing) or validated (incoming) according to rfc3971.
290 */
291 SOCKBUF_LOCK(&V_send_so->so_rcv);
292 if (sbappendaddr_locked(&V_send_so->so_rcv,
293 (struct sockaddr *)&sendsrc, m, NULL) == 0) {
294 SOCKBUF_UNLOCK(&V_send_so->so_rcv);
295 /* XXX stats. */
296 m_freem(m);
297 } else {
298 sorwakeup_locked(V_send_so);
299 }
300
301 SEND_UNLOCK();
302 return (0);
303}
304
305struct pr_usrreqs send_usrreqs = {
306 .pru_attach = send_attach,

Callers

nothing calls this directly

Calls 4

in6_clearscopeFunction · 0.85
bzeroFunction · 0.85
sbappendaddr_lockedFunction · 0.85
m_freemFunction · 0.50

Tested by

no test coverage detected