开发者

What is difference between IFA_LOCAL and IFA_ADDRESS in rtnetlink (Linux)

I try understand what is difference between IFA_LOCAL and IFA_ADDRESS.

this is from man:

IFA_ADDRESS  raw protocol address  interface address
IFA_LOCAL 开发者_StackOverflow raw protocol address  local address 

And I don't understand diff between local address and interface address.

Can some one to explain me? Or give me advice where I can find answer?

Thx.


This comment from if_addr.h should make it clear;

/*
 * Important comment:
 * IFA_ADDRESS is prefix address, rather than local interface address.
 * It makes no difference for normally configured broadcast interfaces,
 * but for point-to-point IFA_ADDRESS is DESTINATION address,
 * local address is supplied in IFA_LOCAL attribute.
*/


# ip a
51: ppp0@if51: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1432 qdisc fq_codel state UNKNOWN group default qlen 3
    link/ppp  link-netnsid 0
    inet 10.128.0.1 peer 10.128.140.125/32 scope global ppp0
       valid_lft forever preferred_lft forever
from pr2modules.iproute import IPRoute
from pprint import pprint

pprint(IPRoute().get_addr(index=51))
({'attrs': [('IFA_ADDRESS', '10.128.140.125'),
            ('IFA_LOCAL', '10.128.0.1'),
            ('IFA_LABEL', 'ppp0'),
            ('IFA_FLAGS', 128),
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜