jol wrote
firewalling with iptables works on layer 3 and will not work as I am using bridge mode (layer 2). firewalling with ebtables might work,
Yes, ebtables is the right tool for this.
jol wrote
but a) requires recompiling the kernel of OpenWRT (the platform I am using) which personally looked more complicated to me than patching OpenVPN,
I'm sorry to be harsh, but I have no sympathy for this. Reinventing a wheel inside openvpn when you do have tools on the outside which is explicitly made for this job is the wrong path. The next thing is that someone wants to block MSN via the tunnel, and proposes a similar patch to yours, and then the next guy wants to block port 39482 for some reason ... this is the wrong path.
It's a while since I used the stock OpenWRT image (I compile my own nowadays), but I was pretty sure ebtables was available via opkg.
jol wrote
b) will cause a permanent performance hit for all traffic in all networks bridged (which in my case includes wlan, ethternet, and tap), not just the traffic passing the bridge, and there just a small fraction.
Well, the OpenVPN source code is there for you, feel free to patch it yourself.
jol wrote
As with respect to bloating the code base - OpenVPN already contains a lot of support for handling DHCP configuration for routed scenarios - adding code to filter DHCP in a bridge scenario is in my opinion featurewise complimentary - except that it is in a method executed all the time instead of connection establishment only.
To some degree, OpenVPN implements some DHCP filtering in one very specific setting. It filters
only the DHCP ROUTE message. Why? If you use bridging together with --route-gateway, it will otherwise break the client's Internet connection, as the client will change the default gateway to a host which is not reachable outside the tunnel. That is the only reason that filter is there. What you are asking for is to tell OpenVPN to block normally legitimate traffic over the tunnel, which is the task of a firewall. And your "fix" blocks all UDP port 67/68 traffic - no matter what the contents is.
If you insist on doing it in OpenVPN, then at least have a closer look at the existing PF implementation and propose a patch which extends it to support configurable protocol (tcp/udp/icmp/igmp) and port numbers. The current implementation only supports filtering based on IP addresses. Then you can use the energy on something which is way more usable for more users than your corner case.
jol wrote
If you prefer, adding an ebtables like mechanism or documenting how the packet filter can be used to accomplish the same is also fine, but for the very specific usecase looks over engineered to me.
LOL ... I really hope you're not serious now. ebtables is designed for doing layer 2 filtering. That's a tool which is available practically right under your nose. Writing a patch which hard-codes DHCP traffic filtering on packet level in OpenVPN, compiling and testing it yourself is not over-engineering? .... I mean, come on ...
However, the packet filter is pretty well documented here:
http://backreference.org/2010/06/18/openvpns-built-in-packet-filter/
That's also written by a guy who has contributed to the OpenVPN source code already.
Anyway, the meeting minutes will be posted in a few days to the openvpn-devel list. You can see the dialogue there regarding this issue. This patch is a NAK anyway, so this is a dead-end as it is now.