crash> p neigh_tables
neigh_tables = $9 =
{0xffffffff81cd9a40 <arp_tbl>, 0xffffffff81cdec60 <nd_tbl>, 0x0}
crash> neigh_table.nht arp_tbl
nht = 0xffff880bb65c9900
crash> neigh_hash_table 0xffff880bb65c9900
struct neigh_hash_table {
hash_buckets = 0xffff880c7f6c2900,
hash_shift = 0x5,
hash_rnd = {0x8b82355f, 0xdf4571fd, 0x12153b3b, 0xe5a068dd},
rcu = {
next = 0x0,
func = 0x0
}
}
crash> rd 0xffff880c7f6c2900 32
ffff880c7f6c2900: 0000000000000000 0000000000000000 ................
ffff880c7f6c2910: 0000000000000000 0000000000000000 ................
ffff880c7f6c2920: ffff880b6e0db800 ffff880a9b63f800 ...n......c.....
ffff880c7f6c2930: ffff880b11898600 0000000000000000 ................
ffff880c7f6c2940: 0000000000000000 ffff880b0179dc00 ..........y.....
ffff880c7f6c2950: 0000000000000000 ffff880b6bf93200 .........2.k....
ffff880c7f6c2960: 0000000000000000 ffff880b00e8ee00 ................
ffff880c7f6c2970: 0000000000000000 ffff880afdef3400 .........4......
ffff880c7f6c2980: 0000000000000000 0000000000000000 ................
ffff880c7f6c2990: 0000000000000000 0000000000000000 ................
ffff880c7f6c29a0: ffff880b00e8ea00 0000000000000000 ................
ffff880c7f6c29b0: 0000000000000000 0000000000000000 ................
ffff880c7f6c29c0: 0000000000000000 ffff880b728a7e00 .........~.r....
ffff880c7f6c29d0: ffff880b00ebe000 ffff880b102c7000 .........p,.....
ffff880c7f6c29e0: ffff880b102dba00 0000000000000000 ..-.............
ffff880c7f6c29f0: ffff880aa005b600 0000000000000000 ................
crash> net -a | grep -w p4p1
ffff880b6bf93200 192.168.1.19 ETHER 24:8a:07:88:27:9b p4p1 REACHABLE
crash> neighbour ffff880b6bf93200
struct neighbour {
next = 0x0,
tbl = 0xffffffff81cd9a40 <arp_tbl>,
parms = 0xffff880c69f96cc0,
confirmed = 0x105181c00,
updated = 0x105183283,
lock = {
raw_lock = {
cnts = {
counter = 0x0
},
wait_lock = {
val = {
counter = 0x0
}
}
}
},
refcnt = {
counter = 0x2
},
arp_queue = {
next = 0xffff880b6bf93238,
prev = 0xffff880b6bf93238,
qlen = 0x0,
lock = {
{
rlock = {
raw_lock = {
val = {
counter = 0x0
}
}
}
}
}
},
arp_queue_len_bytes = 0x0,
timer = {
entry = {
next = 0x0,
pprev = 0xffff880c8ec92468
},
expires = 0x105185c66,
function = 0xffffffff8161a4d0 <neigh_timer_handler>,
data = 0xffff880b6bf93200,
flags = 0x3bc0000a
},
used = 0x105181ac0,
probes = {
counter = 0x1
},
flags = 0x0,
nud_state = 0x2,
type = 0x1,
dead = 0x0,
ha_lock = {
seqcount = {
sequence = 0x2
},
lock = {
{
rlock = {
raw_lock = {
val = {
counter = 0x0
}
}
}
}
}
},
ha = "$\212\a\210'\233\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
hh = {
hh_len = 0xe,
hh_lock = {
seqcount = {
sequence = 0x0
},
lock = {
{
rlock = {
raw_lock = {
val = {
counter = 0x0
}
}
}
}
}
},
hh_data = {0x9b2788078a240000, 0x8ca2788078a24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} # dst_mac, src_mac, ether_type
},
output = 0xffffffff81619240 <neigh_resolve_output>,
ops = 0xffffffff818c6820 <arp_hh_ops>,
rcu = {
next = 0x0,
func = 0x0
},
dev = 0xffff880c6a720000,
primary_key = 0xffff880b6bf93358 "\300\250\001\023"
}
crash> neighbour.ha ffff880b6bf93200 -o
struct neighbour {
[ffff880b6bf932a0] unsigned char ha[32];
}
crash> rd -8 ffff880b6bf932a0 6
ffff880b6bf932a0: 24 8a 07 88 27 9b $...'.
crash> rd -8 0xffff880b6bf93358 4
ffff880b6bf93358: c0 a8 01 13 .... # 192.168.1.19
# ip link set dev p4p1 address 24:8a:07:88:27:ca
If changing local mac address, the neighbour will be destroyed first, then a new one will be created.
neigh_flush_dev
neigh_cleanup_and_release
neigh_release
neigh_destroy
0xffffffff81619f20 : neigh_flush_dev.isra.36+0x0/0x140 [kernel]
0xffffffff8161a093 : neigh_changeaddr+0x33/0x50 [kernel]
0xffffffff816e71b5 : ndisc_netdev_event+0x45/0x100 [kernel]
0xffffffff810a6299 : notifier_call_chain+0x49/0x70 [kernel]
0xffffffff810a63b6 : raw_notifier_call_chain+0x16/0x20 [kernel]
0xffffffff816059c5 : call_netdevice_notifiers_info+0x35/0x60 [kernel]
0xffffffff8160716c : dev_set_mac_address+0x8c/0xb0 [kernel]
0xffffffff8161efae : do_setlink+0x3be/0xc60 [kernel]
0xffffffff816239e4 : rtnl_newlink+0x4f4/0x8c0 [kernel]
0xffffffff81623e5c : rtnetlink_rcv_msg+0xac/0x240 [kernel]
0xffffffff816472dd : netlink_rcv_skb+0xed/0x120 [kernel]
0xffffffff8161de38 : rtnetlink_rcv+0x28/0x30 [kernel]
0xffffffff81646a41 : netlink_unicast+0x181/0x240 [kernel]
0xffffffff81646dc2 : netlink_sendmsg+0x2c2/0x3b0 [kernel]
0xffffffff815ed248 : sock_sendmsg+0x38/0x50 [kernel]
0xffffffff815edb9a : ___sys_sendmsg+0x27a/0x290 [kernel]
0xffffffff815ef164 : __sys_sendmsg+0x54/0x90 [kernel]
0xffffffff815ef1b2 : sys_sendmsg+0x12/0x20 [kernel]
0xffffffff81003a07 : do_syscall_64+0x67/0x150 [kernel]
0xffffffff817335a7 : return_from_SYSCALL_64+0x0/0x6a [kernel]
parms: dev=0xffff880c6a720000 tbl=?
execname: ip
ts: 1
0x7fcf9d7617a0 : __sendmsg_nocancel+0x7/0x57 [/usr/lib64/libc-2.17.so]
0x4441b4 : __rtnl_talk+0xc4/0x3f0 [/usr/sbin/ip]
0x41efc7 : iplink_modify+0x267/0x4b0 [/usr/sbin/ip]
0x41f422 : do_iplink+0xe2/0xf80 [/usr/sbin/ip]
0x408504 : do_cmd+0x44/0x80 [/usr/sbin/ip]
0x40801f : main+0x20f/0x577 [/usr/sbin/ip]
0x7fcf9d68ab35 : __libc_start_main+0xf5/0x1c0 [/usr/lib64/libc-2.17.so]
0x4083b0 : _start+0x29/0x39 [/usr/sbin/ip]
0xffffffff8161bfa0 : __neigh_create+0x0/0x590 [kernel]
0xffffffff81657fd7 : ip_finish_output2+0x197/0x390 [kernel]
0xffffffff81659686 : ip_finish_output+0x136/0x1e0 [kernel]
0xffffffff8165a136 : ip_output+0x76/0xe0 [kernel]
0xffffffff81659885 : ip_local_out+0x35/0x40 [kernel]
0xffffffff816a1f8e : iptunnel_xmit+0x13e/0x1a0 [kernel]
0xffffffffa116142c : udp_tunnel_xmit_skb+0xfc/0x110 [udp_tunnel]
0xffffffffa116b3f7 : vxlan_xmit_one+0x7e7/0xa40 [vxlan]
0xffffffffa116c7ca : vxlan_xmit+0x35a/0x0 [vxlan]
0xffffffff8160d9c1 : dev_hard_start_xmit+0xa1/0x210 [kernel]
0xffffffff8160e130 : __dev_queue_xmit+0x510/0x630 [kernel]
0xffffffff8160e260 : dev_queue_xmit+0x10/0x20 [kernel]
0xffffffffa114a792 : ovs_vport_send+0xc2/0x150 [openvswitch]
0xffffffffa113c103 : do_output+0x53/0xf0 [openvswitch]
0xffffffffa113d5cc : do_execute_actions+0x9bc/0x9d0 [openvswitch]
0xffffffffa113d9c0 : ovs_execute_actions+0x40/0x120 [openvswitch]
0xffffffffa1141334 : ovs_dp_process_packet+0x84/0x120 [openvswitch]
0xffffffffa114a673 : ovs_vport_receive+0x73/0xd0 [openvswitch]
0xffffffffa114b093 : netdev_frame_hook+0xd3/0x160 [openvswitch]
0xffffffff8160c3a6 : __netif_receive_skb_core+0x1e6/0xa20 [kernel]
parms: tbl=0xffffffff81cd9a40 pkey=0xffff880c8ec833cc dev=0xffff880c6a720000 want_ref=0x0
execname: swapper/10
If changing remove peer's mac address, neigh->nud_state will be change to NUD_DELAY, NUD_PROBE and finally NUD_REACHABLE.
#define NUD_INCOMPLETE 0x01
#define NUD_REACHABLE 0x02
#define NUD_STALE 0x04
#define NUD_DELAY 0x08
#define NUD_PROBE 0x10
#define NUD_FAILED 0x20
crash> net | grep p4p1
ffff880c6a720000 p4p1 192.168.1.18
crash> net_device.dev_addr ffff880c6a720000
dev_addr = 0xffff880c6b771eb0 "$\212\a\210", <incomplete sequence \312>
crash> rd -8 0xffff880c6b771eb0 6
ffff880c6b771eb0: 24 8a 07 88 27 ca $...'. # local mac address
crash> net_device.header_ops ffff880c6a720000
header_ops = 0xffffffff818c4740 <eth_header_ops>
crash> eth_header_ops
eth_header_ops = $5 = {
create = 0xffffffff81638600 <eth_header>,
parse = 0xffffffff81638530 <eth_header_parse>,
cache = 0xffffffff81638560 <eth_header_cache>,
cache_update = 0xffffffff816385c0 <eth_header_cache_update>,
validate = 0x0
}
crash> arp_hh_ops
arp_hh_ops = $4 = {
family = 0x2,
solicit = 0xffffffff816899a0 <arp_solicit>,
error_report = 0xffffffff81689310 <arp_error_report>,
output = 0xffffffff81619240 <neigh_resolve_output>,
connected_output = 0xffffffff81619240 <neigh_resolve_output>
}