2727#include <net/net_namespace.h>
2828
2929#include <linux/netfilter/x_tables.h>
30- #include <linux/netfilter_ipv4/ipt_recent .h>
30+ #include <linux/netfilter/xt_recent .h>
3131
3232MODULE_AUTHOR ("Patrick McHardy <kaber@trash.net>" );
3333MODULE_DESCRIPTION ("Xtables: \"recently-seen\" host matching for IPv4" );
3434MODULE_LICENSE ("GPL" );
35+ MODULE_ALIAS ("ipt_recent" );
3536
3637static unsigned int ip_list_tot = 100 ;
3738static unsigned int ip_pkt_list_tot = 20 ;
@@ -64,7 +65,7 @@ struct recent_entry {
6465
6566struct recent_table {
6667 struct list_head list ;
67- char name [IPT_RECENT_NAME_LEN ];
68+ char name [XT_RECENT_NAME_LEN ];
6869#ifdef CONFIG_PROC_FS
6970 struct proc_dir_entry * proc ;
7071#endif
@@ -175,14 +176,14 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
175176 const void * matchinfo , int offset , unsigned int protoff ,
176177 bool * hotdrop )
177178{
178- const struct ipt_recent_info * info = matchinfo ;
179+ const struct xt_recent_mtinfo * info = matchinfo ;
179180 struct recent_table * t ;
180181 struct recent_entry * e ;
181182 __be32 addr ;
182183 u_int8_t ttl ;
183184 bool ret = info -> invert ;
184185
185- if (info -> side == IPT_RECENT_DEST )
186+ if (info -> side == XT_RECENT_DEST )
186187 addr = ip_hdr (skb )-> daddr ;
187188 else
188189 addr = ip_hdr (skb )-> saddr ;
@@ -195,9 +196,9 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
195196 spin_lock_bh (& recent_lock );
196197 t = recent_table_lookup (info -> name );
197198 e = recent_entry_lookup (t , addr ,
198- info -> check_set & IPT_RECENT_TTL ? ttl : 0 );
199+ info -> check_set & XT_RECENT_TTL ? ttl : 0 );
199200 if (e == NULL ) {
200- if (!(info -> check_set & IPT_RECENT_SET ))
201+ if (!(info -> check_set & XT_RECENT_SET ))
201202 goto out ;
202203 e = recent_entry_init (t , addr , ttl );
203204 if (e == NULL )
@@ -206,12 +207,12 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
206207 goto out ;
207208 }
208209
209- if (info -> check_set & IPT_RECENT_SET )
210+ if (info -> check_set & XT_RECENT_SET )
210211 ret = !ret ;
211- else if (info -> check_set & IPT_RECENT_REMOVE ) {
212+ else if (info -> check_set & XT_RECENT_REMOVE ) {
212213 recent_entry_remove (t , e );
213214 ret = !ret ;
214- } else if (info -> check_set & (IPT_RECENT_CHECK | IPT_RECENT_UPDATE )) {
215+ } else if (info -> check_set & (XT_RECENT_CHECK | XT_RECENT_UPDATE )) {
215216 unsigned long time = jiffies - info -> seconds * HZ ;
216217 unsigned int i , hits = 0 ;
217218
@@ -225,8 +226,8 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
225226 }
226227 }
227228
228- if (info -> check_set & IPT_RECENT_SET ||
229- (info -> check_set & IPT_RECENT_UPDATE && ret )) {
229+ if (info -> check_set & XT_RECENT_SET ||
230+ (info -> check_set & XT_RECENT_UPDATE && ret )) {
230231 recent_entry_update (t , e );
231232 e -> ttl = ttl ;
232233 }
@@ -240,22 +241,22 @@ recent_mt_check(const char *tablename, const void *ip,
240241 const struct xt_match * match , void * matchinfo ,
241242 unsigned int hook_mask )
242243{
243- const struct ipt_recent_info * info = matchinfo ;
244+ const struct xt_recent_mtinfo * info = matchinfo ;
244245 struct recent_table * t ;
245246 unsigned i ;
246247 bool ret = false;
247248
248249 if (hweight8 (info -> check_set &
249- (IPT_RECENT_SET | IPT_RECENT_REMOVE |
250- IPT_RECENT_CHECK | IPT_RECENT_UPDATE )) != 1 )
250+ (XT_RECENT_SET | XT_RECENT_REMOVE |
251+ XT_RECENT_CHECK | XT_RECENT_UPDATE )) != 1 )
251252 return false;
252- if ((info -> check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE )) &&
253+ if ((info -> check_set & (XT_RECENT_SET | XT_RECENT_REMOVE )) &&
253254 (info -> seconds || info -> hit_count ))
254255 return false;
255256 if (info -> hit_count > ip_pkt_list_tot )
256257 return false;
257258 if (info -> name [0 ] == '\0' ||
258- strnlen (info -> name , IPT_RECENT_NAME_LEN ) == IPT_RECENT_NAME_LEN )
259+ strnlen (info -> name , XT_RECENT_NAME_LEN ) == XT_RECENT_NAME_LEN )
259260 return false;
260261
261262 mutex_lock (& recent_mutex );
@@ -296,7 +297,7 @@ recent_mt_check(const char *tablename, const void *ip,
296297
297298static void recent_mt_destroy (const struct xt_match * match , void * matchinfo )
298299{
299- const struct ipt_recent_info * info = matchinfo ;
300+ const struct xt_recent_mtinfo * info = matchinfo ;
300301 struct recent_table * t ;
301302
302303 mutex_lock (& recent_mutex );
@@ -461,7 +462,7 @@ static struct xt_match recent_mt_reg __read_mostly = {
461462 .name = "recent" ,
462463 .family = AF_INET ,
463464 .match = recent_mt ,
464- .matchsize = sizeof (struct ipt_recent_info ),
465+ .matchsize = sizeof (struct xt_recent_mtinfo ),
465466 .checkentry = recent_mt_check ,
466467 .destroy = recent_mt_destroy ,
467468 .me = THIS_MODULE ,
0 commit comments