diff mbox

[net-next] ipv6: export IP6_RT_PRIO_* to userland

Message ID 1352129298-1104-1-git-send-email-nicolas.dichtel@6wind.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Nicolas Dichtel Nov. 5, 2012, 3:28 p.m. UTC
The kernel uses some default metric when routes are managed. For example, a
static route added with a metric set to 0 is inserted in the kernel with
metric 1024 (IP6_RT_PRIO_USER).
It is useful for routing daemons to know these values, to be able to set routes
without interfering with what the kernel does.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/net/ip6_route.h         | 3 ---
 include/uapi/linux/ipv6_route.h | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

David Miller Nov. 5, 2012, 5 p.m. UTC | #1
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Mon,  5 Nov 2012 16:28:18 +0100

> The kernel uses some default metric when routes are managed. For example, a
> static route added with a metric set to 0 is inserted in the kernel with
> metric 1024 (IP6_RT_PRIO_USER).
> It is useful for routing daemons to know these values, to be able to set routes
> without interfering with what the kernel does.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

But these belong in the libc headers anyways.

If we haven't provided them for so long, there's no real value of
adding them now.
--
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
Nicolas Dichtel Nov. 5, 2012, 5:22 p.m. UTC | #2
Le 05/11/2012 18:00, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Date: Mon,  5 Nov 2012 16:28:18 +0100
>
>> The kernel uses some default metric when routes are managed. For example, a
>> static route added with a metric set to 0 is inserted in the kernel with
>> metric 1024 (IP6_RT_PRIO_USER).
>> It is useful for routing daemons to know these values, to be able to set routes
>> without interfering with what the kernel does.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
> But these belong in the libc headers anyways.
>
> If we haven't provided them for so long, there's no real value of
> adding them now.
>
But how can a daemon know which default values are used? If it wants to add a 
route with metric = default + x, it should first add it with metric = 0, check 
the result and then change the metric.
--
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
David Miller Nov. 5, 2012, 5:43 p.m. UTC | #3
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Mon, 05 Nov 2012 18:22:39 +0100

> Le 05/11/2012 18:00, David Miller a écrit :
>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> Date: Mon,  5 Nov 2012 16:28:18 +0100
>>
>>> The kernel uses some default metric when routes are managed. For
>>> example, a
>>> static route added with a metric set to 0 is inserted in the kernel
>>> with
>>> metric 1024 (IP6_RT_PRIO_USER).
>>> It is useful for routing daemons to know these values, to be able to
>>> set routes
>>> without interfering with what the kernel does.
>>>
>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>
>> But these belong in the libc headers anyways.
>>
>> If we haven't provided them for so long, there's no real value of
>> adding them now.
>>
> But how can a daemon know which default values are used? If it wants
> to add a route with metric = default + x, it should first add it with
> metric = 0, check the result and then change the metric.

What do we do on the ipv4 side and how do daemons cope in that situation?

--
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
Nicolas Dichtel Nov. 5, 2012, 7:24 p.m. UTC | #4
Le 05/11/2012 18:43, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Date: Mon, 05 Nov 2012 18:22:39 +0100
>
>> Le 05/11/2012 18:00, David Miller a écrit :
>>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>> Date: Mon,  5 Nov 2012 16:28:18 +0100
>>>
>>>> The kernel uses some default metric when routes are managed. For
>>>> example, a
>>>> static route added with a metric set to 0 is inserted in the kernel
>>>> with
>>>> metric 1024 (IP6_RT_PRIO_USER).
>>>> It is useful for routing daemons to know these values, to be able to
>>>> set routes
>>>> without interfering with what the kernel does.
>>>>
>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>
>>> But these belong in the libc headers anyways.
>>>
>>> If we haven't provided them for so long, there's no real value of
>>> adding them now.
>>>
>> But how can a daemon know which default values are used? If it wants
>> to add a route with metric = default + x, it should first add it with
>> metric = 0, check the result and then change the metric.
>
> What do we do on the ipv4 side and how do daemons cope in that situation?
>
In IPv4, there is no such default metric. If you add a route with metric X, it 
remains X in the kernel, even if it's 0.
--
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
Nicolas Dichtel Nov. 9, 2012, 9:43 a.m. UTC | #5
Le 05/11/2012 20:24, Nicolas Dichtel a écrit :
> Le 05/11/2012 18:43, David Miller a écrit :
>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> Date: Mon, 05 Nov 2012 18:22:39 +0100
>>
>>> Le 05/11/2012 18:00, David Miller a écrit :
>>>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>> Date: Mon,  5 Nov 2012 16:28:18 +0100
>>>>
>>>>> The kernel uses some default metric when routes are managed. For
>>>>> example, a
>>>>> static route added with a metric set to 0 is inserted in the kernel
>>>>> with
>>>>> metric 1024 (IP6_RT_PRIO_USER).
>>>>> It is useful for routing daemons to know these values, to be able to
>>>>> set routes
>>>>> without interfering with what the kernel does.
>>>>>
>>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>>
>>>> But these belong in the libc headers anyways.
>>>>
>>>> If we haven't provided them for so long, there's no real value of
>>>> adding them now.
>>>>
>>> But how can a daemon know which default values are used? If it wants
>>> to add a route with metric = default + x, it should first add it with
>>> metric = 0, check the result and then change the metric.
>>
>> What do we do on the ipv4 side and how do daemons cope in that situation?
>>
> In IPv4, there is no such default metric. If you add a route with metric X, it
> remains X in the kernel, even if it's 0.
So we need to duplicate these values in the daemon?
--
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
David Miller Nov. 9, 2012, 7:05 p.m. UTC | #6
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Fri, 09 Nov 2012 10:43:34 +0100

> Le 05/11/2012 20:24, Nicolas Dichtel a écrit :
>> Le 05/11/2012 18:43, David Miller a écrit :
>>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>> Date: Mon, 05 Nov 2012 18:22:39 +0100
>>>
>>>> Le 05/11/2012 18:00, David Miller a écrit :
>>>>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>>> Date: Mon,  5 Nov 2012 16:28:18 +0100
>>>>>
>>>>>> The kernel uses some default metric when routes are managed. For
>>>>>> example, a
>>>>>> static route added with a metric set to 0 is inserted in the kernel
>>>>>> with
>>>>>> metric 1024 (IP6_RT_PRIO_USER).
>>>>>> It is useful for routing daemons to know these values, to be able to
>>>>>> set routes
>>>>>> without interfering with what the kernel does.
>>>>>>
>>>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>>>
>>>>> But these belong in the libc headers anyways.
>>>>>
>>>>> If we haven't provided them for so long, there's no real value of
>>>>> adding them now.
>>>>>
>>>> But how can a daemon know which default values are used? If it wants
>>>> to add a route with metric = default + x, it should first add it with
>>>> metric = 0, check the result and then change the metric.
>>>
>>> What do we do on the ipv4 side and how do daemons cope in that
>>> situation?
>>>
>> In IPv4, there is no such default metric. If you add a route with
>> metric X, it
>> remains X in the kernel, even if it's 0.
> So we need to duplicate these values in the daemon?
> 

I'm without real internet access again for the past 2 days and simply
too backlogged to even continue considering this issue.

Please be patient.
--
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
David Miller Nov. 16, 2012, 6:48 a.m. UTC | #7
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Mon, 05 Nov 2012 20:24:42 +0100

> In IPv4, there is no such default metric. If you add a route with
> metric X, it remains X in the kernel, even if it's 0.

Ok, fair enough, applied to net-next, thanks.
--
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
diff mbox

Patch

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5fa2af0..27d8318 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -1,9 +1,6 @@ 
 #ifndef _NET_IP6_ROUTE_H
 #define _NET_IP6_ROUTE_H
 
-#define IP6_RT_PRIO_USER	1024
-#define IP6_RT_PRIO_ADDRCONF	256
-
 struct route_info {
 	__u8			type;
 	__u8			length;
diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h
index 0459664..2be7bd1 100644
--- a/include/uapi/linux/ipv6_route.h
+++ b/include/uapi/linux/ipv6_route.h
@@ -55,4 +55,7 @@  struct in6_rtmsg {
 #define RTMSG_NEWROUTE		0x21
 #define RTMSG_DELROUTE		0x22
 
+#define IP6_RT_PRIO_USER	1024
+#define IP6_RT_PRIO_ADDRCONF	256
+
 #endif /* _UAPI_LINUX_IPV6_ROUTE_H */