[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20121023.132940.1732325493436273627.davem@davemloft.net>
Date: Tue, 23 Oct 2012 13:29:40 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: nicolas.dichtel@...nd.com
Cc: netdev@...r.kernel.org
Subject: Re: [RFC PATCH net-next 2/3] rtnl/ipv6: use netconf msg to
advertise forwarding status
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Date: Tue, 23 Oct 2012 11:49:48 +0200
> +static int inet6_fill_netconf_devconf(struct sk_buff *skb, int ifindex,
> + struct ipv6_devconf *devconf, u32 portid,
> + u32 seq, int event, unsigned int flags)
> +{
> + struct nlmsghdr *nlh;
> + struct netconfmsg *ncm;
> +
> + nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg),
> + flags);
> + if (nlh == NULL)
> + return -EMSGSIZE;
> +
> + ncm = nlmsg_data(nlh);
> + ncm->ncm_family = AF_INET6;
> +
> + if (nla_put_s32(skb, NETCONFA_IFINDEX, ifindex) < 0) {
> + nlmsg_cancel(skb, nlh);
> + return -EMSGSIZE;
> + }
> + if (nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0) {
> + nlmsg_cancel(skb, nlh);
> + return -EMSGSIZE;
> + }
> +
> + return nlmsg_end(skb, nlh);
> +}
Don't report values that aren't changing, that's wasteful.
You need to therefore provide a ->get() operation, so that when
a daemon starts up which is interested in these values, it can
fetch the initial state.
That's why you should only report the differences in the events,
rather than unconditionally reporting all the values all the
time, whether they change or not.
--
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