[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";
>   bpf_program "or host";
>   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 or

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

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.


More information about the dsc mailing list