[qca-ssdk]: support new wan interface br-wan
Change-Id: I04abb06092c04b2cf543c50ad8d16dfa3489350b
Signed-off-by: xiaofeis <xiaofeis@codeaurora.org>
diff --git a/app/nathelper/linux/host_helper.c b/app/nathelper/linux/host_helper.c
index 850fa69..8140233 100755
--- a/app/nathelper/linux/host_helper.c
+++ b/app/nathelper/linux/host_helper.c
@@ -96,7 +96,7 @@
//char *nat_lan_dev_list = "eth0.1";
char nat_lan_dev_list[IFNAMSIZ*4] = "br-lan eth0.1";
-char nat_wan_dev_list[IFNAMSIZ*4] = "eth0.2";
+char nat_wan_dev_list[IFNAMSIZ*5] = "eth0.2";
char nat_wan_port = 0x20;
int setup_wan_if = 0;
@@ -783,9 +783,10 @@
{
/* Get bridge interface name */
br_name = (char *)(br_port_get_rcu(nat_dev)->br->dev->name);
- //memcpy (nat_bridge_dev, br_name, sizeof(br_name));
- strlcat (nat_lan_dev_list, " ", sizeof(nat_lan_dev_list));
- strlcat (nat_lan_dev_list, br_name, sizeof(nat_lan_dev_list));
+ if (!is_wan) {
+ strlcat (nat_lan_dev_list, " ", sizeof(nat_lan_dev_list));
+ strlcat (nat_lan_dev_list, br_name, sizeof(nat_lan_dev_list));
+ }
/* Get dmac */
devmac = (uint8_t *)(br_port_get_rcu(nat_dev)->br->dev->dev_addr);
}
@@ -871,7 +872,11 @@
}
#endif
if (1 == is_wan) {
- in_device_wan = (struct in_device *) nat_dev->ip_ptr;
+ if (br_port_get_rcu(nat_dev)) {
+ in_device_wan = (struct in_device *) (br_port_get_rcu(nat_dev)->br->dev->ip_ptr);
+ } else {
+ in_device_wan = (struct in_device *) nat_dev->ip_ptr;
+ }
if((nf_athrs17_hnat_wan_type == NF_S17_WAN_TYPE_IP) &&
(in_device_wan) && (in_device_wan->ifa_list))
{
@@ -925,7 +930,9 @@
/*wan port*/
HNAT_PRINTK("wan port vid:%d\n", tmp_vid);
nat_wan_vid = tmp_vid;
- snprintf(nat_wan_dev_list, IFNAMSIZ*4, "eth0.%d eth0 pppoe-wan erouter0", tmp_vid);
+ snprintf(nat_wan_dev_list, IFNAMSIZ*5,
+ "eth0.%d eth0 pppoe-wan erouter0 br-wan",
+ tmp_vid);
} else {
/*lan port*/
HNAT_PRINTK("lan port vid:%d\n", tmp_vid);
diff --git a/app/nathelper/linux/napt_helper.c b/app/nathelper/linux/napt_helper.c
index e5fd5b4..204fc4e 100755
--- a/app/nathelper/linux/napt_helper.c
+++ b/app/nathelper/linux/napt_helper.c
@@ -251,7 +251,8 @@
dev = ip_dev_find(&init_net, dst_ip);
if(dev) {
if(dev->type == ARPHRD_ETHER) {
- if(strstr(dev->name, "eth0") || strstr(dev->name, "erouter0")) {
+ if(strstr(dev->name, "eth0") || strstr(dev->name, "erouter0") ||
+ strstr(dev->name, "br-wan")) {
dev_put(dev);
return 1;
}