Added method to set a (pseudo)random local port, so that the board needs not to use always the same embedded local port for receiving NTP packets.
At the moment, the variable port is a constant embedded value used by the board for receiving NTP packets via unencrypted UDP connection. Changing randomly port to receive NTP packets doesn't improve cryptographic security and it is not the final solution, but it adds a layer to make harder the attacker's job.
setRandomPort() sets a pseudorandom port and NTPClient::update() launches NTPClient.begin(port) if port is different by default value NTP_DEFAULT_LOCAL_PORT
At the moment, the variable
port
is a constant embedded value used by the board for receiving NTP packets via unencrypted UDP connection. Changing randomly port to receive NTP packets doesn't improve cryptographic security and it is not the final solution, but it adds a layer to make harder the attacker's job.How to use
How it works
setRandomPort()
sets a pseudorandom port andNTPClient::update()
launchesNTPClient.begin(port)
ifport
is different by default valueNTP_DEFAULT_LOCAL_PORT