ayourtch / nat46

OpenWRT feed with stateless NAT46 kernel module
37 stars 28 forks source link

nat46-netdev: Add support for removing a rule #9

Closed srsmiraato closed 4 years ago

srsmiraato commented 4 years ago

Added support to remove a rule from the rule of a device

ayourtch commented 4 years ago

The API is done the way is done as a deliberate design decision:

Suppose I have three rules, A, B, C, in order.

One must either be able insert and delete any route at any point or none at all (and recreate the entire rule set).

I went with the simple solution that is still fully consistent.

I am a strong believer in that the best code is the one that is not there.

One can argue the deletion of a nat64 instance causes a different flow - but that can be solved by temporarily blackholing traffic.

During the simple playing/testing, I found just copy pasting the entire sequence works very well.

So - what kind of scenario do you have in mind with this change ?

srsmiraato commented 4 years ago

In our system, we have a scenario where the translation rule between the v4 and v6 addresses changes (e.g. v4 changed but v6 remains the same, or vice versa) and we need to replace the old rule with the new one. We also have a scenario where the translation rule becomes stale and needs to be removed to keep the list of translation rules clean and short.

Currently, we needed to recreate the nat46 interface every time a translation rule needs to be removed. This is causing network and performance issues in our system. Blackholing traffic, even temporarily, will cause downtime in our system. Inserting the new translation rule every time, instead of replacing the old one, will increase the list of translation rules over time and that will eventually affect performance.

Having the remove option means our system can remove a translation rule while keeping the nat46 interface active. This mitigates the network and performance issues the system is having every time the interface is being recreated.

You feedback is highly appreciated. Thanks.