[dsc] Allow multiple bpf_program and append content

Anand Buddhdev anandb at ripe.net
Mon Jan 16 17:48:45 UTC 2017


On 16/01/2017 13:41, Jerry Lundström wrote:

Hi Jerry,

> Related to #108, suggestion is to allow for multiple bpf_program and
> append content to previous including one space as delimiter.
> 
>   bpf_program "udp port 53";
>   bpf_program "and (";
>   bpf_program "host 192.168.0.1";
>   bpf_program "or host 192.168.0.2";
>   bpf_program ")";

I don't like this idea at all. Let me explain my thinking.

The DSC parser expects options to be terminated by a semi-colon.
Therefore we already have an end-of-option marker, so the parser would
do better to accept this syntax:

bpf_program "udp port 53 and
(
host 192.0.2.1 or
host 192.0.2.2
)";

If an operator wishes, they may indent the additional lines. The extra
spaces make no difference to the bpf compiler. But I don't like the
syntax of repeating the option name on every following line. I already
have to do this for "local_address" and I don't like it. I would have
preferred "local_address" to take a list of some kind, terminated by a
semi-colon.

In practice, most folk will have simple bpf expressions that fit on a
single line. In our config at the RIPE NCC, we have some longer bpf
expressions, but our dsc config files are generated by templates, and
not meant for human consumption. The longer lines are therefore irrelevant.

I'm not a fan of introducing extra syntax parsing rules to please
humans. It adds code complexity and bugs for no gain.

Regards,
Anand


More information about the dsc mailing list