lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55fa5039-9273-3f5e-f911-f4baf1b01a4b@kernel.org>
Date:   Wed, 28 Sep 2022 12:33:01 -0600
From:   David Ahern <dsahern@...nel.org>
To:     Hangbin Liu <liuhangbin@...il.com>
Cc:     netdev@...r.kernel.org,
        Stephen Hemminger <stephen@...workplumber.org>,
        Guillaume Nault <gnault@...hat.com>
Subject: Re: [PATCH iproute2-next] rtnetlink: add new function
 rtnl_echo_talk()

On 9/28/22 11:37 PM, Hangbin Liu wrote:
> Hi David,
> 
> On Tue, Sep 27, 2022 at 09:12:35PM -0600, David Ahern wrote:
>>>  
>>> -	if (echo_request)
>>> -		ret = rtnl_talk(&rth, &req.n, &answer);
>>> -	else
>>> -		ret = rtnl_talk(&rth, &req.n, NULL);
>>> -
>>> -	if (ret < 0)
>>> -		return -2;
>>> -
>>> -	if (echo_request) {
>>> -		new_json_obj(json);
>>> -		open_json_object(NULL);
>>> -		print_addrinfo(answer, stdout);
>>> -		close_json_object();
>>> -		delete_json_obj();
>>> -		free(answer);
>>> -	}
>>> -
>>> -	return 0;
>>> +	return rtnl_echo_talk(&rth, &req.n, print_addrinfo);
>>
>> I was thinking something more like:
>>
>> if (echo_request)
>> 	return rtnl_echo_talk(&rth, &req.n, print_addrinfo);
>>
>> return rtnl_talk(&rth, &req.n, NULL);
> 
> OK, I will update the patch. I have one question about the return value.
> In previous code, the function return -2 if rtnl_talk() fails. I don't know
> why we use "-2" here. And you suggested to just return rtnl_talk() directly.
> 
> Does this means we can ignore the -2 return values for all the places safely,
> and just return rtnl_talk()?
> 

I do not recall why '-2'. Seems arbitrary to me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ