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

Function arp_fillheader

freebsd/netinet/if_ether.c:329–351  ·  view source on GitHub ↗

* Stores link-layer header for @ifp in format suitable for if_output() * into buffer @buf. Resulting header length is stored in @bufsize. * * Returns 0 on success. */

Source from the content-addressed store, hash-verified

327 * Returns 0 on success.
328 */
329static int
330arp_fillheader(struct ifnet *ifp, struct arphdr *ah, int bcast, u_char *buf,
331 size_t *bufsize)
332{
333 struct if_encap_req ereq;
334 int error;
335
336 bzero(buf, *bufsize);
337 bzero(&ereq, sizeof(ereq));
338 ereq.buf = buf;
339 ereq.bufsize = *bufsize;
340 ereq.rtype = IFENCAP_LL;
341 ereq.family = AF_ARP;
342 ereq.lladdr = ar_tha(ah);
343 ereq.hdata = (u_char *)ah;
344 if (bcast)
345 ereq.flags = IFENCAP_FLAG_BROADCAST;
346 error = ifp->if_requestencap(ifp, &ereq);
347 if (error == 0)
348 *bufsize = ereq.bufsize;
349
350 return (error);
351}
352
353/*
354 * Broadcast an ARP request. Caller specifies:

Callers 2

arprequest_internalFunction · 0.85
in_arpinputFunction · 0.85

Calls 1

bzeroFunction · 0.85

Tested by

no test coverage detected