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

Function ip_mroute_modevent

freebsd/netinet/ip_mroute.c:2861–2962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2859 vnet_mroute_uninit, NULL);
2860
2861static int
2862ip_mroute_modevent(module_t mod, int type, void *unused)
2863{
2864
2865 switch (type) {
2866 case MOD_LOAD:
2867 MROUTER_LOCK_INIT();
2868
2869 if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event,
2870 if_detached_event, NULL, EVENTHANDLER_PRI_ANY);
2871 if (if_detach_event_tag == NULL) {
2872 printf("ip_mroute: unable to register "
2873 "ifnet_departure_event handler\n");
2874 MROUTER_LOCK_DESTROY();
2875 return (EINVAL);
2876 }
2877
2878 MFC_LOCK_INIT();
2879 VIF_LOCK_INIT();
2880
2881 mfchashsize = MFCHASHSIZE;
2882 if (TUNABLE_ULONG_FETCH("net.inet.ip.mfchashsize", &mfchashsize) &&
2883 !powerof2(mfchashsize)) {
2884 printf("WARNING: %s not a power of 2; using default\n",
2885 "net.inet.ip.mfchashsize");
2886 mfchashsize = MFCHASHSIZE;
2887 }
2888
2889 pim_squelch_wholepkt = 0;
2890 TUNABLE_ULONG_FETCH("net.inet.pim.squelch_wholepkt",
2891 &pim_squelch_wholepkt);
2892
2893 pim_encap_cookie = ip_encap_attach(&ipv4_encap_cfg, NULL, M_WAITOK);
2894 if (pim_encap_cookie == NULL) {
2895 printf("ip_mroute: unable to attach pim encap\n");
2896 VIF_LOCK_DESTROY();
2897 MFC_LOCK_DESTROY();
2898 MROUTER_LOCK_DESTROY();
2899 return (EINVAL);
2900 }
2901
2902 ip_mcast_src = X_ip_mcast_src;
2903 ip_mforward = X_ip_mforward;
2904 ip_mrouter_done = X_ip_mrouter_done;
2905 ip_mrouter_get = X_ip_mrouter_get;
2906 ip_mrouter_set = X_ip_mrouter_set;
2907
2908 ip_rsvp_force_done = X_ip_rsvp_force_done;
2909 ip_rsvp_vif = X_ip_rsvp_vif;
2910
2911 legal_vif_num = X_legal_vif_num;
2912 mrt_ioctl = X_mrt_ioctl;
2913 rsvp_input_p = X_rsvp_input;
2914 break;
2915
2916 case MOD_UNLOAD:
2917 /*
2918 * Typically module unload happens after the user-level

Callers

nothing calls this directly

Calls 3

ip_encap_attachFunction · 0.85
ip_encap_detachFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected