{\r
for_each(interface, interfaces)\r
{\r
- sprintf(str,"-A %s -s %s -o %s -j ACCEPT", interface->chain, qos_free_zone, interface->name);\r
+ sprintf(str,"-A %s -%c %s -o %s -j ACCEPT", interface->chain, (interface->is_upstream?'d':'s'), qos_free_zone, interface->name);\r
iptables_save_line(str, FALSE);\r
}\r
}\r
buf = interface->chain;\r
}\r
\r
- sprintf(str,"-A %s -d %s/%d -o %s -j %s_%s", buf, subnet, idx->bitmask, interface->name, interface->idxprefix, idx->id);\r
+ sprintf(str, "-A %s -%c %s/%d -o %s -j %s_%s", \r
+ buf, (interface->is_upstream?'s':'d'), subnet, idx->bitmask, interface->name, interface->idxprefix, idx->id);\r
iptables_save_line(str, idx->ipv6);\r
\r
- sprintf(str,"-A %s -d %s/%d -o %s -j %s_common", buf, subnet, idx->bitmask, interface->name, interface->idxprefix);\r
+ sprintf(str, "-A %s -%c %s/%d -o %s -j %s_common",\r
+ buf, (interface->is_upstream?'s':'d'), subnet, idx->bitmask, interface->name, interface->idxprefix);\r
iptables_save_line(str, idx->ipv6);\r
}\r
}\r
#endif\r
\r
/* ------------------------------------------------ iptables classify */\r
- sprintf(str, "-A %s -d %s/%d -o %s -j %s%d",\r
- chain, ip->addr, ip->mask,\r
+ sprintf(str, "-A %s -%c %s/%d -o %s -j %s%d",\r
+ chain, (interface->is_upstream?'s':'d'), ip->addr, ip->mask,\r
interface->name, mark_iptables, ip->mark);\r
iptables_save_line(str, ip->v6);\r
\r
- sprintf(str, "-A %s -d %s/%d -o %s %s-j ACCEPT",\r
- chain, ip->addr, ip->mask, interface->name, limit_pkts);\r
+ sprintf(str, "-A %s -%c %s/%d -o %s %s-j ACCEPT",\r
+ chain, (interface->is_upstream?'s':'d'),ip->addr, ip->mask,\r
+ interface->name, limit_pkts);\r
iptables_save_line(str, ip->v6);\r
\r
if(limit_pkts)\r
{\r
/* classify overlimit packets to separate overlimit class */\r
- sprintf(str, "-A %s -d %s/%d -o %s -j %s%d",\r
- chain, ip->addr, ip->mask,\r
+ sprintf(str, "-A %s -%c %s/%d -o %s -j %s%d",\r
+ chain, (interface->is_upstream?'s':'d'), ip->addr, ip->mask,\r
interface->name, mark_iptables, OVERLIMIT_CLASS);\r
iptables_save_line(str, ip->v6);\r
\r
- sprintf(str, "-A %s -d %s/%d -o %s -j ACCEPT",\r
- chain, ip->addr, ip->mask, interface->name);\r
+ sprintf(str, "-A %s -%c %s/%d -o %s -j ACCEPT",\r
+ chain, (interface->is_upstream?'s':'d'), ip->addr, ip->mask,\r
+ interface->name);\r
iptables_save_line(str, ip->v6);\r
}\r
\r