/* * Handle MRT setsockopt commands to modify the multicast routing tables. */ int ip6_mrouter_set(struct socket *so, struct sockopt *sopt) { int error, optval; struct mif6ctl mifc; struct mf6cctl mfcc; mifi_t mifi; if (sopt->sopt_name != MRT6_INIT && so != ip6_mrouter) return (EACCES); error = 0; switch (sopt->sopt_name) { #ifdef MRT6_OINIT case MRT6_OINIT: #endif case MRT6_INIT: error = sockopt_getint(sopt, &optval); if (error) break; return (ip6_mrouter_init(so, optval, sopt->sopt_name)); case MRT6_DONE: return (ip6_mrouter_done()); case MRT6_ADD_MIF: error = sockopt_get(sopt, &mifc, sizeof(mifc)); if (error) break; return (add_m6if(&mifc)); case MRT6_DEL_MIF: error = sockopt_get(sopt, &mifi, sizeof(mifi)); if (error) break; return (del_m6if(&mifi)); case MRT6_ADD_MFC: error = sockopt_get(sopt, &mfcc, sizeof(mfcc)); if (error) break; return (add_m6fc(&mfcc)); case MRT6_DEL_MFC: error = sockopt_get(sopt, &mfcc, sizeof(mfcc)); if (error) break; return (del_m6fc(&mfcc)); case MRT6_PIM: error = sockopt_getint(sopt, &optval); if (error) break; return (set_pim6(&optval)); default: error = EOPNOTSUPP; } return (error); }
/* * Handle MRT setsockopt commands to modify the multicast routing tables. */ int ip6_mrouter_set(struct socket *so, struct sockopt *sopt) { int error = 0; struct mbuf *m; if (so != ip6_mrouter && sopt->sopt_name != MRT6_INIT) return (EACCES); if ((error = soopt_getm(sopt, &m)) != 0) /* XXX */ return (error); soopt_to_mbuf(sopt, m); /* XXX */ switch (sopt->sopt_name) { case MRT6_INIT: #ifdef MRT6_OINIT case MRT6_OINIT: #endif error = ip6_mrouter_init(so, m, sopt->sopt_name); break; case MRT6_DONE: error = ip6_mrouter_done(); break; case MRT6_ADD_MIF: error = add_m6if(mtod(m, struct mif6ctl *)); break; case MRT6_DEL_MIF: error = del_m6if(mtod(m, mifi_t *)); break; case MRT6_ADD_MFC: error = add_m6fc(mtod(m, struct mf6cctl *)); break; case MRT6_DEL_MFC: error = del_m6fc(mtod(m, struct mf6cctl *)); break; case MRT6_PIM: error = set_pim6(mtod(m, int *)); break; default: error = EOPNOTSUPP; break; } m_freem(m); return (error); }
/* * Handle MRT setsockopt commands to modify the multicast routing tables. */ int X_ip6_mrouter_set(struct socket *so, struct sockopt *sopt) { int error = 0; int optval; struct mif6ctl mifc; struct mf6cctl mfcc; mifi_t mifi; if (so != V_ip6_mrouter && sopt->sopt_name != MRT6_INIT) return (EACCES); switch (sopt->sopt_name) { case MRT6_INIT: #ifdef MRT6_OINIT case MRT6_OINIT: #endif error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); if (error) break; error = ip6_mrouter_init(so, optval, sopt->sopt_name); break; case MRT6_DONE: error = X_ip6_mrouter_done(); break; case MRT6_ADD_MIF: error = sooptcopyin(sopt, &mifc, sizeof(mifc), sizeof(mifc)); if (error) break; error = add_m6if(&mifc); break; case MRT6_ADD_MFC: error = sooptcopyin(sopt, &mfcc, sizeof(mfcc), sizeof(mfcc)); if (error) break; error = add_m6fc(&mfcc); break; case MRT6_DEL_MFC: error = sooptcopyin(sopt, &mfcc, sizeof(mfcc), sizeof(mfcc)); if (error) break; error = del_m6fc(&mfcc); break; case MRT6_DEL_MIF: error = sooptcopyin(sopt, &mifi, sizeof(mifi), sizeof(mifi)); if (error) break; error = del_m6if(&mifi); break; case MRT6_PIM: error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); if (error) break; error = set_pim6(&optval); break; default: error = EOPNOTSUPP; break; } return (error); }