table_id = rtm->rtm_table;
if (table_id == RT_TABLE_UNSPEC) {
struct fib_table *table;
- if (rtm->rtm_type == RTN_UNICAST || rtm->rtm_type == RTN_NAT) {
+ if (rtm->rtm_type == RTN_UNICAST) {
if ((table = fib_empty_table()) == NULL)
return -ENOBUFS;
table_id = table->tb_id;
return (daddr&~mask)|res->fi->fib_nh->nh_gw;
}
-u32 fib_rules_policy(u32 saddr, struct fib_result *res, unsigned *flags)
-{
- struct fib_rule *r = res->r;
-
- if (r->r_action == RTN_NAT) {
- int addrtype = inet_addr_type(r->r_srcmap);
-
- if (addrtype == RTN_NAT) {
- /* Packet is from translated source; remember it */
- saddr = (saddr&~r->r_srcmask)|r->r_srcmap;
- *flags |= RTCF_SNAT;
- } else if (addrtype == RTN_LOCAL || r->r_srcmap == 0) {
- /* Packet is from masqueraded source; remember it */
- saddr = r->r_srcmap;
- *flags |= RTCF_MASQ;
- }
- }
- return saddr;
-}
-
#ifdef CONFIG_NET_CLS_ROUTE
u32 fib_rules_tclass(struct fib_result *res)
{
for (r = fib_rules; r; r=r->r_next) {
if (((saddr^r->r_src) & r->r_srcmask) ||
((daddr^r->r_dst) & r->r_dstmask) ||
-#ifdef CONFIG_IP_ROUTE_TOS
(r->r_tos && r->r_tos != flp->fl4_tos) ||
-#endif
#ifdef CONFIG_IP_ROUTE_FWMARK
(r->r_fwmark && r->r_fwmark != flp->fl4_fwmark) ||
#endif
FRprintk("tb %d r %d ", r->r_table, r->r_action);
switch (r->r_action) {
case RTN_UNICAST:
- case RTN_NAT:
policy = r;
break;
case RTN_UNREACHABLE: