Re: [PATCH v3 net-next 4/4] bpftool: implement cgroup bpf operations

From: David Ahern
Date: Sat Dec 09 2017 - 11:28:33 EST


On 12/8/17 4:46 PM, Jakub Kicinski wrote:
>> + argc -= 2;
>> + argv = &argv[2];
>> + prog_fd = prog_parse_fd(&argc, &argv);
>> + if (prog_fd < 0)
>> + goto exit_cgroup;
>> +
>> + for (i = 0; i < argc; i++) {
>> + if (strcmp(argv[i], "allow_multi") == 0) {
>> + attach_flags |= BPF_F_ALLOW_MULTI;
>> + } else if (strcmp(argv[i], "allow_override") == 0) {
>> + attach_flags |= BPF_F_ALLOW_OVERRIDE;
>
> I don't feel about this strongly but as I said I was trying to follow
> iproute2's conventions, and it allows aliasing. So if you type "ip a"
> it will give you the first thing that starts with a, not necessarily
> alphabetically, more likely in order of usefulness or order in which
> things were added. IOW if "allow_" selects "allow_mutli" that's what I
> would actually expect it to do..
>
> Maybe others disagree?

The iproute2 syntax is very user friendly, and I agree with following
the conventions.

With respect to the attach flags, allow_yyyyy is a lot to type, but
having 'a .. allow_' mean one flag over the other is going to be
confusing. Perhaps dropping the 'allow_' prefix in favor of just 'multi'
and 'override' and doing prefix match on it? User commands do not need
to follow flag names precisely.