4 #include "netinet/ipl.h"
7 void ipf_dotuning(fd, tuneargs, iocfn)
16 bzero((char *)&tu, sizeof(tu));
17 obj.ipfo_rev = IPFILTER_VERSION;
18 obj.ipfo_size = sizeof(tu);;
19 obj.ipfo_ptr = (void *)&tu;
20 obj.ipfo_type = IPFOBJ_TUNEABLE;
22 for (s = strtok(tuneargs, ","); s != NULL; s = strtok(NULL, ",")) {
23 if (!strcmp(s, "list")) {
25 if ((*iocfn)(fd, SIOCIPFGETNEXT, &obj) == -1) {
26 perror("ioctl(SIOCIPFGETNEXT)");
29 if (tu.ipft_cookie == NULL)
32 tu.ipft_name[sizeof(tu.ipft_name) - 1] = '\0';
35 } else if ((t = strchr(s, '=')) != NULL) {
37 strncpy(tu.ipft_name, s, sizeof(tu.ipft_name));
38 if (sscanf(t, "%lu", &tu.ipft_vlong) == 1) {
39 if ((*iocfn)(fd, SIOCIPFSET, &obj) == -1) {
40 perror("ioctl(SIOCIPFSET)");
44 fprintf(stderr, "invalid value '%s'\n", s);
48 strncpy(tu.ipft_name, s, sizeof(tu.ipft_name));
49 if ((*iocfn)(fd, SIOCIPFGET, &obj) == -1) {
50 perror("ioctl(SIOCIPFGET)");
53 if (tu.ipft_cookie == NULL)
56 tu.ipft_name[sizeof(tu.ipft_name) - 1] = '\0';