aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-12-02 20:25:54 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-03 15:14:36 -0500
commit491deb24bf5bf7124141287aaf02c3219783ceab (patch)
treef0465107e0994c89a1f8afa0091d9e7dd19f52d8
parentd285834001df372f81045bb41092e54943e93c84 (diff)
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: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/fib_rules.h6
-rw-r--r--include/net/fib_rules.h6
-rw-r--r--net/core/fib_rules.c36
3 files changed, 25 insertions, 23 deletions
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index c7e5b700bb91..7e11bb2fa655 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -8,7 +8,8 @@
8#define FIB_RULE_PERMANENT 0x00000001 8#define FIB_RULE_PERMANENT 0x00000001
9#define FIB_RULE_INVERT 0x00000002 9#define FIB_RULE_INVERT 0x00000002
10#define FIB_RULE_UNRESOLVED 0x00000004 10#define FIB_RULE_UNRESOLVED 0x00000004
11#define FIB_RULE_DEV_DETACHED 0x00000008 11#define FIB_RULE_IIF_DETACHED 0x00000008
12#define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED
12 13
13/* try to find source address in routing lookups */ 14/* try to find source address in routing lookups */
14#define FIB_RULE_FIND_SADDR 0x00010000 15#define FIB_RULE_FIND_SADDR 0x00010000
@@ -31,7 +32,8 @@ enum {
31 FRA_UNSPEC, 32 FRA_UNSPEC,
32 FRA_DST, /* destination address */ 33 FRA_DST, /* destination address */
33 FRA_SRC, /* source address */ 34 FRA_SRC, /* source address */
34 FRA_IFNAME, /* interface name */ 35 FRA_IIFNAME, /* interface name */
36#define FRA_IFNAME FRA_IIFNAME
35 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ 37 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
36 FRA_UNUSED2, 38 FRA_UNUSED2,
37 FRA_PRIORITY, /* priority/preference */ 39 FRA_PRIORITY, /* priority/preference */
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 22fb323cd85e..62bebcb2a51c 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -10,7 +10,7 @@
10struct fib_rule { 10struct fib_rule {
11 struct list_head list; 11 struct list_head list;
12 atomic_t refcnt; 12 atomic_t refcnt;
13 int ifindex; 13 int iifindex;
14 u32 mark; 14 u32 mark;
15 u32 mark_mask; 15 u32 mark_mask;
16 u32 pref; 16 u32 pref;
@@ -19,7 +19,7 @@ struct fib_rule {
19 u8 action; 19 u8 action;
20 u32 target; 20 u32 target;
21 struct fib_rule * ctarget; 21 struct fib_rule * ctarget;
22 char ifname[IFNAMSIZ]; 22 char iifname[IFNAMSIZ];
23 struct rcu_head rcu; 23 struct rcu_head rcu;
24 struct net * fr_net; 24 struct net * fr_net;
25}; 25};
@@ -67,7 +67,7 @@ struct fib_rules_ops {
67}; 67};
68 68
69#define FRA_GENERIC_POLICY \ 69#define FRA_GENERIC_POLICY \
70 [FRA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \ 70 [FRA_IIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
71 [FRA_PRIORITY] = { .type = NLA_U32 }, \ 71 [FRA_PRIORITY] = { .type = NLA_U32 }, \
72 [FRA_FWMARK] = { .type = NLA_U32 }, \ 72 [FRA_FWMARK] = { .type = NLA_U32 }, \
73 [FRA_FWMASK] = { .type = NLA_U32 }, \ 73 [FRA_FWMASK] = { .type = NLA_U32 }, \
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index bd309384f8b8..8e8028cdc87f 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -135,7 +135,7 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
135{ 135{
136 int ret = 0; 136 int ret = 0;
137 137
138 if (rule->ifindex && (rule->ifindex != fl->iif)) 138 if (rule->iifindex && (rule->iifindex != fl->iif))
139 goto out; 139 goto out;
140 140
141 if ((rule->mark ^ fl->mark) & rule->mark_mask) 141 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 if (tb[FRA_PRIORITY]) 248 if (tb[FRA_PRIORITY])
249 rule->pref = nla_get_u32(tb[FRA_PRIORITY]); 249 rule->pref = nla_get_u32(tb[FRA_PRIORITY]);
250 250
251 if (tb[FRA_IFNAME]) { 251 if (tb[FRA_IIFNAME]) {
252 struct net_device *dev; 252 struct net_device *dev;
253 253
254 rule->ifindex = -1; 254 rule->iifindex = -1;
255 nla_strlcpy(rule->ifname, tb[FRA_IFNAME], IFNAMSIZ); 255 nla_strlcpy(rule->iifname, tb[FRA_IIFNAME], IFNAMSIZ);
256 dev = __dev_get_by_name(net, rule->ifname); 256 dev = __dev_get_by_name(net, rule->iifname);
257 if (dev) 257 if (dev)
258 rule->ifindex = dev->ifindex; 258 rule->iifindex = dev->ifindex;
259 } 259 }
260 260
261 if (tb[FRA_FWMARK]) { 261 if (tb[FRA_FWMARK]) {
@@ -388,8 +388,8 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
388 (rule->pref != nla_get_u32(tb[FRA_PRIORITY]))) 388 (rule->pref != nla_get_u32(tb[FRA_PRIORITY])))
389 continue; 389 continue;
390 390
391 if (tb[FRA_IFNAME] && 391 if (tb[FRA_IIFNAME] &&
392 nla_strcmp(tb[FRA_IFNAME], rule->ifname)) 392 nla_strcmp(tb[FRA_IIFNAME], rule->iifname))
393 continue; 393 continue;
394 394
395 if (tb[FRA_FWMARK] && 395 if (tb[FRA_FWMARK] &&
@@ -447,7 +447,7 @@ static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
447 struct fib_rule *rule) 447 struct fib_rule *rule)
448{ 448{
449 size_t payload = NLMSG_ALIGN(sizeof(struct fib_rule_hdr)) 449 size_t payload = NLMSG_ALIGN(sizeof(struct fib_rule_hdr))
450 + nla_total_size(IFNAMSIZ) /* FRA_IFNAME */ 450 + nla_total_size(IFNAMSIZ) /* FRA_IIFNAME */
451 + nla_total_size(4) /* FRA_PRIORITY */ 451 + nla_total_size(4) /* FRA_PRIORITY */
452 + nla_total_size(4) /* FRA_TABLE */ 452 + nla_total_size(4) /* FRA_TABLE */
453 + nla_total_size(4) /* FRA_FWMARK */ 453 + 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 if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL) 481 if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL)
482 frh->flags |= FIB_RULE_UNRESOLVED; 482 frh->flags |= FIB_RULE_UNRESOLVED;
483 483
484 if (rule->ifname[0]) { 484 if (rule->iifname[0]) {
485 NLA_PUT_STRING(skb, FRA_IFNAME, rule->ifname); 485 NLA_PUT_STRING(skb, FRA_IIFNAME, rule->iifname);
486 486
487 if (rule->ifindex == -1) 487 if (rule->iifindex == -1)
488 frh->flags |= FIB_RULE_DEV_DETACHED; 488 frh->flags |= FIB_RULE_IIF_DETACHED;
489 } 489 }
490 490
491 if (rule->pref) 491 if (rule->pref)
@@ -600,9 +600,9 @@ static void attach_rules(struct list_head *rules, struct net_device *dev)
600 struct fib_rule *rule; 600 struct fib_rule *rule;
601 601
602 list_for_each_entry(rule, rules, list) { 602 list_for_each_entry(rule, rules, list) {
603 if (rule->ifindex == -1 && 603 if (rule->iifindex == -1 &&
604 strcmp(dev->name, rule->ifname) == 0) 604 strcmp(dev->name, rule->iifname) == 0)
605 rule->ifindex = dev->ifindex; 605 rule->iifindex = dev->ifindex;
606 } 606 }
607} 607}
608 608
@@ -611,8 +611,8 @@ static void detach_rules(struct list_head *rules, struct net_device *dev)
611 struct fib_rule *rule; 611 struct fib_rule *rule;
612 612
613 list_for_each_entry(rule, rules, list) 613 list_for_each_entry(rule, rules, list)
614 if (rule->ifindex == dev->ifindex) 614 if (rule->iifindex == dev->ifindex)
615 rule->ifindex = -1; 615 rule->iifindex = -1;
616} 616}
617 617
618 618