diff options
author | Chris Kuiper <ckuiper@google.com> | 2019-09-24 13:18:19 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-09-24 13:21:20 -0700 |
commit | 6704d625ef2726a54078f4179d0eaa2c820cc401 (patch) | |
tree | f087fd9889d41a23d9ee31be6573811644f4ac68 /pkg/sentry/kernel/rseq.go | |
parent | 91abeb1dbc83d7c55fdbbdeec07c1c6c41d80d7a (diff) |
Return only primary addresses in Stack.NICInfo()
Non-primary addresses are used for endpoints created to accept multicast and
broadcast packets, as well as "helper" endpoints (0.0.0.0) that allow sending
packets when no proper address has been assigned yet (e.g., for DHCP). These
addresses are not real addresses from a user point of view and should not be
part of the NICInfo() value. Also see b/127321246 for more info.
This switches NICInfo() to call a new NIC.PrimaryAddresses() function. To still
allow an option to get all addresses (mostly for testing) I added
Stack.GetAllAddresses() and NIC.AllAddresses().
In addition, the return value for GetMainNICAddress() was changed for the case
where the NIC has no primary address. Instead of returning an error here,
it now returns an empty AddressWithPrefix() value. The rational for this
change is that it is a valid case for a NIC to have no primary addresses.
Lastly, I refactored the code based on the new additions.
PiperOrigin-RevId: 270971764
Diffstat (limited to 'pkg/sentry/kernel/rseq.go')
0 files changed, 0 insertions, 0 deletions