The tutorial you used is too old! if you want a reference for this system call you should check out this link : http://man7.org/linux/man-pages/man2/sysctl.2.html
You get SIGSYS error because the sysctl does not exist. The correct name for that system is *_syscall* and glibc does not provide a wrapper becuase this syscall should not be called (it will be removed from the next Linux versions). You can be achieve the same result using the /proc interface.
If you want to keep your solution, you should change the code as follows ( I have not tested ,sorry):
#include <sys/syscall.h>
int path_len = 5;
int tun0_accept_ra_path[] = { CTL_NET,
NET_IPV6,
NET_IPV6_CONF,
ifr6.ifr6_ifindex,
NET_IPV6_ACCEPT_RA };
int tun0_accept_ra_value = 0;
if (syscall(__NR_sysctl,
tun0_accept_ra_path,
path_len,
NULL,
0,
&tun0_accept_ra_value,
sizeof(tun0_accept_ra_value)) < 0) {
printf("set sysctl 'accept_ra' failed. errno: %d\n", errno);
}
A better solution may be :
int tun0_accept_ra_value = 0;
if ((fd=open("/proc/sys/net/ipv6/conf/tun0/accept_ra", O_RDWR)) < 0)
perror("OPEN");
if (write (fd, &tun0_accept_ra_value, sizeof(int)) < 0)
perror("WRITE");
close(fd);
I hope I have been useful.