diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2019-01-18 21:46:38 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2019-01-18 21:46:38 +0000 |
commit | c53d6b90baf7e0de7a33920c653e85f194deb793 (patch) | |
tree | c790c024290f22a05abef7c213d50d5651cd5398 /sys/netinet/siftr.c | |
parent | e4478d7e46876142b5f75cfc93ef649a6bde05ae (diff) | |
download | src-test2-c53d6b90baf7e0de7a33920c653e85f194deb793.tar.gz src-test2-c53d6b90baf7e0de7a33920c653e85f194deb793.zip |
Notes
Diffstat (limited to 'sys/netinet/siftr.c')
-rw-r--r-- | sys/netinet/siftr.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index e8c111719320..217d41c44723 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -1219,7 +1219,7 @@ siftr_manage_ops(uint8_t action) if ((s = sbuf_new(NULL, NULL, 200, SBUF_AUTOEXTEND)) == NULL) return (-1); - if (action == SIFTR_ENABLE) { + if (action == SIFTR_ENABLE && siftr_pkt_manager_thr == NULL) { /* * Create our alq * XXX: We should abort if alq_open fails! @@ -1424,7 +1424,8 @@ siftr_manage_ops(uint8_t action) alq_close(siftr_alq); siftr_alq = NULL; - } + } else + error = EINVAL; sbuf_delete(s); @@ -1445,13 +1446,15 @@ siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS) new = siftr_enabled; error = sysctl_handle_int(oidp, &new, 0, req); - if (error != 0 && req->newptr != NULL) { + if (error == 0 && req->newptr != NULL) { if (new > 1) return (EINVAL); else if (new != siftr_enabled) { - error = siftr_manage_ops(new); - if (error != 0) + if ((error = siftr_manage_ops(new)) == 0) { + siftr_enabled = new; + } else { siftr_manage_ops(SIFTR_DISABLE); + } } } @@ -1462,7 +1465,9 @@ siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS) static void siftr_shutdown_handler(void *arg) { - siftr_manage_ops(SIFTR_DISABLE); + if (siftr_enabled == 1) { + siftr_manage_ops(SIFTR_DISABLE); + } } |