Skip to content
  • Thomas Haller's avatar
    ndisc: rename NMNDiscPreference to NMIcmpv6RouterPref · 32142a63
    Thomas Haller authored
    We encounter the same enum in 3 forms:
    
      - NMNDiscPreference in NetworkManager
      - "enum ndp_route_preference" in <ndp.h>
      - ICMPV6_ROUTER_PREF_* in <linux/icmpv6.h>
    
    Move our enum to nm-core-utils.h, so that it can be used
    by platform code as well (platform code should not include
    ndisc/nm-ndisc.h).
    
    Also, NMNDiscPreference was not numerically identical to their
    native values (meaning: it shuffled the names and numbers).
    Make them all numerically equal, so that they can be used in
    the same context.
    This means, while previously we could compare NMNDiscPreference
    directly according to their priority, we now need _preference_to_priority().
    On the other hand, we could omit translate_preference() -- but actually,
    we still have _route_preference_coerce() because pref comes from libndp
    and is thus untrusted. We still have to range check it.
    32142a63