Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.core
Commits
25461994
Commit
25461994
authored
Apr 01, 2021
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format: give IPv4 to tap interface only if tap_gateway_interface option is present
parent
a14a847e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
23 deletions
+22
-23
slapos/format.py
slapos/format.py
+22
-23
No files found.
slapos/format.py
View file @
25461994
...
@@ -572,19 +572,12 @@ class Computer(object):
...
@@ -572,19 +572,12 @@ class Computer(object):
if
use_unique_local_address_block
:
if
use_unique_local_address_block
:
self
.
_addUniqueLocalAddressIpv6
(
self
.
ipv6_interface
or
self
.
interface
.
name
)
self
.
_addUniqueLocalAddressIpv6
(
self
.
ipv6_interface
or
self
.
interface
.
name
)
if
create_tap
:
if
create_tap
and
self
.
tap_gateway_interface
:
if
self
.
tap_gateway_interface
:
gateway_addr_dict
=
getIfaceAddressIPv4
(
self
.
tap_gateway_interface
)
gateway_addr_dict
=
getIfaceAddressIPv4
(
self
.
tap_gateway_interface
)
tap_address_list
=
getIPv4SubnetAddressRange
(
gateway_addr_dict
[
'addr'
],
tap_address_list
=
getIPv4SubnetAddressRange
(
gateway_addr_dict
[
'addr'
],
gateway_addr_dict
[
'netmask'
],
gateway_addr_dict
[
'netmask'
],
len
(
self
.
partition_list
))
len
(
self
.
partition_list
))
assert
(
len
(
self
.
partition_list
)
<=
len
(
tap_address_list
))
assert
(
len
(
self
.
partition_list
)
<=
len
(
tap_address_list
))
else
:
gateway_addr_dict
=
{
'peer'
:
'10.0.0.1'
,
'netmask'
:
'255.255.0.0'
,
'addr'
:
'10.0.0.1'
,
'network'
:
'10.0.0.0'
}
tap_address_list
=
getIPv4SubnetAddressRange
(
gateway_addr_dict
[
'addr'
],
gateway_addr_dict
[
'netmask'
],
len
(
self
.
partition_list
))
self
.
_speedHackAddAllOldIpsToInterface
()
self
.
_speedHackAddAllOldIpsToInterface
()
...
@@ -609,6 +602,7 @@ class Computer(object):
...
@@ -609,6 +602,7 @@ class Computer(object):
if
create_tap
:
if
create_tap
:
partition
.
tap
.
createWithOwner
(
owner
)
partition
.
tap
.
createWithOwner
(
owner
)
if
self
.
tap_gateway_interface
:
# add addresses and create route for this tap
# add addresses and create route for this tap
# Pop IP from tap_address_list and attach to tap if has no ipv4 yet
# Pop IP from tap_address_list and attach to tap if has no ipv4 yet
next_ipv4_addr
=
'%s'
%
tap_address_list
.
pop
(
0
)
next_ipv4_addr
=
'%s'
%
tap_address_list
.
pop
(
0
)
...
@@ -619,6 +613,11 @@ class Computer(object):
...
@@ -619,6 +613,11 @@ class Computer(object):
partition
.
tap
.
ipv4_netmask
=
gateway_addr_dict
[
'netmask'
]
partition
.
tap
.
ipv4_netmask
=
gateway_addr_dict
[
'netmask'
]
partition
.
tap
.
ipv4_gateway
=
gateway_addr_dict
[
'addr'
]
partition
.
tap
.
ipv4_gateway
=
gateway_addr_dict
[
'addr'
]
partition
.
tap
.
ipv4_network
=
gateway_addr_dict
[
'network'
]
partition
.
tap
.
ipv4_network
=
gateway_addr_dict
[
'network'
]
else
:
partition
.
tap
.
ipv4_addr
=
''
partition
.
tap
.
ipv4_netmask
=
''
partition
.
tap
.
ipv4_gateway
=
''
partition
.
tap
.
ipv4_network
=
''
if
self
.
tap_ipv6
:
if
self
.
tap_ipv6
:
if
not
partition
.
tap
.
ipv6_addr
:
if
not
partition
.
tap
.
ipv6_addr
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment