Netdev List
 help / color / mirror / Atom feed
* ifreq flags or ioctl calls to turn an interface down?
@ 2011-05-12 13:27 Chin Shi Hong
  2011-05-12 13:32 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Chin Shi Hong @ 2011-05-12 13:27 UTC (permalink / raw)
  To: netdev

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ifreq flags or ioctl calls to turn an interface down?
  2011-05-12 13:27 ifreq flags or ioctl calls to turn an interface down? Chin Shi Hong
@ 2011-05-12 13:32 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2011-05-12 13:32 UTC (permalink / raw)
  To: Chin Shi Hong; +Cc: netdev

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-12 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-12 13:27 ifreq flags or ioctl calls to turn an interface down? Chin Shi Hong
2011-05-12 13:32 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox