LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2013, 04:42 PM   #1
yazzep
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
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 07:00 PM.
 
Old 10-30-2013, 02:43 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,845

Rep: Reputation: 161Reputation: 161
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.
 
Old 10-30-2013, 08:21 PM   #3
yazzep
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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
 
Old 10-31-2013, 02:34 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,845

Rep: Reputation: 161Reputation: 161
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't use ipv6 although getting address bingmou Linux - Networking 2 07-02-2009 04:58 AM
ipv6 address sarathius Programming 1 04-22-2008 02:31 PM
How to set IPv6 address on IPv6 router tlemons Linux - Networking 3 09-17-2007 01:25 PM
IPv6 address ????????? hegdeshashi Programming 3 06-19-2006 03:13 AM
getting IPv6 address lacitpo Linux - Networking 1 03-18-2005 11:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration