nn_setsockopt checks whether option value is in the valid range

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>