summaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-05-17 20:40:24 +0300
committerRoman Yeryomin <roman@advem.lv>2013-05-17 20:40:24 +0300
commite6d87036412b952cb083eff2dc716aee97a771f2 (patch)
tree273dd3daaa85553832d3cc6d48276229dc7fbe09 /target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c
parenta18fec42221baa52fff4c5ffd45ec8f32e3add36 (diff)
Move to rsdk 3.2.4. Compiles cleanly.
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c')
-rw-r--r--target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c268
1 files changed, 220 insertions, 48 deletions
diff --git a/target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c b/target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c
index 8be001711..269683038 100644
--- a/target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c
+++ b/target/linux/realtek/files/net/rtl/features/rtl_ps_hooks.c
@@ -33,12 +33,20 @@
#include <net/rtl/rtl865x_arp_api.h>
#endif
+#ifdef CONFIG_RTL_LAYERED_DRIVER_L2
+#include <net/rtl/rtl865x_fdb_api.h>
+#endif
+
#if defined(CONFIG_RTL_HW_QOS_SUPPORT) && defined(CONFIG_RTL_HARDWARE_NAT)
#include <net/rtl/rtl865x_netif.h>
#include <net/rtl/rtl865x_outputQueue.h>
#endif
-#ifdef CONFIG_RTL_HARDWARE_NAT
+#if defined (CONFIG_RTL865X_LANPORT_RESTRICTION)
+#include <net/rtl/features/lan_restrict.h>
+#endif
+
+#ifdef CONFIG_RTL_HARDWARE_NAT
//#define CONFIG_HARDWARE_NAT_DEBUG
#ifdef CONFIG_RTL_LAYERED_DRIVER_L3
#include <net/rtl/rtl865x_ppp.h>
@@ -48,7 +56,7 @@
extern int gHwNatEnabled;
#endif
-#ifdef CONFIG_RTL_HARDWARE_NAT
+#ifdef CONFIG_RTL_HARDWARE_NAT
/*2007-12-19*/
#ifdef CONFIG_RTL_LAYERED_DRIVER_L3
#include <net/rtl/rtl865x_ip_api.h>
@@ -64,18 +72,21 @@ extern unsigned int hw_napt_ip;
enum LR_RESULT (*FastPath_hook5)( ipaddr_t ip, ether_addr_t* mac, enum ARP_FLAGS flags )=NULL;
enum LR_RESULT (*FastPath_hook7)( ipaddr_t ip )=NULL;
enum LR_RESULT (*FastPath_hook8)( ipaddr_t ip, ether_addr_t* mac, enum ARP_FLAGS flags )=NULL;
-EXPORT_SYMBOL(FastPath_hook8);
-EXPORT_SYMBOL(FastPath_hook7);
-EXPORT_SYMBOL(FastPath_hook5);
+EXPORT_SYMBOL(FastPath_hook8);
+EXPORT_SYMBOL(FastPath_hook7);
+EXPORT_SYMBOL(FastPath_hook5);
#endif
-
int32 rtl_nf_conntrack_in_hooks(rtl_nf_conntrack_inso_s *info)
{
- #if !defined(IMPROVE_QOS) && defined(CONFIG_RTL_IPTABLES_FAST_PATH)
- rtl_fpAddConnCache(info->ct, info->skb);
+#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
+ #if !defined(IMPROVE_QOS)
+ rtl_fpAddConnCache(info->ct, info->skb);
+ #elif defined(CONFIG_RTL_ROUTER_FAST_PATH)
+ if(routerTypeFlag == 1)
+ rtl_fpAddConnCache(info->ct, info->skb);
#endif
-
+#endif
return RTL_PS_HOOKS_CONTINUE;
}
@@ -105,7 +116,7 @@ int32 rtl_nf_conntrack_destroy_hooks(rtl_nf_conntrack_inso_s *info)
int32 rtl_nf_conntrack_confirm_hooks(rtl_nf_conntrack_inso_s *info)
{
#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
- rtl_connGC_addList(info->skb, info->ct);
+ rtl_connGC_addList((void*)info->skb, (void*)info->ct);
#endif
return RTL_PS_HOOKS_CONTINUE;
@@ -149,13 +160,58 @@ int32 rtl_nf_nat_packet_hooks(rtl_nf_conntrack_inso_s *info)
return RTL_PS_HOOKS_CONTINUE;
}
+#ifdef CONFIG_RTL_WLAN_DOS_FILTER
+#define RTL_WLAN_NAME "wlan"
+#define TCP_SYN 2
+#define _MAX_SYN_THRESHOLD 400
+#define _WLAN_BLOCK_TIME 20 // unit: seconds
+
+int wlan_syn_cnt=0;
+int wlan_block=0, wlan_block_count=0;
+unsigned int dbg_wlan_dos_block_pkt_num=0;
+unsigned char block_source_mac[6];
+int wlan_dos_filter_enabled = 1;
+
+extern unsigned int _br0_ip;
+
+#if defined(CONFIG_RTL8192CD) || defined(CONFIG_RTL8192E)
+extern int issue_disassoc_from_kernel(void *priv, unsigned char *mac);
+#endif
+
+static struct timer_list wlan_dos_timer;
+static void wlan_dos_timer_fn(unsigned long arg)
+{
+ wlan_syn_cnt = 0;
+
+ if(wlan_block_count >=_WLAN_BLOCK_TIME) {
+ wlan_block=0;
+ wlan_block_count=0;
+ }
+ if(wlan_block == 1)
+ wlan_block_count++;
+
+ mod_timer(&wlan_dos_timer, jiffies + HZ);
+}
+
+#endif
+
int32 rtl_nat_init_hooks(void)
{
+#ifdef CONFIG_RTL_819X_SWCORE
rtl_nat_init();
+#endif
#if defined(CONFIG_NET_SCHED)
rtl_qos_init();
#endif
+#ifdef CONFIG_RTL_WLAN_DOS_FILTER
+ init_timer(&wlan_dos_timer);
+ wlan_dos_timer.expires = jiffies + HZ;
+ wlan_dos_timer.data = 0L;
+ wlan_dos_timer.function = wlan_dos_timer_fn;
+ mod_timer(&wlan_dos_timer, jiffies + HZ);
+ #endif
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -205,7 +261,7 @@ int32 rtl_fn_hash_delete_hooks(struct fib_table *tb, struct fib_config *cfg)
#if defined(CONFIG_RTL_HARDWARE_NAT)
rtl_fn_delete(tb, cfg);
#endif
-
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -252,6 +308,76 @@ int32 rtl_dev_hard_start_xmit_hooks(struct sk_buff *skb, struct net_device *dev,
return RTL_PS_HOOKS_CONTINUE;
}
+#ifdef CONFIG_RTL_WLAN_DOS_FILTER
+
+static int filter_dos_wlan(struct sk_buff *skb)
+{
+ struct iphdr *iph;
+ struct tcphdr *tcph;
+ unsigned char *tflag;
+ int ret=NF_ACCEPT;
+
+ iph=ip_hdr(skb);
+ tcph=(void *) iph + iph->ihl*4;
+ tflag=(void *) tcph + 13;
+
+ //wlan_dev=__dev_get_by_name(&init_net,RTL_PS_WLAN0_DEV_NAME); // wlan0
+ //wlan_dev=__dev_get_by_name(&init_net,RTL_PS_LAN_P0_DEV_NAME); // eth0
+
+ //if(skb->dev && (skb->dev == wlan_dev))
+
+ if ((skb->dev) && (!strncmp(skb->dev->name, RTL_WLAN_NAME, 4))) // wlan0, wlan1, wlan0-va0, ... and so on
+ {
+ if ((iph->protocol==IPPROTO_TCP) && ((*tflag & 0x3f)==TCP_SYN) && (iph->daddr == _br0_ip)) // xdos.exe 192.168.1.254 0-65535
+ {
+ //if(wlan_block==1 && attack_daddr2==iph->daddr) {
+ if ((wlan_block==1) && (memcmp(block_source_mac, &(skb->mac_header[6]), 6) == 0)) {
+ dbg_wlan_dos_block_pkt_num++;
+ ret = NF_DROP;
+ }
+ else {
+ wlan_syn_cnt++;
+
+ if(wlan_syn_cnt > _MAX_SYN_THRESHOLD)
+ {
+ //attack_daddr2=iph->daddr;
+ wlan_block=1;
+
+#if defined(CONFIG_RTL8192CD) || defined(CONFIG_RTL8192E)
+ issue_disassoc_from_kernel((void *) skb->dev->priv, &(skb->mac_header[6]));
+#endif
+ memcpy(block_source_mac, &(skb->mac_header[6]), 6);
+ }
+ }
+ }
+
+ }
+
+ return (ret);
+}
+
+int filter_dos_wlan_enter(struct sk_buff **pskb)
+{
+ int ret;
+ struct sk_buff *skb;
+
+ skb=*pskb;
+ skb->transport_header=skb->data;
+ skb->network_header = skb->data;
+
+ ret = filter_dos_wlan((void*)skb);
+ if (ret == NF_DROP) {
+ kfree_skb(skb);
+ ret = NET_RX_DROP;
+ }
+ else {
+ ret = NET_RX_SUCCESS;
+ }
+
+ return ret;
+}
+#endif
+
int32 rtl_netif_receive_skb_hooks(struct sk_buff **pskb)
{
int ret;
@@ -261,6 +387,13 @@ int32 rtl_netif_receive_skb_hooks(struct sk_buff **pskb)
ret = RTL_PS_HOOKS_RETURN;
} else
#endif
+
+ #ifdef CONFIG_RTL_WLAN_DOS_FILTER
+ if (wlan_dos_filter_enabled && filter_dos_wlan_enter(pskb)== NET_RX_DROP) {
+ ret = RTL_PS_HOOKS_RETURN;
+ } else
+ #endif
+
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
if (FastPath_Enter(pskb)== NET_RX_DROP) {
ret = RTL_PS_HOOKS_RETURN;
@@ -278,7 +411,7 @@ int32 rtl_br_dev_queue_push_xmit_before_xmit_hooks(struct sk_buff *skb)
#if defined(CONFIG_RTL_FAST_BRIDGE)
rtl_fb_add_br_entry(skb);
#endif
-
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -310,7 +443,7 @@ int32 rtl_neigh_flush_dev_hooks(struct neigh_table *tbl, struct net_device *dev,
#endif
}
#endif
-
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -342,7 +475,7 @@ int32 rtl_neigh_update_hooks(struct neighbour *neigh, const u8 *lladdr, uint8 ol
}
#else
rtk_modifyArp(*(u32*)neigh->primary_key, (ether_addr_t*)lladdr, ARP_NONE);
- #endif
+ #endif
}
#endif
@@ -393,7 +526,7 @@ int32 rtl_neigh_periodic_timer_hooks(struct neighbour *n, unsigned int refres
if (!(n->nud_state & NUD_VALID))
return RTL_PS_HOOKS_CONTINUE;
-
+
ret = RTL_PS_HOOKS_CONTINUE;
#if defined(CONFIG_RTL_HARDWARE_NAT) && defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L3)
if (rtl865x_arpSync(htonl(*((u32 *)n->primary_key)), refresh)>0) {
@@ -401,7 +534,7 @@ int32 rtl_neigh_periodic_timer_hooks(struct neighbour *n, unsigned int refres
n->dead=0;
ret = RTL_PS_HOOKS_BREAK;
}
- else
+ else
#endif
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
@@ -425,7 +558,7 @@ int32 rtl_neigh_timer_handler_pre_update_hooks(struct neighbour *neigh, unsigned
#if defined(CONFIG_RTL_HARDWARE_NAT) && defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L3)
int32 tval;
#endif
-
+
if (state & NUD_REACHABLE) {
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
if (neigh->nud_state & NUD_VALID) {
@@ -442,13 +575,13 @@ int32 rtl_neigh_timer_handler_pre_update_hooks(struct neighbour *neigh, unsigned
#if defined(CONFIG_RTL_HARDWARE_NAT) && defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L3)
tval = rtl865x_arpSync(htonl(*((u32 *)neigh->primary_key)), 0);
- if (tval > 0)
+ if (tval > 0)
{
neigh->confirmed = jiffies;
}
#if 0
printk("%s:%d: ip:%u.%u.%u.%u, mac:%x:%x:%x:%x:%x:%x, tval is %d\n",
- __FUNCTION__,__LINE__,NIPQUAD(htonl(*((u32 *)neigh->primary_key))), neigh->ha[0], neigh->ha[1],
+ __FUNCTION__,__LINE__,NIPQUAD(htonl(*((u32 *)neigh->primary_key))), neigh->ha[0], neigh->ha[1],
neigh->ha[2], neigh->ha[3], neigh->ha[4], neigh->ha[5],tval);
#endif
#endif
@@ -456,13 +589,13 @@ int32 rtl_neigh_timer_handler_pre_update_hooks(struct neighbour *neigh, unsigned
} else if (state & NUD_DELAY) {
#if defined(CONFIG_RTL_HARDWARE_NAT) && defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L3)
tval = rtl865x_arpSync(htonl(*((u32 *)neigh->primary_key)), 0);
- if (tval > 0)
+ if (tval > 0)
{
neigh->confirmed = jiffies;
}
#if 0
printk("%s:%d: ip:%u.%u.%u.%u, mac:%x:%x:%x:%x:%x:%x, tval is %d",
- __FUNCTION__,__LINE__,NIPQUAD(htonl(*((u32 *)neigh->primary_key))), neigh->ha[0], neigh->ha[1],
+ __FUNCTION__,__LINE__,NIPQUAD(htonl(*((u32 *)neigh->primary_key))), neigh->ha[0], neigh->ha[1],
neigh->ha[2], neigh->ha[3], neigh->ha[4], neigh->ha[5],tval);
#endif
#endif
@@ -480,8 +613,8 @@ int32 rtl_neigh_timer_handler_during_update_hooks(struct neighbour *neigh, unsig
/*delete asic arp entry*/
syn_asic_arp(neigh, 0);
#if 0
- printk("%s:%d: ip:%u.%u.%u.%u, mac:%x:%x:%x:%x:%x:%x\n",
- __FUNCTION__,__LINE__,NIPQUAD(htonl(*((u32 *)neigh->primary_key))), neigh->ha[0], neigh->ha[1],
+ printk("%s:%d: ip:%u.%u.%u.%u, mac:%x:%x:%x:%x:%x:%x\n",
+ __FUNCTION__,__LINE__,NIPQUAD(htonl(*((u32 *)neigh->primary_key))), neigh->ha[0], neigh->ha[1],
neigh->ha[2], neigh->ha[3], neigh->ha[4],neigh->ha[5]);
#endif
}
@@ -550,7 +683,7 @@ int32 rtl_neigh_init_hooks(void)
#if defined(CONFIG_BRIDGE)
int32 rtl___br_fdb_get_timeout_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *fdb, const unsigned char *addr)
{
- #if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
+ #if defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_FASTBRIDGE)
if (rtl_br_fdb_time_update((void*)br, (void*)fdb, addr)==FAILED) {
return RTL_PS_HOOKS_BREAK;
}
@@ -600,12 +733,12 @@ int32 rtl_translate_table_hooks(const char *name,
const unsigned int *hook_entries,
const unsigned int *underflows)
{
-#if defined(CONFIG_RTL_HARDWARE_NAT)
+#if defined(CONFIG_RTL_HARDWARE_NAT)
//hyking:check masquerade and add ip
if(strcmp(name,"nat") == 0)
{
rtl_flush_extern_ip();
- rtl_init_masq_info();
+ rtl_init_masq_info();
rtl_check_for_extern_ip(name,valid_hooks,newinfo,entry0,size,number,hook_entries,underflows);
}
#endif
@@ -618,7 +751,7 @@ int32 rtl_ip_tables_init_hooks(void)
#if defined(CONFIG_RTL_HARDWARE_NAT)
rtl_init_masq_info();
#endif
-
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -645,7 +778,7 @@ int32 rtl_ip_vs_conn_expire_hooks2(struct ip_vs_conn *cp)
return RTL_PS_HOOKS_CONTINUE;
}
-
+
#if defined(CONFIG_IP_VS_PROTO_TCP)
int32 rtl_tcp_state_transition_hooks(struct ip_vs_conn *cp, int direction, const struct sk_buff *skb, struct ip_vs_protocol *pp)
{
@@ -678,7 +811,7 @@ int rtl_ct_seq_show_hooks(struct seq_file *s, struct nf_conn *ct)
nat = nfct_nat(ct);
if(seq_printf(s,"[%s] ",nat->hw_acc?state[0]:state[1]) != 0)
- return RTL_PS_HOOKS_BREAK;
+ return RTL_PS_HOOKS_BREAK;
#endif
return RTL_PS_HOOKS_CONTINUE;
}
@@ -709,7 +842,7 @@ int32 rtl_dst_alloc_gc_post_check1_hooks(struct dst_ops * ops)
#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
rtl_gc_overflow_timeout=jiffies+rtl_gc_overflow_timout;
#endif
-
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -719,7 +852,7 @@ int32 rtl_dst_alloc_gc_post_check2_hooks(struct dst_ops * ops, struct dst_entry
#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
rtl_gc_overflow_timeout=0;
#endif
-
+
return RTL_PS_HOOKS_CONTINUE;
}
@@ -735,16 +868,16 @@ int32 clean_from_lists_hooks(struct nf_conn *ct, struct net *net)
}
// hooks in __nf_ct_refresh_acct_proto at rtl_nf_connGC.c
-int32 __nf_ct_refresh_acct_proto_hooks(struct nf_conn *ct,
+int32 __nf_ct_refresh_acct_proto_hooks(struct nf_conn *ct,
enum ip_conntrack_info ctinfo,
- const struct sk_buff *skb,
+ const struct sk_buff *skb,
int do_acct,
int *event)
{
#ifdef CONFIG_IP_NF_CT_ACCT
if (do_acct) {
ct->counters[CTINFO2DIR(ctinfo)].packets++;
- ct->counters[CTINFO2DIR(ctinfo)].bytes +=
+ ct->counters[CTINFO2DIR(ctinfo)].bytes +=
ntohs(skb->nh.iph->tot_len);
if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000)
|| (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000))
@@ -761,9 +894,9 @@ int32 __drop_one_conntrack_process_hooks1(struct nf_conn* ct, int dropPrioIdx, i
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT)
if (checkFlags==TRUE && drop_priority[dropPrioIdx].state==tcpUdpState) {
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
- if (FAILED==rtl_fpTimer_update(ct)) {
+ if (FAILED==rtl_fpTimer_update((void*)ct)) {
read_unlock_bh(&nf_conntrack_lock);
- rtl_death_action(ct);
+ rtl_death_action((void*)ct);
return RTL_PS_HOOKS_RETURN;
}
#endif
@@ -771,7 +904,7 @@ int32 __drop_one_conntrack_process_hooks1(struct nf_conn* ct, int dropPrioIdx, i
#if defined(CONFIG_RTL_HARDWARE_NAT)
if (FAILED==rtl_hwnat_timer_update(ct)) {
read_unlock_bh(&nf_conntrack_lock);
- rtl_death_action(ct);
+ rtl_death_action((void*)ct);
return RTL_PS_HOOKS_RETURN;
}
#endif
@@ -786,7 +919,7 @@ int32 __drop_one_conntrack_process_hooks1(struct nf_conn* ct, int dropPrioIdx, i
#endif
{
read_unlock_bh(&nf_conntrack_lock);
- rtl_death_action(ct);
+ rtl_death_action((void*)ct);
return RTL_PS_HOOKS_RETURN;
}
@@ -819,9 +952,28 @@ int32 rtl_nf_conn_GC_init_hooks(void)
#if defined(CONFIG_BRIDGE)
+int32 rtl_fdb_create_hooks(struct net_bridge_fdb_entry *fdb,const unsigned char *addr)
+{
+#if defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L2)
+ #if defined (CONFIG_RTL865X_LANPORT_RESTRICTION)
+ if (fdb->is_static == 0)
+ {
+ rtl865x_addAuthFDBEntry_hooks(addr);
+ }
+
+ #else
+ //fdb->ageing_timer = 300*HZ;
+ rtl865x_addFDBEntry(addr);
+ #endif
+#endif
+
+return RTL_PS_HOOKS_CONTINUE;
+
+}
int32 rtl_fdb_delete_hooks(struct net_bridge_fdb_entry *f)
{
-#if defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L2) && defined(CONFIG_RTL865X_SYNC_L2)
+
+#if defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L2) //&& defined(CONFIG_RTL865X_SYNC_L2)
#if defined (CONFIG_RTL865X_LANPORT_RESTRICTION)
rtl865x_delAuthLanFDBEntry(RTL865x_L2_TYPEII, f->addr.addr);
#else
@@ -835,19 +987,28 @@ int32 rtl_fdb_delete_hooks(struct net_bridge_fdb_entry *f)
return RTL_PS_HOOKS_CONTINUE;
}
-int32 rtl_br_fdb_cleanup_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *f)
+
+int32 rtl_br_fdb_cleanup_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *f, unsigned long delay)
{
#if defined(CONFIG_RTL_FASTBRIDGE)
unsigned long fb_aging;
#endif
#if defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L2) && defined(CONFIG_RTL865X_SYNC_L2)
int32 port_num;
- int ret;
unsigned long hw_aging;
#endif
+ int ret;
+
+ /*printk("timelist as follow:(s)jiffies:%ld,f->ageing_timer:%ld,delay:%ld",jiffies/HZ,f->ageing_timer/HZ,delay/HZ);*/
+ if (time_after(f->ageing_timer, jiffies))
+ {
+ DEBUG_PRINT("\nf->ageing_timer AFTER jiffies:addr is :%x,%x,%x,%x,%x,%x\n",f->addr.addr[0],f->addr.addr[1],f->addr.addr[2],f->addr.addr[3],f->addr.addr[4],f->addr.addr[5]);
+ DEBUG_PRINT("time list:jiffies:%ld,hw_aging:%ld,f->ageing_timer:%ld\n",jiffies/HZ,hw_aging/HZ,f->ageing_timer/HZ );
+ return RTL_PS_HOOKS_BREAK;
+ }
- #if defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L2) && defined(CONFIG_RTL865X_SYNC_L2)
- port_num= -100
+ #if defined(CONFIG_RTL_LAYERED_DRIVER) && defined(CONFIG_RTL_LAYERED_DRIVER_L2) && defined(CONFIG_RTL865X_SYNC_L2)
+ port_num= -100;
ret = rtl865x_arrangeFdbEntry(f->addr.addr, &port_num);
switch (ret) {
@@ -857,29 +1018,40 @@ int32 rtl_br_fdb_cleanup_hooks(struct net_bridge *br, struct net_bridge_fdb_entr
case RTL865X_FDBENTRY_300SEC:
hw_aging = jiffies -150*HZ;
break;
- case RTL865X_FDBENTRY_150SEC:
+ case RTL865X_FDBENTRY_150SEC:
hw_aging = jiffies -300*HZ;
break;
case RTL865X_FDBENTRY_TIMEOUT:
case FAILED:
default:
- hw_aging = jiffies - (br->forward_delay<<1);
- break;
+ hw_aging =jiffies -450*HZ;
+ break;
}
+ ret = 0;
if(time_before_eq(f->ageing_timer, hw_aging))
+ {
+ /*fresh f->ageing_timer*/
f->ageing_timer = hw_aging;
+ }
#endif
#if defined(CONFIG_RTL_FASTBRIDGE)
fb_aging = rtl_fb_get_entry_lastused(f->addr.addr);
if(time_before_eq(f->ageing_timer, fb_aging))
+ {
f->ageing_timer = fb_aging;
+ }
#endif
- return RTL_PS_HOOKS_CONTINUE;
+ if (ret==0) {
+ return RTL_PS_HOOKS_CONTINUE;
+ } else {
+ return RTL_PS_HOOKS_BREAK;
+ }
}
+
#endif /* defined(CONFIG_BRIDGE) */
-
+