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

Function vxlan_encap_header

freebsd/net/if_vxlan.c:2397–2419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2395}
2396
2397static void
2398vxlan_encap_header(struct vxlan_softc *sc, struct mbuf *m, int ipoff,
2399 uint16_t srcport, uint16_t dstport)
2400{
2401 struct vxlanudphdr *hdr;
2402 struct udphdr *udph;
2403 struct vxlan_header *vxh;
2404 int len;
2405
2406 len = m->m_pkthdr.len - ipoff;
2407 MPASS(len >= sizeof(struct vxlanudphdr));
2408 hdr = mtodo(m, ipoff);
2409
2410 udph = &hdr->vxlh_udp;
2411 udph->uh_sport = srcport;
2412 udph->uh_dport = dstport;
2413 udph->uh_ulen = htons(len);
2414 udph->uh_sum = 0;
2415
2416 vxh = &hdr->vxlh_hdr;
2417 vxh->vxlh_flags = htonl(VXLAN_HDR_FLAGS_VALID_VNI);
2418 vxh->vxlh_vni = htonl(sc->vxl_vni << VXLAN_HDR_VNI_SHIFT);
2419}
2420#endif
2421
2422/*

Callers 2

vxlan_encap4Function · 0.85
vxlan_encap6Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected