[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D5F4E2559@AcuExch.aculab.com>
Date: Wed, 22 Jun 2016 13:00:08 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jakub Sitnicki' <jkbs@...hat.com>, Phil Sutter <phil@....cc>
CC: Stephen Hemminger <shemming@...cade.com>,
Daniel Borkmann <daniel@...earbox.net>,
David Ahern <dsa@...ulusnetworks.com>,
"Nicolas Dichtel" <nicolas.dichtel@...nd.com>,
Julien Floret <julien.floret@...nd.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a
bit
From: Jakub Sitnicki
> Sent: 22 June 2016 12:34
...
> > - a = attrs[TCP_METRICS_ATTR_ADDR_IPV4];
> > - if (a) {
> > + if ((a = attrs[TCP_METRICS_ATTR_ADDR_IPV4])) {
>
> Copy the pointer inside the branch?
>
> Same gain on indentation while keeping checkpatch happy.
Or as below (hacked from the mails):
a = attrs[TCP_METRICS_ATTR_ADDR_IPV4];
if (a) {
if (f.daddr.family && f.daddr.family != AF_INET)
return 0;
memcpy(&daddr.data, RTA_DATA(a), 4);
daddr.bytelen = 4;
family = AF_INET;
atype = TCP_METRICS_ATTR_ADDR_IPV4;
dlen = RTA_PAYLOAD(a);
} else {
a = attrs[TCP_METRICS_ATTR_ADDR_IPV6];
if (!a)
return 0;
memcpy(&daddr.data, RTA_DATA(a), 16);
daddr.bytelen = 16;
family = AF_INET6;
atype = TCP_METRICS_ATTR_ADDR_IPV6;
dlen = RTA_PAYLOAD(a);
}
David
Powered by blists - more mailing lists