Open derhuerst opened 5 months ago
I'm using netlink@0.2.4.
netlink@0.2.4
For a localaddress-agent test, I'm wondering: Is there is a way to tell "deletion events" apart from other address-related events?
localaddress-agent
import _netlink from 'netlink' const {createRtNetlink, rt} = _netlink const rtNetlink = createRtNetlink({ref: false}) rtNetlink.socket.addMembership(rt.MulticastGroups.IPV6_IFADDR) rtNetlink.on('message', msgs => console.log(...msgs)) const address = Buffer.from('fe8000000000000000000000aabb' + ('000' + Math.round(Math.random() * (16 ** 4 - 1)).toString(16)).slice(-4), 'hex') const data = { family: 10, // IPv6 prefixlen: 64, index: 2, // eth0 flags: {}, } console.log('assigning', address) await rtNetlink.newAddress(data, {address}) await new Promise(r => setTimeout(r, 3000)) // wait until address is not tentative anymore console.log('deleting', address) await rtNetlink.delAddress(data, {address}) await new Promise(r => setTimeout(r, 5000)) // wait for delete event?
assigning <Buffer fe 80 00 00 00 00 00 00 00 00 00 00 aa bb 8e 87> { kind: 'address', data: { family: 10, prefixlen: 64, flags: { tentative: true, permanent: true }, scope: 253, index: 2 }, attrs: { address: <Buffer fe 80 00 00 00 00 00 00 00 00 00 00 aa bb 8e 87>, cacheInfo: { ifaPrefered: 4294967295, ifaValid: 4294967295, cstamp: 274377, tstamp: 274377 }, flags: { tentative: true, permanent: true } } } { kind: 'address', data: { family: 10, prefixlen: 64, flags: { permanent: true }, scope: 253, index: 2 }, attrs: { address: <Buffer fe 80 00 00 00 00 00 00 00 00 00 00 aa bb 8e 87>, cacheInfo: { ifaPrefered: 4294967295, ifaValid: 4294967295, cstamp: 274377, tstamp: 274377 }, flags: { permanent: true } } } deleting <Buffer fe 80 00 00 00 00 00 00 00 00 00 00 aa bb 8e 87> { kind: 'address', data: { family: 10, prefixlen: 64, flags: { permanent: true }, scope: 253, index: 2 }, attrs: { address: <Buffer fe 80 00 00 00 00 00 00 00 00 00 00 aa bb 8e 87>, cacheInfo: { ifaPrefered: 4294967295, ifaValid: 4294967295, cstamp: 274377, tstamp: 274377 }, flags: { permanent: true } } }
I'm using
netlink@0.2.4
.For a
localaddress-agent
test, I'm wondering: Is there is a way to tell "deletion events" apart from other address-related events?