2323
2324 /*
2325 * Called by klmmod.c when lockd adds a network endpoint
2326 * on which we should begin RPC services.
2327 */
2328 int
2329 nlm_svc_add_ep(struct file *fp, const char *netid, struct knetconfig *knc)
2330 {
2331 SVCMASTERXPRT *xprt = NULL;
2332 int error;
2333
2334 error = svc_tli_kcreate(fp, 0, (char *)netid, NULL, &xprt,
2335 &nlm_sct, NULL, NLM_SVCPOOL_ID, FALSE);
2336 if (error != 0)
2337 return (error);
2338
2339 (void) nlm_knc_to_netid(knc);
2340 return (0);
2341 }
2342
2343 /*
2344 * Start NLM service.
2345 */
2346 int
2347 nlm_svc_starting(struct nlm_globals *g, struct file *fp,
2348 const char *netid, struct knetconfig *knc)
2349 {
2350 int error;
2351 enum clnt_stat stat;
2352
2353 VERIFY(g->run_status == NLM_ST_STARTING);
2354 VERIFY(g->nlm_gc_thread == NULL);
2355
2356 error = nlm_nsm_init_local(&g->nlm_nsm);
2357 if (error != 0) {
2358 NLM_ERR("Failed to initialize NSM handler "
2359 "(error=%d)\n", error);
2360 g->run_status = NLM_ST_DOWN;
2361 return (error);
2362 }
|
2323
2324 /*
2325 * Called by klmmod.c when lockd adds a network endpoint
2326 * on which we should begin RPC services.
2327 */
2328 int
2329 nlm_svc_add_ep(struct file *fp, const char *netid, struct knetconfig *knc)
2330 {
2331 SVCMASTERXPRT *xprt = NULL;
2332 int error;
2333
2334 error = svc_tli_kcreate(fp, 0, (char *)netid, NULL, &xprt,
2335 &nlm_sct, NULL, NLM_SVCPOOL_ID, FALSE);
2336 if (error != 0)
2337 return (error);
2338
2339 (void) nlm_knc_to_netid(knc);
2340 return (0);
2341 }
2342
2343 int
2344 nlm_sysid_to_host(zoneid_t zoneid, sysid_t sysid, struct sockaddr *sa,
2345 const char **type)
2346 {
2347 struct nlm_globals *g;
2348 struct nlm_host *host;
2349 zone_t *zone;
2350
2351 zone = zone_find_by_id(zoneid);
2352 if (zone == NULL)
2353 return (0);
2354
2355 g = zone_getspecific(nlm_zone_key, zone);
2356
2357 host = nlm_host_find_by_sysid(g, sysid);
2358 if (host == NULL) {
2359 zone_rele(zone);
2360 return (0);
2361 }
2362
2363 if (strcmp(host->nh_knc.knc_protofmly, NC_INET) == 0)
2364 bcopy(host->nh_addr.buf, sa, sizeof (struct sockaddr_in));
2365 else if (strcmp(host->nh_knc.knc_protofmly, NC_INET6) == 0)
2366 bcopy(host->nh_addr.buf, sa, sizeof (struct sockaddr_in6));
2367 else
2368 sa->sa_family = AF_UNSPEC;
2369
2370 nlm_host_release(g, host);
2371 zone_rele(zone);
2372
2373 *type = "NLM";
2374
2375 return (1);
2376 }
2377
2378 /*
2379 * Start NLM service.
2380 */
2381 int
2382 nlm_svc_starting(struct nlm_globals *g, struct file *fp,
2383 const char *netid, struct knetconfig *knc)
2384 {
2385 int error;
2386 enum clnt_stat stat;
2387
2388 VERIFY(g->run_status == NLM_ST_STARTING);
2389 VERIFY(g->nlm_gc_thread == NULL);
2390
2391 error = nlm_nsm_init_local(&g->nlm_nsm);
2392 if (error != 0) {
2393 NLM_ERR("Failed to initialize NSM handler "
2394 "(error=%d)\n", error);
2395 g->run_status = NLM_ST_DOWN;
2396 return (error);
2397 }
|