File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change @@ -758,6 +758,12 @@ write_ip_rule(NetplanIPRule* r, GString* s)
758
758
g_string_append_printf (s , "FirewallMark=%d\n" , r -> fwmark );
759
759
if (r -> tos != NETPLAN_IP_RULE_TOS_UNSPEC )
760
760
g_string_append_printf (s , "TypeOfService=%d\n" , r -> tos );
761
+ if (r -> type )
762
+ g_string_append_printf (s , "Type=%s\n" , r -> type );
763
+ if (r -> iif )
764
+ g_string_append_printf (s , "IncomingInterface=%s\n" , r -> iif );
765
+ if (r -> oif )
766
+ g_string_append_printf (s , "OutgoingInterface=%s\n" , r -> oif );
761
767
}
762
768
763
769
STATIC void
Original file line number Diff line number Diff line change @@ -654,6 +654,75 @@ def test_ip_rule_tos(self):
654
654
[RoutingPolicyRule]
655
655
To=10.10.10.0/24
656
656
TypeOfService=250
657
+ ''' })
658
+
659
+ def test_ip_rule_type (self ):
660
+ self .generate ('''network:
661
+ version: 2
662
+ ethernets:
663
+ engreen:
664
+ addresses: ["192.168.14.2/24"]
665
+ routing-policy:
666
+ - to: 10.10.10.0/24
667
+ type: blackhole
668
+ ''' )
669
+
670
+ self .assert_networkd ({'engreen.network' : '''[Match]
671
+ Name=engreen
672
+
673
+ [Network]
674
+ LinkLocalAddressing=ipv6
675
+ Address=192.168.14.2/24
676
+
677
+ [RoutingPolicyRule]
678
+ To=10.10.10.0/24
679
+ Type=blackhole
680
+ ''' })
681
+
682
+ def test_ip_rule_iif (self ):
683
+ self .generate ('''network:
684
+ version: 2
685
+ ethernets:
686
+ engreen:
687
+ addresses: ["192.168.14.2/24"]
688
+ routing-policy:
689
+ - to: 10.10.10.0/24
690
+ iif: engreen
691
+ ''' )
692
+
693
+ self .assert_networkd ({'engreen.network' : '''[Match]
694
+ Name=engreen
695
+
696
+ [Network]
697
+ LinkLocalAddressing=ipv6
698
+ Address=192.168.14.2/24
699
+
700
+ [RoutingPolicyRule]
701
+ To=10.10.10.0/24
702
+ IncomingInterface=engreen
703
+ ''' })
704
+
705
+ def test_ip_rule_oif (self ):
706
+ self .generate ('''network:
707
+ version: 2
708
+ ethernets:
709
+ engreen:
710
+ addresses: ["192.168.14.2/24"]
711
+ routing-policy:
712
+ - to: 10.10.10.0/24
713
+ oif: engreen
714
+ ''' )
715
+
716
+ self .assert_networkd ({'engreen.network' : '''[Match]
717
+ Name=engreen
718
+
719
+ [Network]
720
+ LinkLocalAddressing=ipv6
721
+ Address=192.168.14.2/24
722
+
723
+ [RoutingPolicyRule]
724
+ To=10.10.10.0/24
725
+ OutgoingInterface=engreen
657
726
''' })
658
727
659
728
def test_use_routes (self ):
You can’t perform that action at this time.
0 commit comments