Avoid undefined behavior with high interface index

Cherry-pick from aosp/2125173

Behavior of bitwise left shift is undefined when the right operator is
greater than the number of bits in the left operand; so the code relied
on undefined behavior when interface indexes were >= 32.

Just use a boolean instead, as the result was only used as a boolean.

Also do not limit reads in if_inet6 to 1 byte for address flags, scope
value, and prefix length, as there is no good reason to do so, and this
is in line with more recent upstream versions and the interface index
read. In practice prefix length, scope value and interface flags should
not be above 255 so this should be a no-op.

Bug: 235797641
Test: atest NsdManagerTest --rerun-until-failure 50
Change-Id: I41fae1900400779cecb715e8cfb1e662b88fd41d
Merged-In: I41fae1900400779cecb715e8cfb1e662b88fd41d
2 files changed