[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1305207143.3795.23.camel@edumazet-laptop>
Date: Thu, 12 May 2011 15:32:23 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Chin Shi Hong <cshong87@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: ifreq flags or ioctl calls to turn an interface down?
Le jeudi 12 mai 2011 à 21:27 +0800, Chin Shi Hong a écrit :
> Dear all,
>
> I am developing an application that will turn a network interface down
> (something like command "ifconfig <network interface> down".
>
> What are the ifreq flags or ioctl calls to turn a network interface down?
>
> Or is there any other way to implement this feature into my application?
Quick answer :
strace ifconfig eth2 down
...
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
ioctl(4, SIOCGIFFLAGS, {ifr_name="eth2", ifr_flags=IFF_UP|IFF_BROADCAST|
IFF_RUNNING|IFF_MULTICAST}) = 0
ioctl(4, SIOCSIFFLAGS, {ifr_name="eth2", ifr_flags=IFF_BROADCAST|
IFF_RUNNING|IFF_MULTICAST}) = 0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists