[radvd-devel-l] radvd to check whether forwarding is enabled

Pekka Savola radvd-devel-l@litech.org
Fri, 21 Dec 2001 13:02:05 +0200 (EET)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--1589707168-1716617292-1008932525=:24470
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi,

Triggered by a code snippet by Marko, I took the time to add a feature 
which checks whether forwarding has been enabled before starting radvd.

Note that if the correct sysctl setting is not found (usually caused by 
kernel sysctl interface change), radvd will start, nevertheless.. this is 
of advisory value only anyway..

(personally I dislike putting sysctl branches in pathnames.h but couldn't
figure out a better place..)

I'll wait for possible comments for a few days before committing.

-- 
Pekka Savola                 "Tell me of difficulties surmounted,
Netcore Oy                   not those you stumble over and fall"
Systems. Networks. Security.  -- Robert Jordan: A Crown of Swords


--1589707168-1716617292-1008932525=:24470
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="radvd-check_forwarding.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.33.0112211302050.24470@netcore.fi>
Content-Description: 
Content-Disposition: attachment; filename="radvd-check_forwarding.patch"

ZGlmZiAtdU5yIHJhZHZkL0NIQU5HRVMgcmFkdmQtL0NIQU5HRVMNCi0tLSBy
YWR2ZC9DSEFOR0VTCVRodSBOb3YgMjIgMTA6MzA6MjYgMjAwMQ0KKysrIHJh
ZHZkLS9DSEFOR0VTCUZyaSBEZWMgMjEgMTI6NDY6NTEgMjAwMQ0KQEAgLTEs
NSArMSw5IEBADQogJElkOiBDSEFOR0VTLHYgMS4xMiAyMDAxLzExLzIyIDA4
OjMwOjI2IHBzYXZvbGEgRXhwICQNCiANCisxMi8yMS8yMDAxCUNoZWNrIHZp
YSBzeXNjdGwgdGhhdCBJUHY2IGZvcndhcmRpbmcgaXMgZW5hYmxlZDsNCisJ
CWV4aXQgdW5sZXNzIGRlYnVnZ2luZyBpcyBlbmFibGVkLiAgVHJpZ2dlcmV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