* do_set3 - pass ipfw control cmd to kernel * @optname: option name * @optval: pointer to option data * @optlen: option length * * Assumes op3 header is already embedded. * Calls setsockopt() with IP_FW3 as kernel-visible opcode. * Returns 0 on success or errno otherwise. */
| 619 | * Returns 0 on success or errno otherwise. |
| 620 | */ |
| 621 | int |
| 622 | do_set3(int optname, ip_fw3_opheader *op3, size_t optlen) |
| 623 | { |
| 624 | |
| 625 | if (g_co.test_only) |
| 626 | return (0); |
| 627 | |
| 628 | if (ipfw_socket == -1) |
| 629 | ipfw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); |
| 630 | if (ipfw_socket < 0) |
| 631 | err(EX_UNAVAILABLE, "socket"); |
| 632 | |
| 633 | op3->opcode = optname; |
| 634 | |
| 635 | return (setsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, optlen)); |
| 636 | } |
| 637 | |
| 638 | /* |
| 639 | * do_get3 - pass ipfw control cmd to kernel |
no test coverage detected