Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172120
b: refs/heads/master
c: 491deb2
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Dec 3, 2009
1 parent d68e75e commit 455f95b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d285834001df372f81045bb41092e54943e93c84
refs/heads/master: 491deb24bf5bf7124141287aaf02c3219783ceab
6 changes: 4 additions & 2 deletions trunk/include/linux/fib_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#define FIB_RULE_PERMANENT 0x00000001
#define FIB_RULE_INVERT 0x00000002
#define FIB_RULE_UNRESOLVED 0x00000004
#define FIB_RULE_DEV_DETACHED 0x00000008
#define FIB_RULE_IIF_DETACHED 0x00000008
#define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED

/* try to find source address in routing lookups */
#define FIB_RULE_FIND_SADDR 0x00010000
Expand All @@ -31,7 +32,8 @@ enum {
FRA_UNSPEC,
FRA_DST, /* destination address */
FRA_SRC, /* source address */
FRA_IFNAME, /* interface name */
FRA_IIFNAME, /* interface name */
#define FRA_IFNAME FRA_IIFNAME
FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
FRA_UNUSED2,
FRA_PRIORITY, /* priority/preference */
Expand Down
6 changes: 3 additions & 3 deletions trunk/include/net/fib_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
struct fib_rule {
struct list_head list;
atomic_t refcnt;
int ifindex;
int iifindex;
u32 mark;
u32 mark_mask;
u32 pref;
Expand All @@ -19,7 +19,7 @@ struct fib_rule {
u8 action;
u32 target;
struct fib_rule * ctarget;
char ifname[IFNAMSIZ];
char iifname[IFNAMSIZ];
struct rcu_head rcu;
struct net * fr_net;
};
Expand Down Expand Up @@ -67,7 +67,7 @@ struct fib_rules_ops {
};

#define FRA_GENERIC_POLICY \
[FRA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
[FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
[FRA_PRIORITY] = { .type = NLA_U32 }, \
[FRA_FWMARK] = { .type = NLA_U32 }, \
[FRA_FWMASK] = { .type = NLA_U32 }, \
Expand Down
36 changes: 18 additions & 18 deletions trunk/net/core/fib_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
{
int ret = 0;

if (rule->ifindex && (rule->ifindex != fl->iif))
if (rule->iifindex && (rule->iifindex != fl->iif))
goto out;

if ((rule->mark ^ fl->mark) & rule->mark_mask)
Expand Down Expand Up @@ -248,14 +248,14 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (tb[FRA_PRIORITY])
rule->pref = nla_get_u32(tb[FRA_PRIORITY]);

if (tb[FRA_IFNAME]) {
if (tb[FRA_IIFNAME]) {
struct net_device *dev;

rule->ifindex = -1;
nla_strlcpy(rule->ifname, tb[FRA_IFNAME], IFNAMSIZ);
dev = __dev_get_by_name(net, rule->ifname);
rule->iifindex = -1;
nla_strlcpy(rule->iifname, tb[FRA_IIFNAME], IFNAMSIZ);
dev = __dev_get_by_name(net, rule->iifname);
if (dev)
rule->ifindex = dev->ifindex;
rule->iifindex = dev->ifindex;
}

if (tb[FRA_FWMARK]) {
Expand Down Expand Up @@ -388,8 +388,8 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
(rule->pref != nla_get_u32(tb[FRA_PRIORITY])))
continue;

if (tb[FRA_IFNAME] &&
nla_strcmp(tb[FRA_IFNAME], rule->ifname))
if (tb[FRA_IIFNAME] &&
nla_strcmp(tb[FRA_IIFNAME], rule->iifname))
continue;

if (tb[FRA_FWMARK] &&
Expand Down Expand Up @@ -447,7 +447,7 @@ static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
struct fib_rule *rule)
{
size_t payload = NLMSG_ALIGN(sizeof(struct fib_rule_hdr))
+ nla_total_size(IFNAMSIZ) /* FRA_IFNAME */
+ nla_total_size(IFNAMSIZ) /* FRA_IIFNAME */
+ nla_total_size(4) /* FRA_PRIORITY */
+ nla_total_size(4) /* FRA_TABLE */
+ nla_total_size(4) /* FRA_FWMARK */
Expand Down Expand Up @@ -481,11 +481,11 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL)
frh->flags |= FIB_RULE_UNRESOLVED;

if (rule->ifname[0]) {
NLA_PUT_STRING(skb, FRA_IFNAME, rule->ifname);
if (rule->iifname[0]) {
NLA_PUT_STRING(skb, FRA_IIFNAME, rule->iifname);

if (rule->ifindex == -1)
frh->flags |= FIB_RULE_DEV_DETACHED;
if (rule->iifindex == -1)
frh->flags |= FIB_RULE_IIF_DETACHED;
}

if (rule->pref)
Expand Down Expand Up @@ -600,9 +600,9 @@ static void attach_rules(struct list_head *rules, struct net_device *dev)
struct fib_rule *rule;

list_for_each_entry(rule, rules, list) {
if (rule->ifindex == -1 &&
strcmp(dev->name, rule->ifname) == 0)
rule->ifindex = dev->ifindex;
if (rule->iifindex == -1 &&
strcmp(dev->name, rule->iifname) == 0)
rule->iifindex = dev->ifindex;
}
}

Expand All @@ -611,8 +611,8 @@ static void detach_rules(struct list_head *rules, struct net_device *dev)
struct fib_rule *rule;

list_for_each_entry(rule, rules, list)
if (rule->ifindex == dev->ifindex)
rule->ifindex = -1;
if (rule->iifindex == dev->ifindex)
rule->iifindex = -1;
}


Expand Down

0 comments on commit 455f95b

Please sign in to comment.