Skip to content

Commit

Permalink
Advertise ipv6 link local address (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
sumukhatv authored and abdosi committed Feb 12, 2021
1 parent 9b0680c commit 603ac53
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/neighbor_advertiser
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import argparse
import json
import os
import requests
import subprocess
import sys
import time
import traceback
Expand Down Expand Up @@ -233,6 +234,21 @@ def get_vlan_addresses(vlan_interface):
ipv4_addr, ipv4_prefix = get_vlan_addr_prefix(vlan_interface, 4)
ipv6_addr, ipv6_prefix = get_vlan_addr_prefix(vlan_interface, 6)

if len(ipv6_addr):
try:
out = subprocess.check_output(['ip', '-6', 'addr', 'show', vlan_interface])
out = out.decode('UTF-8')
for line in out.splitlines():
keys = line.split()
if keys[0] == 'inet6':
ip = IPNetwork(keys[1])
if str(ip.ip).startswith("fe80") and str(ip.ip) not in ipv6_addr:
# Link local ipv6 address
ipv6_addr.append(str(ip.ip))
ipv6_prefix.append('128')
except Exception:
log.log_error('failed to get %s addresses from o.s.' % vlan_interface)

metadata = config_db.get_table('DEVICE_METADATA')
mac_addr = metadata['localhost']['mac']
if not mac_addr:
Expand Down

0 comments on commit 603ac53

Please sign in to comment.