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

Function ng_bridge_rcvmsg

freebsd/netgraph/ng_bridge.c:385–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385static int
386ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook)
387{
388 const priv_p priv = NG_NODE_PRIVATE(node);
389 struct ng_mesg *resp = NULL;
390 int error = 0;
391 struct ng_mesg *msg;
392
393 NGI_GET_MSG(item, msg);
394 switch (msg->header.typecookie) {
395#ifdef NGM_BRIDGE_TABLE_ABI
396 case NGM_BRIDGE_COOKIE_TBL:
397 switch (msg->header.cmd) {
398 case NGM_BRIDGE_GET_CONFIG:
399 {
400 struct ng_bridge_config_tbl *conf;
401
402 NG_MKRESPONSE(resp, msg, sizeof(*conf),
403 M_NOWAIT|M_ZERO);
404 if (resp == NULL) {
405 error = ENOMEM;
406 break;
407 }
408 conf = (struct ng_bridge_config_tbl *)resp->data;
409 conf->cfg = priv->conf;
410 break;
411 }
412 case NGM_BRIDGE_SET_CONFIG:
413 {
414 struct ng_bridge_config_tbl *conf;
415
416 if (msg->header.arglen != sizeof(*conf)) {
417 error = EINVAL;
418 break;
419 }
420 conf = (struct ng_bridge_config_tbl *)msg->data;
421 priv->conf = conf->cfg;
422 break;
423 }
424 case NGM_BRIDGE_GET_TABLE:
425 {
426 struct ng_bridge_host_tbl_ary *ary;
427 struct ng_bridge_hent *hent;
428 int i, bucket;
429
430 NG_MKRESPONSE(resp, msg, sizeof(*ary) +
431 (priv->numHosts * sizeof(*ary->hosts)), M_NOWAIT);
432 if (resp == NULL) {
433 error = ENOMEM;
434 break;
435 }
436 ary = (struct ng_bridge_host_tbl_ary *)resp->data;
437 ary->numHosts = priv->numHosts;
438 i = 0;
439 for (bucket = 0; bucket < priv->numBuckets; bucket++) {
440 SLIST_FOREACH(hent, &priv->tab[bucket], next) {
441 memcpy(ary->hosts[i].addr,
442 hent->host.addr,

Callers

nothing calls this directly

Calls 7

strtolFunction · 0.85
ng_bridge_remove_hostsFunction · 0.85
snprintfFunction · 0.85
bzeroFunction · 0.85
strncpyFunction · 0.85
ng_findhookFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected