From 4a350ddd030cb5c2a3186c83d84631a63e337430 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sat, 3 Oct 2009 00:11:37 +0200 Subject: [PATCH] pknock: move more kernel parts from include file to .c All of this does not seem to have a userspace part. --- extensions/xt_pknock.c | 46 ++++++++++++++++++++++++++++++++++++++++++ extensions/xt_pknock.h | 37 --------------------------------- 2 files changed, 46 insertions(+), 37 deletions(-) diff --git a/extensions/xt_pknock.c b/extensions/xt_pknock.c index fb7e484..6200b5e 100644 --- a/extensions/xt_pknock.c +++ b/extensions/xt_pknock.c @@ -22,7 +22,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -38,6 +40,50 @@ # define PK_CRYPTO 1 #endif +enum status { + ST_INIT = 1, + ST_MATCHING, + ST_ALLOWED, +}; + +/** + * @login_min: the login epoch minute + */ +struct peer { + struct list_head head; + uint32_t ip; + uint8_t proto; + uint32_t id_port_knocked; + enum status status; + unsigned long timestamp; + int login_min; +}; + +/** + * @timer: garbage collector timer + * @max_time: max matching time between ports + */ +struct xt_pknock_rule { + struct list_head head; + char rule_name[IPT_PKNOCK_MAX_BUF_LEN + 1]; + int rule_name_len; + unsigned int ref_count; + struct timer_list timer; + struct list_head *peer_head; + struct proc_dir_entry *status_proc; + unsigned long max_time; +}; + +/** + * @port: destination port + */ +struct transport_data { + uint8_t proto; + uint16_t port; + int payload_len; + const unsigned char *payload; +}; + MODULE_LICENSE("GPL"); MODULE_AUTHOR("J. Federico Hernandez Scarso, Luis A. Floreani"); MODULE_DESCRIPTION("netfilter match for Port Knocking and SPA"); diff --git a/extensions/xt_pknock.h b/extensions/xt_pknock.h index 38105aa..6c502ed 100644 --- a/extensions/xt_pknock.h +++ b/extensions/xt_pknock.h @@ -45,41 +45,4 @@ struct xt_pknock_nl_msg { uint32_t peer_ip; }; -enum status {ST_INIT=1, ST_MATCHING, ST_ALLOWED}; - -#ifdef __KERNEL__ -#include -#include - -struct peer { - struct list_head head; - uint32_t ip; - uint8_t proto; - uint32_t id_port_knocked; - enum status status; - unsigned long timestamp; - int login_min; /* the login epoch minute */ -}; - -#include - -struct xt_pknock_rule { - struct list_head head; - char rule_name[IPT_PKNOCK_MAX_BUF_LEN + 1]; - int rule_name_len; - unsigned int ref_count; - struct timer_list timer; /* garbage collector timer */ - struct list_head *peer_head; - struct proc_dir_entry *status_proc; - unsigned long max_time; /* max matching time between ports */ -}; - -struct transport_data { - uint8_t proto; - uint16_t port; /* destination port */ - int payload_len; - const unsigned char *payload; -}; - -#endif /* __KERNEL__ */ #endif /* _XT_PKNOCK_H */