Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Chin Shi Hong <cshong87@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: ifreq flags or ioctl calls to turn an interface down?
Date: Thu, 12 May 2011 15:32:23 +0200	[thread overview]
Message-ID: <1305207143.3795.23.camel@edumazet-laptop> (raw)
In-Reply-To: <BANLkTim=DPqz+pS3DDHw=C4MGMJmu6t=GA@mail.gmail.com>

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




      reply	other threads:[~2011-05-12 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305207143.3795.23.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=cshong87@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox