Skip to content

Commit 0a54895

Browse files
authored
use jail's fib for gateway detection (#105)
fix #104
1 parent fbb0003 commit 0a54895

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

iocage_lib/ioc_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,14 +1094,14 @@ def parse_package_name(pkg):
10941094
}
10951095

10961096

1097-
def get_host_gateways():
1097+
def get_host_gateways(fib=0):
10981098
gateways = {'ipv4': {'gateway': None, 'interface': None},
10991099
'ipv6': {'gateway': None, 'interface': None}}
11001100
af_mapping = {
11011101
'Internet': 'ipv4',
11021102
'Internet6': 'ipv6'
11031103
}
1104-
output = checkoutput(['netstat', '-r', '-n', '--libxo', 'json'])
1104+
output = checkoutput(['setfib', f'{fib}', 'netstat', '-r', '-n', '--libxo', 'json'])
11051105
route_families = (json.loads(output)
11061106
['statistics']
11071107
['route-information']

iocage_lib/ioc_start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def __start_jail__(self):
180180
localhost_ip = self.conf['localhost_ip']
181181
self.defaultrouter = self.conf['defaultrouter']
182182
self.defaultrouter6 = self.conf['defaultrouter6']
183-
self.host_gateways = iocage_lib.ioc_common.get_host_gateways()
183+
self.host_gateways = iocage_lib.ioc_common.get_host_gateways(self.exec_fib)
184184

185185
fstab_list = []
186186
with open(

0 commit comments

Comments
 (0)