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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 9 Jan 2018 08:10:13 -0800
From:   John Fastabend <john.fastabend@...il.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>
Cc:     ast@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org
Subject: Re: [bpf-next PATCH 1/7] bpf: refactor sockmap sample program update
 for arg parsing

On 01/09/2018 05:30 AM, Jesper Dangaard Brouer wrote:
> On Mon, 08 Jan 2018 10:05:07 -0800
> John Fastabend <john.fastabend@...il.com> wrote:
> 
>> sockmap sample program takes arguments from cmd line but it reads them
>> in using offsets into the array. Because we want to add more arguments
>> in the future lets do proper argument handling.
>>
>> Also refactor code to pull apart sock init and ping/pong test. This
>> allows us to add new tests in the future.
>>
>> Signed-off-by: John Fastabend <john.fastabend@...il.com>
>> ---
>>  samples/sockmap/sockmap_user.c |  142 +++++++++++++++++++++++++++++-----------
>>  1 file changed, 103 insertions(+), 39 deletions(-)
>>
>> diff --git a/samples/sockmap/sockmap_user.c b/samples/sockmap/sockmap_user.c
>> index 7cc9d22..5cbe7a5 100644
>> --- a/samples/sockmap/sockmap_user.c
>> +++ b/samples/sockmap/sockmap_user.c
>> @@ -35,6 +35,8 @@
>>  #include <assert.h>
>>  #include <libgen.h>
>>  
>> +#include <getopt.h>
>> +
>>  #include "../bpf/bpf_load.h"
>>  #include "../bpf/bpf_util.h"
>>  #include "../bpf/libbpf.h"
>> @@ -46,15 +48,39 @@
>>  #define S1_PORT 10000
>>  #define S2_PORT 10001
>>  
>> -static int sockmap_test_sockets(int rate, int dot)
>> +/* global sockets */
>> +int s1, s2, c1, c2, p1, p2;
>> +
>> +static const struct option long_options[] = {
>> +	{"help",	no_argument,		NULL, 'h' },
>> +	{"cgroup",	required_argument,	NULL, 'c' },
>> +	{"rate",	required_argument,	NULL, 'r' },
>> +	{"verbose",	no_argument,		NULL, 'v' },
>> +	{0, 0, NULL, 0 }
>> +};
>> +
>> +static void usage(char *argv[])
>> +{
>> +	int i;
>> +
>> +	printf(" Usage: %s --cgroup <cgroup_path>\n", argv[0]);
>> +	printf(" options:\n");
>> +	for (i = 0; long_options[i].name != 0; i++) {
>> +		printf(" --%-12s", long_options[i].name);
>> +		if (long_options[i].flag != NULL)
>> +			printf(" flag (internal value:%d)\n",
>> +				*long_options[i].flag);
>> +		else
>> +			printf(" -%c\n", long_options[i].val);
>> +	}
>> +	printf("\n");
>> +}
>> +
> 
> I love that you are using --long-options :-)

Yep, saw it being used in xdp_rxq_info_user.c

> 
> Acked-by: Jesper Dangaard Brouer <brouer@...hat.com>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ