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

Function in6_gre_attach

freebsd/netinet6/ip6_gre.c:368–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368static int
369in6_gre_attach(struct gre_softc *sc)
370{
371 struct grehdr *gh;
372 int error;
373
374 if (sc->gre_options & GRE_UDPENCAP) {
375 sc->gre_csumflags = CSUM_UDP_IPV6;
376 sc->gre_hlen = sizeof(struct greudp6);
377 sc->gre_oip6.ip6_nxt = IPPROTO_UDP;
378 gh = &sc->gre_udp6hdr->gi6_gre;
379 gre_update_udphdr(sc, &sc->gre_udp6,
380 in6_cksum_pseudo(&sc->gre_oip6, 0, 0, 0));
381 } else {
382 sc->gre_hlen = sizeof(struct greip6);
383 sc->gre_oip6.ip6_nxt = IPPROTO_GRE;
384 gh = &sc->gre_ip6hdr->gi6_gre;
385 }
386 sc->gre_oip6.ip6_vfc = IPV6_VERSION;
387 gre_update_hdr(sc, gh);
388
389 /*
390 * If we return error, this means that sc is not linked,
391 * and caller should reset gre_family and free(sc->gre_hdr).
392 */
393 if (sc->gre_options & GRE_UDPENCAP) {
394 error = in6_gre_setup_socket(sc);
395 if (error != 0)
396 return (error);
397 } else
398 CK_LIST_INSERT_HEAD(&GRE_HASH_SC(sc), sc, chain);
399 CK_LIST_INSERT_HEAD(&GRE_SRCHASH(&sc->gre_oip6.ip6_src), sc, srchash);
400
401 /* Set IFF_DRV_RUNNING if interface is ready */
402 in6_gre_set_running(sc);
403 return (0);
404}
405
406int
407in6_gre_setopts(struct gre_softc *sc, u_long cmd, uint32_t value)

Callers 2

in6_gre_setoptsFunction · 0.85
in6_gre_ioctlFunction · 0.85

Calls 5

gre_update_udphdrFunction · 0.85
in6_cksum_pseudoFunction · 0.85
gre_update_hdrFunction · 0.85
in6_gre_setup_socketFunction · 0.85
in6_gre_set_runningFunction · 0.85

Tested by

no test coverage detected