aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-26 20:37:59 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:13 -0400
commit2b44368307cd06c5614d7b53801f516c0654020b (patch)
treea766c892dd0fc5a0266c25102eda1106b79fd14c
parent0947c9fe56d9cf7ad0bc3a03ccd30446cde698e4 (diff)
[NET] fib_rules: Mark rules detached from the device
Rules which match against device names in their selector can remain while the device itself disappears, in fact the device doesn't have to present when the rule is added in the first place. The device name is resolved by trying when the rule is added and later by listening to NETDEV_REGISTER/UNREGISTER notifications. This patch adds the flag FIB_RULE_DEV_DETACHED which is set towards userspace when a rule contains a device match which is unresolved at the moment. This eases spotting the reason why certain rules seem not to function properly. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/fib_rules.h1
-rw-r--r--net/core/fib_rules.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index ec9c7b1d3e91..c151273293e2 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -8,6 +8,7 @@
8#define FIB_RULE_PERMANENT 1 8#define FIB_RULE_PERMANENT 1
9#define FIB_RULE_INVERT 2 9#define FIB_RULE_INVERT 2
10#define FIB_RULE_UNRESOLVED 4 10#define FIB_RULE_UNRESOLVED 4
11#define FIB_RULE_DEV_DETACHED 8
11 12
12struct fib_rule_hdr 13struct fib_rule_hdr
13{ 14{
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 0d8bb2efb0c1..7ac602cc8c85 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -450,9 +450,13 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
450 if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL) 450 if (rule->action == FR_ACT_GOTO && rule->ctarget == NULL)
451 frh->flags |= FIB_RULE_UNRESOLVED; 451 frh->flags |= FIB_RULE_UNRESOLVED;
452 452
453 if (rule->ifname[0]) 453 if (rule->ifname[0]) {
454 NLA_PUT_STRING(skb, FRA_IFNAME, rule->ifname); 454 NLA_PUT_STRING(skb, FRA_IFNAME, rule->ifname);
455 455
456 if (rule->ifindex == -1)
457 frh->flags |= FIB_RULE_DEV_DETACHED;
458 }
459
456 if (rule->pref) 460 if (rule->pref)
457 NLA_PUT_U32(skb, FRA_PRIORITY, rule->pref); 461 NLA_PUT_U32(skb, FRA_PRIORITY, rule->pref);
458 462