• Chris Novakovic's avatar
    ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers · c04d2cb2
    Chris Novakovic authored
    Distributed filesystems are most effective when the server and client
    clocks are synchronised. Embedded devices often use NFS for their
    root filesystem but typically do not contain an RTC, so the clocks of
    the NFS server and the embedded device will be out-of-sync when the root
    filesystem is mounted (and may not be synchronised until late in the
    boot process).
    
    Extend ipconfig with the ability to export IP addresses of NTP servers
    it discovers to /proc/net/ipconfig/ntp_servers. They can be supplied as
    follows:
    
     - If ipconfig is configured manually via the "ip=" or "nfsaddrs="
       kernel command line parameters, one NTP server can be specified in
       the new "<ntp0-ip>" parameter.
     - If ipconfig is autoconfigured via DHCP, request DHCP option 42 in
       the DHCPDISCOVER message, and record the IP addresses of up to three
       NTP servers sent by the responding DHCP server in the subsequent
       DHCPOFFER message.
    
    ipconfig will only write the NTP server IP addresses it discovers to
    /proc/net/ipconfig/ntp_servers, one per line (in the order received from
    the DHCP server, if DHCP autoconfiguration is used); making use of these
    NTP servers is the responsibility of a user space process (e.g. an
    initrd/initram script that invokes an NTP client before mounting an NFS
    root filesystem).
    Signed-off-by: default avatarChris Novakovic <chris@chrisn.me.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c04d2cb2
ipconfig.c 42.2 KB