4 ms·
For complex setups you sooner or later have to dynamically add/remove rules, based on values only known at runtime (such as an IP address obtained by DHCP). The
by ambrop7 13y ago
For complex setups you sooner or later have to dynamically add/remove rules, based on values only known at runtime (such as an IP address obtained by DHCP). Then, a simple list of rules doesn't suffice, and some kind of programming is needed.
To solve such problems elegantly I designed my "NCD programming language" (link: https://code.google.com/p/badvpn/wiki/NCD https://code.google.com/p/badvpn/wiki/NCD ). The language has built-in backtracking, so in the case of iptables, the language itself makes sure any iptables rule that was added is also removed when that is necessary, in a manner not unlike exception handling in C++ etc. Link to iptables module: https://code.google.com/p/badvpn/source/browse/trunk/ncd/modules/net_iptables.c https://code.google.com/p/badvpn/source/browse/trunk/ncd/mod...
- mmastrac 13y agoThis looks pretty cool. Does it run the script(s) in kernel space or user space?
- ambrop7 13y agoThe interpreter is a userspace program. You can run if from a terminal if you wish and use it as a general purpose scripting language (though it's not quite that useful in that regard, yet). Oh, and it also runs in the browser ;) http://badvpn.googlecode.com/svn/wiki/emncd.html http://badvpn.googlecode.com/svn/wiki/emncd.html