Re: Memory leaks with GRE Tunnels

From: andrew may (acmay@acmay.homeip.net)
Date: Fri Feb 01 2002 - 23:29:08 EST


I don't think there is a kernel problem, there is an ioctl to delete
tunnels and it does work. if tun0 down does not delete the tunnel you
need to send down the ioctl as well. I don't know what user tools do
this for you, I have always done my own.

This is all the code ryou really need

{
        struct ifreq ifr;
        int fd;
        int i=0;

        if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
                SYSLOG(LOG_DAEMON | LOG_ERR, "Cannot open socket to close tunnel(s)\n");
                return;
        }

        sprintf(ifr.ifr_name,"tun%d", i);
        if( (ioctl(fd, SIOCDELTUNNEL, &ifr) < 0) {
                        SYSLOG(LOG_DAEMON | LOG_ERR, "Can't DELTUNNEL %s (%m)\n", ifr.ifr_name);
                }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Feb 07 2002 - 21:00:20 EST