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

Function igmp_ra_alloc

freebsd/netinet/igmp.c:592–608  ·  view source on GitHub ↗

* Construct a Router Alert option to use in outgoing packets. */

Source from the content-addressed store, hash-verified

590 * Construct a Router Alert option to use in outgoing packets.
591 */
592static struct mbuf *
593igmp_ra_alloc(void)
594{
595 struct mbuf *m;
596 struct ipoption *p;
597
598 m = m_get(M_WAITOK, MT_DATA);
599 p = mtod(m, struct ipoption *);
600 p->ipopt_dst.s_addr = INADDR_ANY;
601 p->ipopt_list[0] = (char)IPOPT_RA; /* Router Alert Option */
602 p->ipopt_list[1] = 0x04; /* 4 bytes long */
603 p->ipopt_list[2] = IPOPT_EOL; /* End of IP option list */
604 p->ipopt_list[3] = 0x00; /* pad byte */
605 m->m_len = sizeof(p->ipopt_dst) + p->ipopt_list[1];
606
607 return (m);
608}
609
610/*
611 * Attach IGMP when PF_INET is attached to an interface.

Callers 1

igmp_modeventFunction · 0.85

Calls 1

m_getFunction · 0.50

Tested by

no test coverage detected