* [PATCH] Age Entry For IPv4 Route Table
@ 2007-06-25 4:58 Varun Chandramohan
2007-06-25 5:14 ` YOSHIFUJI Hideaki / 吉藤英明
2007-06-25 14:10 ` Eric Dumazet
0 siblings, 2 replies; 6+ messages in thread
From: Varun Chandramohan @ 2007-06-25 4:58 UTC (permalink / raw)
To: netdev; +Cc: sri, dlstevens, varuncha
According to the RFC 4292 (IP Forwarding Table MIB) there is a need for an age entry for all the routes in the routing table. The entry in the RFC is inetCidrRouteAge and oid is inetCidrRouteAge.1.10.
Many snmp application require this age entry. So iam adding the age field in the routing table and providing
the interface for this value via /proc/net/route.
Signed-off-by: Varun Chandramohan <varunc@linux.vnet.ibm.com>
---
net/ipv4/fib_hash.c | 16 +++++++++++-----
net/ipv4/fib_lookup.h | 1 +
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 07e843a..2000f1e 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -448,6 +448,7 @@ static int fn_hash_insert(struct fib_tab
fa->fa_info = fi;
fa->fa_type = cfg->fc_type;
fa->fa_scope = cfg->fc_scope;
+ fa->fa_age = jiffies;
state = fa->fa_state;
fa->fa_state &= ~FA_S_ACCESSED;
fib_hash_genid++;
@@ -507,6 +508,7 @@ static int fn_hash_insert(struct fib_tab
new_fa->fa_type = cfg->fc_type;
new_fa->fa_scope = cfg->fc_scope;
new_fa->fa_state = 0;
+ new_fa->fa_age = jiffies;
/*
* Insert new entry to the list.
@@ -998,10 +1000,11 @@ static int fib_seq_show(struct seq_file
struct fib_alias *fa;
struct fib_info *fi;
+#define JIFFIES_TO_SECS(jiffies) ((jiffies)/HZ)
if (v == SEQ_START_TOKEN) {
seq_printf(seq, "%-127s\n", "Iface\tDestination\tGateway "
"\tFlags\tRefCnt\tUse\tMetric\tMask\t\tMTU"
- "\tWindow\tIRTT");
+ "\tWindow\tIRTT\tAge");
goto out;
}
@@ -1014,17 +1017,20 @@ static int fib_seq_show(struct seq_file
flags = fib_flag_trans(fa->fa_type, mask, fi);
if (fi)
snprintf(bf, sizeof(bf),
- "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u",
+ "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u\t%lu",
fi->fib_dev ? fi->fib_dev->name : "*", prefix,
fi->fib_nh->nh_gw, flags, 0, 0, fi->fib_priority,
mask, (fi->fib_advmss ? fi->fib_advmss + 40 : 0),
fi->fib_window,
- fi->fib_rtt >> 3);
+ fi->fib_rtt >> 3,
+ JIFFIES_TO_SECS(jiffies - fa->fa_age));
else
snprintf(bf, sizeof(bf),
- "*\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u",
- prefix, 0, flags, 0, 0, 0, mask, 0, 0, 0);
+ "*\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u\t%lu",
+ prefix, 0, flags, 0, 0, 0, mask, 0, 0, 0, 0);
seq_printf(seq, "%-127s\n", bf);
+
+#undef JIFFIES_TO_SECS
out:
return 0;
}
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h
index eef9eec..cc403d4 100644
--- a/net/ipv4/fib_lookup.h
+++ b/net/ipv4/fib_lookup.h
@@ -13,6 +13,7 @@ struct fib_alias {
u8 fa_type;
u8 fa_scope;
u8 fa_state;
+ unsigned long fa_age;
};
#define FA_S_ACCESSED 0x01
--
1.4.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] Age Entry For IPv4 Route Table
2007-06-25 4:58 [PATCH] Age Entry For IPv4 Route Table Varun Chandramohan
@ 2007-06-25 5:14 ` YOSHIFUJI Hideaki / 吉藤英明
2007-06-25 5:21 ` Varun Chandramohan
2007-06-25 14:10 ` Eric Dumazet
1 sibling, 1 reply; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-06-25 5:14 UTC (permalink / raw)
To: varunc; +Cc: netdev, sri, dlstevens, varuncha, yoshfuji
In article <20070625102838.9d1fee20.varunc@linux.vnet.ibm.com> (at Mon, 25 Jun 2007 10:28:38 +0530), Varun Chandramohan <varunc@linux.vnet.ibm.com> says:
> According to the RFC 4292 (IP Forwarding Table MIB) there is a need for an age entry for all the routes in the routing table. The entry in the RFC is inetCidrRouteAge and oid is inetCidrRouteAge.1.10.
> Many snmp application require this age entry. So iam adding the age field in the routing table and providing
> the interface for this value via /proc/net/route.
I'm not in favor of adding new field(s) to /proc/net/route.
--yoshfuji
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Age Entry For IPv4 Route Table
2007-06-25 5:14 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-06-25 5:21 ` Varun Chandramohan
[not found] ` <20070625.003208.69400937.davem@davemloft.net>
0 siblings, 1 reply; 6+ messages in thread
From: Varun Chandramohan @ 2007-06-25 5:21 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明
Cc: netdev, sri, dlstevens, varuncha
YOSHIFUJI Hideaki / 吉藤英明 wrote:
> In article <20070625102838.9d1fee20.varunc@linux.vnet.ibm.com> (at Mon, 25 Jun 2007 10:28:38 +0530), Varun Chandramohan <varunc@linux.vnet.ibm.com> says:
>
>
>> According to the RFC 4292 (IP Forwarding Table MIB) there is a need for an age entry for all the routes in the routing table. The entry in the RFC is inetCidrRouteAge and oid is inetCidrRouteAge.1.10.
>> Many snmp application require this age entry. So iam adding the age field in the routing table and providing
>> the interface for this value via /proc/net/route.
>>
>
> I'm not in favor of adding new field(s) to /proc/net/route.
>
>
Do you think it will break any user level functionality? I have tested
with netstat, route and net-snmp which reads from the same /proc
interface. They seem to work fine.
> --yoshfuji
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Age Entry For IPv4 Route Table
2007-06-25 4:58 [PATCH] Age Entry For IPv4 Route Table Varun Chandramohan
2007-06-25 5:14 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-06-25 14:10 ` Eric Dumazet
1 sibling, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2007-06-25 14:10 UTC (permalink / raw)
To: Varun Chandramohan; +Cc: netdev, sri, dlstevens, varuncha
On Mon, 25 Jun 2007 10:28:38 +0530
Varun Chandramohan <varunc@linux.vnet.ibm.com> wrote:
> According to the RFC 4292 (IP Forwarding Table MIB) there is a need for an age entry for all the routes in the routing table. The entry in the RFC is inetCidrRouteAge and oid is inetCidrRouteAge.1.10.
> Many snmp application require this age entry. So iam adding the age field in the routing table and providing
> the interface for this value via /proc/net/route.
>
Hi Varun
If you find a way to expose this information without breaking /proc/net/route, please consider that jiffies can wrap
every 49 days on 32 bit platforms.
So you probably want to use an other time infrastructure if you want meaningfull Age information.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-06-25 14:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25 4:58 [PATCH] Age Entry For IPv4 Route Table Varun Chandramohan
2007-06-25 5:14 ` YOSHIFUJI Hideaki / 吉藤英明
2007-06-25 5:21 ` Varun Chandramohan
[not found] ` <20070625.003208.69400937.davem@davemloft.net>
2007-06-25 7:58 ` Varun Chandramohan
2007-06-25 8:42 ` David Miller
2007-06-25 14:10 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).