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

Function do_get3

tools/ipfw/ipfw2.c:648–669  ·  view source on GitHub ↗

* do_get3 - pass ipfw control cmd to kernel * @optname: option name * @optval: pointer to option data * @optlen: pointer to option length * * Assumes op3 header is already embedded. * Calls getsockopt() with IP_FW3 as kernel-visible opcode. * Returns 0 on success or errno otherwise. */

Source from the content-addressed store, hash-verified

646 * Returns 0 on success or errno otherwise.
647 */
648int
649do_get3(int optname, ip_fw3_opheader *op3, size_t *optlen)
650{
651 int error;
652 socklen_t len;
653
654 if (g_co.test_only)
655 return (0);
656
657 if (ipfw_socket == -1)
658 ipfw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
659 if (ipfw_socket < 0)
660 err(EX_UNAVAILABLE, "socket");
661
662 op3->opcode = optname;
663
664 len = *optlen;
665 error = getsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, &len);
666 *optlen = len;
667
668 return (error);
669}
670
671/**
672 * match_token takes a table and a string, returns the value associated

Callers 15

nat64clat_configFunction · 0.85
nat64clat_get_statsFunction · 0.85
nat64clat_foreachFunction · 0.85
table_get_infoFunction · 0.85
table_do_modify_recordFunction · 0.85
table_do_lookupFunction · 0.85
tables_foreachFunction · 0.85
table_do_get_listFunction · 0.85
table_do_get_stdlistFunction · 0.85
nat64lsn_states_cbFunction · 0.85
nat64lsn_configFunction · 0.85
nat64lsn_get_statsFunction · 0.85

Calls 2

getsockoptFunction · 0.85
socketClass · 0.50

Tested by

no test coverage detected