[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: sysctl is using deprecated syscall (fwd)

Forwarding for Peter, with a later comment added in.

---------- Forwarded message ----------
Date: Wed, 11 Apr 2007 11:30:46 +0200
From: Peter Bieringer <pb bieringer de>
To: Pekka Savola <pekkas netcore fi>
Cc: Development discussions related to Fedora Core
    <fedora-devel-list redhat com>
Subject: Re: sysctl is using deprecated syscall

Hi Pekka and others,

At 11.04.2007 08:20, Pekka Savola wrote:
(I added Peter in Cc: as he's probably not following this.)

Thank you for notifying, perhaps list moderator has to release my reply

On Tue, 10 Apr 2007, Miloslav Trmac wrote:
Tomas Smetana napsal(a):
The problem is that any attempt to read a deprecated sysctl ends up
with kernel warning in the log. Thus "sysctl -a" produces warnings and
since "sysctl -a" is used in init scripts

While I have no opinion about the general case, can't the (sysctl -a
|grep "^net\.ipv6.conf\.") be replaced by (sysctl net.ipv6.conf) ?

The reason is probably that when the initscripts were created 'sysctl
net.ipv6.conf' wasn't supported.  For example, it doesn't work (returns
nothing) on RHL73 and RHL9 (and I suspect RHEL21 and RHEL3).
It works on RHEL4 though.

I'm also not sure (didn't check) if the failure mode is different when
IPv6 hasn't been loaded.  The grep returns an empty set, sysctl returns
an error and a return code.  Either could be made to work.

In this place, "sysctl -a" only retrieves the existing interface list
plus "all" and "default". This can be completly rewritten, if required.

Interface list is as far as I tested currently available via

# cat /proc/net/if_inet6 | awk '{ print $6 }' | sort -u

So we can rewrite this with e.g.

echo -e "all\ndefault\n`cat /proc/net/if_inet6 | awk '{ print $6 }' | sort -u`"

Instead of using /proc/net/if_inet6 also "ip" can be used:

# ip link | grep -w mtu | awk '{ print $2 }' | sed 's/://g'

echo -e "all\ndefault\n`ip link | grep -w mtu | awk '{ print $2 }' | sed

[[ Comment later on: This was not a good idea, because the list also contains IPv4 only interfaces like "ppp", so "sysctl -w ..." would throw an error.

Is there no tool available which retrieves the interface list from
kernel with the used protocols? ]]

The first should probably be the preferred one.
I will update my initscripts afterwards.

Dr. Peter Bieringer                     http://www.bieringer.de/pb/
GPG/PGP Key 0x958F422D                       mailto:pb bieringer de
Deep Space 6 Co-Founder and Core Member  http://www.deepspace6.net/
OpenBC                    http://www.openbc.com/hp/Peter_Bieringer/
Personal invitation to OpenBC  http://www.openbc.com/go/invita/3889

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]