Skip to content

Commit

Permalink
netfilter: nfmark routing in OUTPUT, mangle, NFQUEUE
Browse files Browse the repository at this point in the history
This patch let nfmark to be evaluated for routing decision for OUTPUT
packet, in mangle table, when process paquet in NFQUEUE
Until now, only change (in NFQUEUE process) on fields src_addr,
dest_addr and tos could make netfilter to reevalute the routing.

From: Laurent Licour <laurent@licour.com>
Signed-off-by: Eric Leblond <eric@inl.fr>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Eric Leblond authored and Patrick McHardy committed Nov 25, 2008
1 parent 4813ead commit 5f145e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv4/netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ struct ip_rt_info {
__be32 daddr;
__be32 saddr;
u_int8_t tos;
u_int32_t mark;
};

static void nf_ip_saveroute(const struct sk_buff *skb,
Expand All @@ -138,6 +139,7 @@ static void nf_ip_saveroute(const struct sk_buff *skb,
rt_info->tos = iph->tos;
rt_info->daddr = iph->daddr;
rt_info->saddr = iph->saddr;
rt_info->mark = skb->mark;
}
}

Expand All @@ -150,6 +152,7 @@ static int nf_ip_reroute(struct sk_buff *skb,
const struct iphdr *iph = ip_hdr(skb);

if (!(iph->tos == rt_info->tos
&& skb->mark == rt_info->mark
&& iph->daddr == rt_info->daddr
&& iph->saddr == rt_info->saddr))
return ip_route_me_harder(skb, RTN_UNSPEC);
Expand Down

0 comments on commit 5f145e4

Please sign in to comment.