[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inetutils-1.4.1: suggest removal of getprotobyname() calls
From: |
Sergey Poznyakoff |
Subject: |
Re: inetutils-1.4.1: suggest removal of getprotobyname() calls |
Date: |
Fri, 4 Oct 2002 11:56:09 +0300 |
Hello,
> There are three places in the code that use getprotobyname() calls with a
> constant name. That's pointless, as the number for a specific protocol
> never changes. It bloats the code slightly (as opposed to compiling in
> the numbers), and means that ping requires /etc/protocols to be available
> to function.
Hmm, /etc/protocols is supposed to function on any decent platform :^)
Anyway, I don't believe getprotobyname hurts performance in any way,
given that it is executed only once, at startup.
> I noticed also that two of the uses seem to be erroneous as well. In
> rshd.c and rlogind.c, `getprotobyname("ip")' is looked up and the result
> used as a level argument to get/setsockopt(), with IPPROTO_IP as a
> fallback. But the level argument should be a SOL_* constant, not an
> IPPROTO_* constant. It happens to work on Linux because IPPROTO_IP has
> the same numeric value of the correct constant, SOL_IP (0).
That's right. Thanks for noticing.
Regards,
Sergey