cfengine/core — pull request #1227 by lpefferkorn (2013-12-25 19:28:50+00:00)
Title: Restrict highest possible tcp port value 

A tcp port can not be greater than 65535 according to RFCs. Anything above does not make sense.

Beside being more RFC compliant (to be fully compliant, the lowest possible port should be 1, not 1024), this patch also makes cf-serverd more reliable.
At the moment if the **port** parameter in body server control is above 65535, cf-serverd will happily start listening, but on a totally different port :

body server control
{
port => "88888";
(....)
}

Restarting cf-serverd:

killall cf-serverd && cf-agent -KI

Checking where cf-serverd is listening:

# netstat -lpn|grep cf-serverd
tcp 0 0 0.0.0.0:23352 0.0.0.0:* LISTEN 9161/cf-serverd

Set port to default or something that makes sense ( 1 <= port <= 65535), then cf-serverd will be working correctly (example with 8888)

# netstat -lpn|grep cf-serverd
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 9132/cf-serverd

With this patch, the parser will throw an error if the tcp port if outside the correct tcp range, which is by far less puzzling than no message at all:

2013-12-25T19:53:43+0100 notice: /default/cfe_internal_update_processes/methods/'ENABLING CFE AGENTS'/default/enable_cfengine_agents: Q: "...f-serverd"": /var/cfengine/inputs/controls/cf_serverd.cf:12:16: error: Integer is out of range

If accepted, I will also issue a PR to update the documentation.
By the way, should I also lower to 1 the tcp port restriction, from the current 1024 value?

Merry Xmas !