Commit 491deb24 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

net 02/05: fib_rules: rename ifindex/ifname/FRA_IFNAME to iifindex/iifname/FRA_IIFNAME

commit 229e77eec406ad68662f18e49fda8b5d366768c5
Author: Patrick McHardy <kaber@trash.net>
Date:   Thu Dec 3 12:05:23 2009 +0100

    net: fib_rules: rename ifindex/ifname/FRA_IFNAME to iifindex/iifname/FRA_IIFNAME

    The next patch will add oif classification, rename interface related members
    and attributes to reflect that they're used for iif classification.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2858340
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
#define FIB_RULE_PERMANENT 0x00000001 #define FIB_RULE_PERMANENT 0x00000001
#define FIB_RULE_INVERT 0x00000002 #define FIB_RULE_INVERT 0x00000002
#define FIB_RULE_UNRESOLVED 0x00000004 #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 */ /* try to find source address in routing lookups */
#define FIB_RULE_FIND_SADDR 0x00010000 #define FIB_RULE_FIND_SADDR 0x00010000
...@@ -31,7 +32,8 @@ enum { ...@@ -31,7 +32,8 @@ enum {
FRA_UNSPEC, FRA_UNSPEC,
FRA_DST, /* destination address */ FRA_DST, /* destination address */
FRA_SRC, /* source 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_GOTO, /* target to jump to (FR_ACT_GOTO) */
FRA_UNUSED2, FRA_UNUSED2,
FRA_PRIORITY, /* priority/preference */ FRA_PRIORITY, /* priority/preference */
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
struct fib_rule { struct fib_rule {
struct list_head list; struct list_head list;
atomic_t refcnt; atomic_t refcnt;
int ifindex; int iifindex;
u32 mark; u32 mark;
u32 mark_mask; u32 mark_mask;
u32 pref; u32 pref;
...@@ -19,7 +19,7 @@ struct fib_rule { ...@@ -19,7 +19,7 @@ struct fib_rule {
u8 action; u8 action;
u32 target; u32 target;
struct fib_rule * ctarget; struct fib_rule * ctarget;
char ifname[IFNAMSIZ]; char iifname[IFNAMSIZ];
struct rcu_head rcu; struct rcu_head rcu;
struct net * fr_net; struct net * fr_net;
}; };
...@@ -67,7 +67,7 @@ struct fib_rules_ops { ...@@ -67,7 +67,7 @@ struct fib_rules_ops {
}; };
#define FRA_GENERIC_POLICY \ #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_PRIORITY] = { .type = NLA_U32 }, \
[FRA_FWMARK] = { .type = NLA_U32 }, \ [FRA_FWMARK] = { .type = NLA_U32 }, \
[FRA_FWMASK] = { .type = NLA_U32 }, \ [FRA_FWMASK] = { .type = NLA_U32 }, \
......
...@@ -135,7 +135,7 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops, ...@@ -135,7 +135,7 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
{ {
int ret = 0; int ret = 0;
if (rule->ifindex && (rule->ifindex != fl->iif)) if (rule->iifindex && (rule->iifindex != fl->iif))
goto out; goto out;
if ((rule->mark ^ fl->mark) & rule->mark_mask) if ((rule->mark ^ fl->mark) & rule->mark_mask)
...@@ -248,14 +248,14 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) ...@@ -248,14 +248,14 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
if (tb[FRA_PRIORITY]) if (tb[FRA_PRIORITY])
rule->pref = nla_get_u32(tb[FRA_PRIORITY]); rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
if (tb[FRA_IFNAME]) { if (tb[FRA_IIFNAME]) {
struct net_device *dev; struct net_device *dev;
rule->ifindex = -1; rule->iifindex = -1;
nla_strlcpy(rule->ifname, tb[FRA_IFNAME], IFNAMSIZ); nla_strlcpy(rule->iifname, tb[FRA_IIFNAME], IFNAMSIZ);
dev = __dev_get_by_name(net, rule->ifname); dev = __dev_get_by_name(net, rule->iifname);
if (dev) if (dev)
rule->ifindex = dev->ifindex; rule->iifindex = dev->ifindex;
} }
if (tb[FRA_FWMARK]) { if (tb[FRA_FWMARK]) {
...@@ -388,8 +388,8 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) ...@@ -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]))) (rule->pref != nla_get_u32(tb[FRA_PRIORITY])))
continue; continue;
if (tb[FRA_IFNAME] && if (tb[FRA_IIFNAME] &&
nla_strcmp(tb[FRA_IFNAME], rule->ifname)) nla_strcmp(tb[FRA_IIFNAME], rule->iifname))
continue; continue;
if (tb[FRA_FWMARK] && if (tb[FRA_FWMARK] &&
...@@ -447,7 +447,7 @@ static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops, ...@@ -447,7 +447,7 @@ static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
struct fib_rule *rule) struct fib_rule *rule)
{ {
size_t payload = NLMSG_ALIGN(sizeof(struct fib_rule_hdr)) 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_PRIORITY */
+ nla_total_size(4) /* FRA_TABLE */ + nla_total_size(4) /* FRA_TABLE */
+ nla_total_size(4) /* FRA_FWMARK */ + nla_total_size(4) /* FRA_FWMARK */
...@@ -481,11 +481,11 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule, ...@@ -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) if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL)
frh->flags |= FIB_RULE_UNRESOLVED; frh->flags |= FIB_RULE_UNRESOLVED;
if (rule->ifname[0]) { if (rule->iifname[0]) {
NLA_PUT_STRING(skb, FRA_IFNAME, rule->ifname); NLA_PUT_STRING(skb, FRA_IIFNAME, rule->iifname);
if (rule->ifindex == -1) if (rule->iifindex == -1)
frh->flags |= FIB_RULE_DEV_DETACHED; frh->flags |= FIB_RULE_IIF_DETACHED;
} }
if (rule->pref) if (rule->pref)
...@@ -600,9 +600,9 @@ static void attach_rules(struct list_head *rules, struct net_device *dev) ...@@ -600,9 +600,9 @@ static void attach_rules(struct list_head *rules, struct net_device *dev)
struct fib_rule *rule; struct fib_rule *rule;
list_for_each_entry(rule, rules, list) { list_for_each_entry(rule, rules, list) {
if (rule->ifindex == -1 && if (rule->iifindex == -1 &&
strcmp(dev->name, rule->ifname) == 0) strcmp(dev->name, rule->iifname) == 0)
rule->ifindex = dev->ifindex; rule->iifindex = dev->ifindex;
} }
} }
...@@ -611,8 +611,8 @@ static void detach_rules(struct list_head *rules, struct net_device *dev) ...@@ -611,8 +611,8 @@ static void detach_rules(struct list_head *rules, struct net_device *dev)
struct fib_rule *rule; struct fib_rule *rule;
list_for_each_entry(rule, rules, list) list_for_each_entry(rule, rules, list)
if (rule->ifindex == dev->ifindex) if (rule->iifindex == dev->ifindex)
rule->ifindex = -1; rule->iifindex = -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment