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

Function discoutput

freebsd/net/if_disc.c:176–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174DECLARE_MODULE(if_disc, disc_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
175
176static int
177discoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
178 struct route *ro)
179{
180 u_int32_t af;
181
182 M_ASSERTPKTHDR(m);
183
184 /* BPF writes need to be handled specially. */
185 if (dst->sa_family == AF_UNSPEC)
186 bcopy(dst->sa_data, &af, sizeof(af));
187 else
188 af = dst->sa_family;
189
190 if (bpf_peers_present(ifp->if_bpf))
191 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m);
192
193 m->m_pkthdr.rcvif = ifp;
194
195 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
196 if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
197
198 m_freem(m);
199 return (0);
200}
201
202/*
203 * Process an ioctl request.

Callers

nothing calls this directly

Calls 4

bpf_mtap2Function · 0.85
if_inc_counterFunction · 0.85
bpf_peers_presentFunction · 0.70
m_freemFunction · 0.50

Tested by

no test coverage detected