1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 11:55:44 +03:00

sd-ndisc: simplify clamping of router "pref" parameter

This commit is contained in:
Lennart Poettering 2016-05-24 21:24:43 +02:00
parent 3e261cfd3c
commit 745c5152c2

View File

@ -570,14 +570,8 @@ static int ndisc_router_advertisement_recv(sd_event_source *s, int fd, uint32_t
stateful = ra->nd_ra_flags_reserved & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER);
pref = (ra->nd_ra_flags_reserved & ND_RA_FLAG_PREF) >> 3;
switch (pref) {
case ND_RA_FLAG_PREF_LOW:
case ND_RA_FLAG_PREF_HIGH:
break;
default:
if (!IN_SET(pref, ND_RA_FLAG_PREF_LOW, ND_RA_FLAG_PREF_HIGH))
pref = ND_RA_FLAG_PREF_MEDIUM;
break;
}
lifetime = be16toh(ra->nd_ra_router_lifetime);