Skip to content
  • Hannes Frederic Sowa's avatar
    ipv6: generation of stable privacy addresses for link-local and autoconf · 622c81d5
    Hannes Frederic Sowa authored
    
    
    This patch implements the stable privacy address generation for
    link-local and autoconf addresses as specified in RFC7217.
    
      RID = F(Prefix, Net_Iface, Network_ID, DAD_Counter, secret_key)
    
    is the RID (random identifier). As the hash function F we chose one
    round of sha1. Prefix will be either the link-local prefix or the
    router advertised one. As Net_Iface we use the MAC address of the
    device. DAD_Counter and secret_key are implemented as specified.
    
    We don't use Network_ID, as it couples the code too closely to other
    subsystems. It is specified as optional in the RFC.
    
    As Net_Iface we only use the MAC address: we simply have no stable
    identifier in the kernel we could possibly use: because this code might
    run very early, we cannot depend on names, as they might be changed by
    user space early on during the boot process.
    
    A new address generation mode is introduced,
    IN6_ADDR_GEN_MODE_STABLE_PRIVACY. With iproute2 one can switch back to
    none or eui64 address configuration mode although the stable_secret is
    already set.
    
    We refuse writes to ipv6/conf/all/stable_secret but only allow
    ipv6/conf/default/stable_secret and the interface specific file to be
    written to. The default stable_secret is used as the parameter for the
    namespace, the interface specific can overwrite the secret, e.g. when
    switching a network configuration from one system to another while
    inheriting the secret.
    
    Cc: Erik Kline <ek@google.com>
    Cc: Fernando Gont <fgont@si6networks.com>
    Cc: Lorenzo Colitti <lorenzo@google.com>
    Cc: YOSHIFUJI Hideaki/吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
    Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    622c81d5