From: Stephen Hemminger <stephen@networkplumber.org>
To: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Cc: netdev@vger.kernel.org
Subject: Re: [iproute2] iplink: add support for IFLA_CARRIER attribute
Date: Wed, 26 Apr 2017 08:07:32 -0700 [thread overview]
Message-ID: <20170426080732.51f56b8c@xeon-e3> (raw)
In-Reply-To: <1493190519-5518-1-git-send-email-zhangshengju@cmss.chinamobile.com>
On Wed, 26 Apr 2017 15:08:39 +0800
Zhang Shengju <zhangshengju@cmss.chinamobile.com> wrote:
> Add support to set IFLA_CARRIER attribute.
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> ---
> ip/iplink.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 866ad72..263bfdd 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -72,6 +72,7 @@ void iplink_usage(void)
> " [ allmulticast { on | off } ]\n"
> " [ promisc { on | off } ]\n"
> " [ trailers { on | off } ]\n"
> + " [ carrier { on | off } ]\n"
> " [ txqueuelen PACKETS ]\n"
> " [ name NEWNAME ]\n"
> " [ address LLADDR ]\n"
> @@ -673,6 +674,17 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
> req->i.ifi_flags |= IFF_NOARP;
> else
> return on_off("arp", *argv);
> + } else if (strcmp(*argv, "carrier") == 0) {
> + int carrier;
> + NEXT_ARG();
> + if (strcmp(*argv, "on") == 0)
> + carrier = 1;
> + else if (strcmp(*argv, "off") == 0)
> + carrier = 0;
> + else
> + return on_off("carrier", *argv);
> +
> + addattr8(&req->n, sizeof(*req), IFLA_CARRIER, carrier);
> } else if (strcmp(*argv, "vf") == 0) {
> struct rtattr *vflist;
>
The general policy of ip link command is all options should be invertable.
There are some VPN's that use this to save and restore state. So if you add
an option to set something there should be similar output under the detailed show command.
next prev parent reply other threads:[~2017-04-26 15:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 7:08 [iproute2] iplink: add support for IFLA_CARRIER attribute Zhang Shengju
2017-04-26 9:59 ` Nikolay Aleksandrov
2017-04-26 15:07 ` Stephen Hemminger [this message]
2017-04-27 6:35 ` 张胜举
2017-05-01 16:16 ` Stephen Hemminger
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=20170426080732.51f56b8c@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
--cc=zhangshengju@cmss.chinamobile.com \
/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;
as well as URLs for NNTP newsgroup(s).