Unverified Commit 55638086 authored by Peter V. Saveliev's avatar Peter V. Saveliev Committed by GitHub
Browse files

rtnl: merge pull request #603 from cscarpitta/master

Fix seg6 and seg6local.End.DT4
parents 9468f219 02fa3ac7
......@@ -138,6 +138,15 @@ Some examples::
'mode': 'inline',
'segs': ['2000::5', '2000::6']})
# create SEG6 tunnel with ip4ip6 encapsulation
# Kernel >= 4.14
ip.route('add',
dst='172.16.0.0/24',
oif=idx,
encap={'type': 'seg6',
'mode': 'encap',
'segs': '2000::5,2000::6'})
# release Netlink socket
ip.close()
......
......@@ -1546,6 +1546,15 @@ class RTNL_API(object):
'segs':'2000::5,2000::6,2000::7,2000::8',
'hmac':0xf})
Create SEG6 tunnel with ip4ip6 encapsulation (kernel >= 4.14)::
ip.route('add',
dst='172.16.0.0/24',
oif=idx,
encap={'type': 'seg6',
'mode': 'encap',
'segs': '2000::5,2000::6'})
Create SEG6LOCAL tunnel End.DX4 action (kernel >= 4.14)::
ip.route('add',
......
......@@ -256,6 +256,9 @@ class IPRouteRequest(IPRequest):
elif action == 'End.DT6':
# Retrieve table
table = header['table']
elif action == 'End.DT4':
# Retrieve table
table = header['table']
elif action == 'End.B6':
# Parse segs
segs = header['srh']['segs']
......
......@@ -214,8 +214,8 @@ class rtmsg_base(nlflags):
def encode(self):
# Retrieve the family
family = self.get_family()
# Seg6 can be applied only to IPv6
if family == AF_INET6:
# Seg6 can be applied only to IPv6 and IPv4
if family == AF_INET6 or family == AF_INET:
# Get mode
mode = self['mode']
# Get segs
......@@ -255,7 +255,7 @@ class rtmsg_base(nlflags):
# Iterate over segments
for seg in segs:
# Convert to network byte order and add to value
self['segs'] += inet_pton(family, seg)
self['segs'] += inet_pton(AF_INET6, seg)
# Initialize tlvs
self['tlvs'] = b''
# If hmac is used we have to properly init tlvs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment