Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-27-2013, 05:42 PM
|
#1
|
LQ Newbie
Registered: Apr 2009
Posts: 2
Rep:
|
Queston about lifetime of IPv6 address
Hello,
I have a question about lifetime to be leased to an interface of IPv6 address.
I set the valid lifetime to 0xffffffff and the preferred
lifetime to 10.
(Even I set the valid lifetime to 0xffffffff)
I expected the address become deprecated after 10 seconds.
but After 10 seconds it never become deprecated.
-----------------------------------------------------------------------------------------------
# ip addr add 2002:100:10:1::100/64 dev lan2 valid_lft 0xffffffff preferred_lft 10
★ wait 10 seconds
# ip addr show lan2
52: lan2: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 02:02:02:02:02:17 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global lan2
inet6 2002:100:10:1::100/64 scope global <----I expected address become deprecated. but not changed.
valid_lft forever preferred_lft forever
inet6 fe80::2:2ff:fe02:217/64 scope link
valid_lft forever preferred_lft forever
-----------------------------------------------------------------------------------------------
Then, I read RFC2461,3315,3633,4861 etc.
There is described a value of 0xffffffff represent infinity.
-------------------------------------------------------------
<RFC 2461>
Valid Lifetime
32-bit unsigned integer. The length of time in
seconds (relative to the time the packet is sent)
that the prefix is valid for the purpose of on-link
determination. A value of all one bits
(0xffffffff) represents infinity. The Valid
Lifetime is also used by [ADDRCONF].
-------------------------------------------------------------
However I couldn't find state-changing behavior by setting "infinity" and relation to preferred lifetime.
I read the net/ipv6/addrconf.c of 3.11 kernel code.
When I set the valid lifetime to 0xffffffff,inet_addr_modify() set the ifa_flags to IFA_F_PERMANENT.(*1)
Thus, in the addrconf_verify(), the depracete remain unchanged.(*2,*3)
Is this problems with kernel? or Do I have misunderstood about "infinity"?
Thank you for your time and assistance regarding this matter.
3688 static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
3689 u32 prefered_lft, u32 valid_lft)
3690 {
:
3697
3698 timeout = addrconf_timeout_fixup(valid_lft, HZ);
3699 if (addrconf_finite_timeout(timeout)) {
3700 expires = jiffies_to_clock_t(timeout * HZ);
3701 valid_lft = timeout;
3702 flags = RTF_EXPIRES;
3703 } else {
3704 expires = 0;
3705 flags = 0;
3706 ifa_flags |= IFA_F_PERMANENT; <----------------- *1
3707 }
3528 static void addrconf_verify(unsigned long foo)
3529 {
:
3541 for (i = 0; i < IN6_ADDR_HSIZE; i++) {
:
3547 if (ifp->flags & IFA_F_PERMANENT)
3548 continue; <---- *2 (changing-deprecate is skipped)
:
3563 } else if (age >= ifp->prefered_lft) {
3564 /* jiffies - ifp->tstamp > age >= ifp->prefered_lft */
3565 int deprecate = 0;
3566
3567 if (!(ifp->flags&IFA_F_DEPRECATED)) {
3568 deprecate = 1; <----- *3
3569 ifp->flags |= IFA_F_DEPRECATED;
3570 }
Last edited by yazzep; 10-27-2013 at 08:00 PM.
|
|
|
10-30-2013, 03:43 PM
|
#2
|
Senior Member
Registered: Apr 2009
Posts: 1,892
Rep:
|
When an address is assigned to an interface it gets the status "preferred", which it holds during its preferred-lifetime. After that lifetime expires the status becomes "deprecated" and no new connections should be made using this address. The address becomes "invalid" after its valid-lifetime also expires; the address is removed from the interface and may be assigned somewhere else on the network.
For your case, no new connection is allowed after preferred-lifetime expires but IP address is never changed because it is 0xffffffff.
|
|
|
10-30-2013, 09:21 PM
|
#3
|
LQ Newbie
Registered: Apr 2009
Posts: 2
Original Poster
Rep:
|
Thank you so much for your kind words.
Please let me confirm.
Is this the reason why when an address is assigned with valid_lft "0xffffffff", the kernel(actually ip-command) will set preferred_lft to "forever" instead of 20sec?
# # ip addr add 2002:100:10:1::100/64 dev eth1 valid_lft 0xffffffff preferred_lft 20
# # ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:04:9f:02:00:5e brd ff:ff:ff:ff:ff:ff
inet 192.168.0.101/24 brd 192.168.0.255 scope global eth1
inet6 2002:100:10:1::100/64 scope global
valid_lft forever preferred_lft forever <--------------------------- not "20sec" but "forever"
inet6 fe80::204:9fff:fe02:5e/64 scope link
valid_lft forever preferred_lft forever
|
|
|
10-31-2013, 03:34 PM
|
#4
|
Senior Member
Registered: Apr 2009
Posts: 1,892
Rep:
|
It is dependent on distribution. I use Fedora 18. After IPv6 address is added using your command, the display is different from yours. Check following.
ip addr add 2002:100:10:1::100/64 dev p4p1 valid_lft 0xfffffff preferred_lft 20
ip addr show p4p1
2: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:25:64:c1:90:94 brd ff:ff:ff:ff:ff:ff
inet xx.xx.xx.xx/xx brd xx.xx.xx.xx scope global p4p1
valid_lft forever preferred_lft forever
inet6 2002:100:10:1::100/64 scope global dynamic
valid_lft 2147481sec preferred_lft 18sec
inet6 fe80::225:64ff:fec1:9094/64 scope link
valid_lft forever preferred_lft forever
|
|
|
All times are GMT -5. The time now is 07:58 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|