If I add a new IPv4 address to a network interface(for example, ip -4 addr add 192.0.2.1/24 dev eth0
) without rtnetlink IFA_CACHEINFO attribute and then ask for IPv4 addresses configured on that interface(for example, ip -4 addr show dev eth0
), then the rtnetlink result is returned with IFA_F_PERMANENT
flag set. How and where in the kernel code are IFA_CACHEINFO
attribute and IFA_F_PERMANENT
flag connected?
Asked
Active
Viewed 101 times
1

Martin
- 957
- 7
- 25
- 38
2 Answers
0
According to this RFC the IFA_F_PERMANENT
means that you specified the address yourself (you haven't let Linux come up with an address for you) and Linux will use it even after the interface is rebooted.
The ip
command you used did exactly this, so that is why you got the IFA_F_PERMANENT
flag and AFAIK it has nothing to do with IFA_CACHEINFO
.

LITzman
- 730
- 1
- 16
0
The IFA_CACHEINFO attribute and IFA_F_PERMANENT flag are connected in the kernel code by the __rtnl_newlink() function. This function is responsible for allocating a new interface and setting up the IFA_CACHEINFO attributes with the IFA_F_PERMANENT flag set. The function is located in net/core/rtnetlink.c.