sysctl() and NET_IPV4_FORWARD

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

 



Simple test attached fails with 2.4.x (tested with 2.4.23 and 2.4.19). 
It works with 2.6 (tested with 2.6.0-test11-mm1). Writing works in 
both 2.4 and 2.6, only reading is problem in 2.4.

Am I doing something wrong? Or is it bug?

regards,

-- 
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <linux/sysctl.h>

int main(int argc, char **argv)
{
  int name[] = {CTL_NET, NET_IPV4, NET_IPV4_FORWARD};
  int namelen = 3;
  int readval, error;
  size_t len = sizeof(readval);

  error = sysctl (name, namelen, &readval, &len, NULL, 0);
  if (error) {
    fprintf(stderr, "sysctl(): %s\n", strerror(error));
    exit(1);
  }
  printf("Current value: %i\n", readval);
  exit(0);
}


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux