On Tue, Oct 17, 2023 at 04:47:36PM +0200, Claudio Jeker wrote:
> Looking at fixing portable I realized that some bits around mask2prefixlen
> can be cleaned up.
> 
> First in session.c the plen != 0xff check is not needed since it never can
> happen.
> 
> 2nd the checks for sin_len and sin6_len == 0 are also impossible. A
> sockaddr can not have length 0. A default route would at least have
> sin_len == 4 but on OpenBSD even that no longer happens.

Yes, this looks like a mistake must have happened earlier. The only
realistic scenario would be an addr that comes freshly out of memset().
But for those nothing changes and the return 0 remains.

> Last check for RTF_HOST first, then for sa_in != NULL. If RTF_HOST is set
> the netmask is irrelevant.

ok tb.

Reply via email to