Reading sysctl docs, I found the following:

use_tempaddr - INTEGER
    Preference for Privacy Extensions (RFC3041).
      <= 0 : disable Privacy Extensions
      == 1 : enable Privacy Extensions, but prefer public
             addresses over temporary addresses.
      >  1 : enable Privacy Extensions and prefer temporary
             addresses over public addresses.
    Default:  0 (for most devices)
         -1 (for point-to-point devices and loopback devices)

So, when I set the use_tempaddr parameter to 0 , the Privacy Extensions are disabled, which means no temp addresses are used. When set to 2 , the Privacy Extension are enabled, and hence temp addresses are used. But when I set use_tempaddr to 1 the Privacy Extension are enabled but the temp addresses aren't used... So what's the purpose of having the three options, when only two of them make sense? What's the use case for use_tempaddr set to 1 ?

  • you'll probably get some answers with rationalizations for that -- but the long and short of it is that it makes no sense, just like having ipv6 addresses generated from the MAC in the 1st place or keeping the MAC-generated address around ("preferred" or not) when using privacy extensions. You should look into using rfc7217 instead. – Uncle Billy Feb 10 '19 at 8:06
  • from a strictly technical point of view, notice that an application can bind an outgoing socket to any address set on an interface -- the "preferred" option only tells the kernel which local address to use when the app doesn't bind the socket explicitly. – Uncle Billy Feb 10 '19 at 8:11
  • Having the original IPv6 addr makes sense -- ppl from the net can connect to you and they always can connect using the same addr, so you don't have to give it to them each time when you're using Privacy Extensions. – Mikhail Morfikov Feb 10 '19 at 8:17
  • there are such things like dynamic dns ;-) – Uncle Billy Feb 10 '19 at 8:18
  • Why to use it when it works OOTB? – Mikhail Morfikov Feb 10 '19 at 8:28

Setting it to 1 is one way to support a situation where some applications prefer ever-changing addresses and others prefer a long-lived address.

For example, if you use SSH, an RDP client and a web browser on the same laptop, you might want long-lived addresses for RDP and SSH (because both of those can use TCP connections that stay open for many hours or even days) and ever-changing addresses for the web browser (because of tracking concerns).

There are several ways to support this scenario. One of them is to set use_tempaddr to 1 and write special code to choose source address in the web browser. (I've seen such code, I think in an android app. I was puzzled by it. Didn't understand the point yet.)

There are other ways to achieve the same goal. But if you think that the kernel should let userspace maintainers decide which way is the best, then makes sense for the kernel to allow tempaddr=1.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.