@@ -200,9 +200,36 @@ impl NetworkAgentActor {
200200 /// NAT/NAT66 policy as well. That is a larger design decision than this
201201 /// hook should make on its own. Until odorobo has an intentional IPv6
202202 /// guest-networking story, we keep host-only NAT scoped to IPv4.
203+ ///
204+ // todo: IPv6, refer to libvirt's impl:
205+ // ```nft
206+ // table ip6 libvirt_network {
207+ // chain forward {
208+ // type filter hook forward priority filter; policy accept;
209+ // counter packets 0 bytes 0 jump guest_cross
210+ // counter packets 0 bytes 0 jump guest_input
211+ // counter packets 0 bytes 0 jump guest_output
212+ // }
213+
214+ // chain guest_output {
215+ // }
216+
217+ // chain guest_input {
218+ // }
219+
220+ // chain guest_cross {
221+ // }
222+
223+ // chain guest_nat {
224+ // type nat hook postrouting priority srcnat; policy accept;
225+ // }
226+ // }
227+ // ```
228+
229+
203230 fn ensure_nat_rules ( _bridge : & str , _subnet : & str , upstream_iface : & str ) -> Result < ( ) , Report > {
204231 const TABLE_NAME : & str = "odorobo" ;
205- const CHAIN_NAME : & str = "postrouting " ;
232+ const CHAIN_NAME : & str = "guest_nat " ;
206233
207234 let table_exists = Self :: nft_table_exists ( TABLE_NAME ) ?;
208235 let chain_exists = if table_exists {
@@ -219,7 +246,7 @@ impl NetworkAgentActor {
219246
220247 let table = Table :: new ( c"odorobo" , ProtoFamily :: Ipv4 ) ;
221248
222- let mut postrouting_chain = nftnl:: Chain :: new ( c"postrouting " , & table) ;
249+ let mut postrouting_chain = nftnl:: Chain :: new ( c"guest_nat " , & table) ;
223250 postrouting_chain. set_type ( nftnl:: ChainType :: Nat ) ;
224251 postrouting_chain. set_hook ( Hook :: PostRouting , 100 ) ;
225252
0 commit comments