MCPcopy Index your code
hub / github.com/F-Stack/f-stack / vxlan_socket_init

Function vxlan_socket_init

freebsd/net/if_vxlan.c:967–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965}
966
967static int
968vxlan_socket_init(struct vxlan_socket *vso, struct ifnet *ifp)
969{
970 struct thread *td;
971 int error;
972
973 td = curthread;
974
975 error = socreate(vso->vxlso_laddr.sa.sa_family, &vso->vxlso_sock,
976 SOCK_DGRAM, IPPROTO_UDP, td->td_ucred, td);
977 if (error) {
978 if_printf(ifp, "cannot create socket: %d\n", error);
979 return (error);
980 }
981
982 error = udp_set_kernel_tunneling(vso->vxlso_sock,
983 vxlan_rcv_udp_packet, NULL, vso);
984 if (error) {
985 if_printf(ifp, "cannot set tunneling function: %d\n", error);
986 return (error);
987 }
988
989 if (vxlan_reuse_port != 0) {
990 struct sockopt sopt;
991 int val = 1;
992
993 bzero(&sopt, sizeof(sopt));
994 sopt.sopt_dir = SOPT_SET;
995 sopt.sopt_level = IPPROTO_IP;
996 sopt.sopt_name = SO_REUSEPORT;
997 sopt.sopt_val = &val;
998 sopt.sopt_valsize = sizeof(val);
999 error = sosetopt(vso->vxlso_sock, &sopt);
1000 if (error) {
1001 if_printf(ifp,
1002 "cannot set REUSEADDR socket opt: %d\n", error);
1003 return (error);
1004 }
1005 }
1006
1007 return (0);
1008}
1009
1010static int
1011vxlan_socket_bind(struct vxlan_socket *vso, struct ifnet *ifp)

Callers 1

vxlan_socket_createFunction · 0.85

Calls 5

socreateFunction · 0.85
if_printfFunction · 0.85
udp_set_kernel_tunnelingFunction · 0.85
bzeroFunction · 0.85
sosetoptFunction · 0.85

Tested by

no test coverage detected