def lisp_itr_process_nonce_ipc(ipc): x, opcode, rloc_str, nonce = ipc.split("%") nonce = int(nonce, 16) echo_nonce = lisp.lisp_get_echo_nonce(None, rloc_str) if (echo_nonce == None): echo_nonce = lisp.lisp_echo_nonce(rloc_str) # # If we are in request-nonce mode, exit it, so we can echo the nonce the # other side is requesting. # if (opcode == "R"): echo_nonce.request_nonce_rcvd = nonce echo_nonce.last_request_nonce_rcvd = lisp.lisp_get_timestamp() echo_nonce.echo_nonce_sent = nonce echo_nonce.last_new_echo_nonce_sent = lisp.lisp_get_timestamp() lisp.lprint("Start echo-nonce mode for {}, nonce 0x{}".format( \ lisp.red(echo_nonce.rloc_str, False), lisp.lisp_hex_string(nonce))) #endif if (opcode == "E"): echo_nonce.echo_nonce_rcvd = nonce echo_nonce.last_echo_nonce_rcvd = lisp.lisp_get_timestamp() if (echo_nonce.request_nonce_sent == nonce): en = lisp.bold("echoed nonce", False) lisp.lprint("Received {} {} from {}".format(en, lisp.lisp_hex_string(nonce), lisp.red(echo_nonce.rloc_str, False))) echo_nonce.request_nonce_sent = None lisp.lprint("Stop request-nonce mode for {}".format( \ lisp.red(echo_nonce.rloc_str, False))) echo_nonce.last_good_echo_nonce_rcvd = lisp.lisp_get_timestamp() else: rns = "none" if (echo_nonce.request_nonce_sent): rns = lisp.lisp_hex_string(echo_nonce.request_nonce_sent) #endif lisp.lprint(("Received echo-nonce 0x{} from {}, but request-" + \ "nonce is {}").format(lisp.lisp_hex_string(nonce), lisp.red(echo_nonce.rloc_str, False), rns)) #endif #endif return
def oOOo0(ref, output): if 54 - 54: O0 - IiII % OOooOOo OOoO = lisp.lisp_print_elapsed(ref.uptime) iII = lisp.lisp_print_future(ref.expires) ii1ii11IIIiiI = ref.print_eid_tuple() if 67 - 67: I11i * oO0o * I1ii11iIi11i + OOooOOo / i1IIi I1I111 = "configured" if (ref.referral_source.not_set( )) else ref.referral_source.print_address_no_iid() if 82 - 82: i11iIiiIii - iII111i * OoooooooOO / I11i if 31 - 31: IiII.OoO0O00 - iIii1I11I1II1 ooOOO00Ooo = "--" if (ref.eid.is_ultimate_root()): IiIIIi1iIi = "root" elif (I1I111 == "configured"): IiIIIi1iIi = "any" else: IiIIIi1iIi = ref.print_referral_type() if (ref.is_referral_negative()): IiIIIi1iIi = lisp.red(IiIIIi1iIi, True) if 68 - 68: i11iIiiIii % I1ii11iIi11i + i11iIiiIii ooOOO00Ooo = "{}<br>{}".format(iII, str(ref.referral_ttl / 60)) if 31 - 31: II111iiii.I1IiiI if 1 - 1: Oo0Ooo / o0oOOo0O0Ooo % iII111i * IiII.i11iIiiIii if (len(ref.referral_set) == 0): output += lispconfig.lisp_table_row(ii1ii11IIIiiI, OOoO, ooOOO00Ooo, IiIIIi1iIi, I1I111, "--", "--", "--") if 2 - 2: I1ii11iIi11i * I11i - iIii1I11I1II1 + I1IiiI.oO0o % iII111i if 92 - 92: iII111i for O0OOO0OOoO0O in list(ref.referral_set.values()): IIiIiiIi = O0OOO0OOoO0O.referral_address.print_address_no_iid() IIiIiiIi += "<br>up" if O0OOO0OOoO0O.updown else "<br>down" if 51 - 51: I11i + iII111i % iIii1I11I1II1 / oO0o / OOooOOo % OoooooooOO output += lispconfig.lisp_table_row( ii1ii11IIIiiI, OOoO, ooOOO00Ooo, IiIIIi1iIi, I1I111, IIiIiiIi, str(O0OOO0OOoO0O.priority) + "<br>" + str(O0OOO0OOoO0O.weight), str(O0OOO0OOoO0O.map_requests_sent) + "<br>" + str(O0OOO0OOoO0O.no_responses)) if 78 - 78: Ii1I % I1Ii111 + I1ii11iIi11i if (ii1ii11IIIiiI != ""): ii1ii11IIIiiI = "" OOoO = "" ooOOO00Ooo = "" I1I111 = "" IiIIIi1iIi = "" if 64 - 64: oO0o * O0.I1IiiI + II111iiii if 6 - 6: OoOoOO00 / iII111i.IiII.IiII return ([True, output]) if 62 - 62: I1ii11iIi11i + IiII % iII111i + OOooOOo if 33 - 33: O0.IiII.I1IiiI if 72 - 72: i1IIi / OoO0O00 + OoooooooOO - Oo0Ooo if 29 - 29: I1ii11iIi11i + oO0o % O0 if 10 - 10: I11i / I1Ii111 - I1IiiI * iIii1I11I1II1 - I1IiiI if 97 - 97: I1ii11iIi11i + I1IiiI * Ii1I + OOooOOo % iII111i if 74 - 74: oO0o - Oo0Ooo + OoooooooOO + I1Ii111 / OoOoOO00 if 23 - 23: O0
def lisp_fix_rloc_encap_state_entry(mc, parms): lisp_sockets, rloc, port, hostname = parms addr = "{}:{}".format(rloc.print_address_no_iid(), port) eid = lisp.green(mc.print_eid_tuple(), False) msg = "Changed '{}' translated address:port to {} for EID {}, {} {}". \ format(hostname, lisp.red(addr, False), eid, "{}", "{}") for rloc_entry in mc.rloc_set: if (rloc_entry.rle): for rle_node in rloc_entry.rle.rle_nodes: if (rle_node.rloc_name != hostname): continue rle_node.store_translated_rloc(rloc, port) old_addr = rle_node.address.print_address_no_iid() + ":" + \ str(rle_node.translated_port) lisp.lprint(msg.format("RLE", old_addr)) #endfor #endif if (rloc_entry.rloc_name != hostname): continue # # Update lisp-crypto encap array. Put keys in new dictionary array # location since translated address and port changed. We don't want # to rekey because of a NAT change. # old_addr = rloc_entry.rloc.print_address_no_iid() + ":" + \ str(rloc_entry.translated_port) if (lisp.lisp_crypto_keys_by_rloc_encap.has_key(old_addr)): keys = lisp.lisp_crypto_keys_by_rloc_encap[old_addr] lisp.lisp_crypto_keys_by_rloc_encap[addr] = keys #endif # # Update translated information with new information. # rloc_entry.delete_from_rloc_probe_list(mc.eid, mc.group) rloc_entry.store_translated_rloc(rloc, port) rloc_entry.add_to_rloc_probe_list(mc.eid, mc.group) lisp.lprint(msg.format("RLOC", old_addr)) # # Trigger RLOC-probe if enabled. # if (lisp.lisp_rloc_probing): seid = None if (mc.group.is_null()) else mc.eid deid = mc.eid if (mc.group.is_null()) else mc.group lisp.lisp_send_map_request(lisp_sockets, 0, seid, deid, rloc_entry) #endif #endfor # # Write change to external data-plane. # lisp.lisp_write_ipc_map_cache(True, mc) return(True, parms)
def iiii(ref, output): if 1 - 1: Oo0Ooo / o0oOOo0O0Ooo % iII111i * IiII.i11iIiiIii III1Iiii1I11 = lisp.lisp_print_elapsed(ref.uptime) IIII = lisp.lisp_print_future(ref.expires) iiIiI = ref.print_eid_tuple() if 91 - 91: iII111i % i1IIi % iIii1I11I1II1 IIi1I11I1II = "configured" if (ref.referral_source.not_set( )) else ref.referral_source.print_address_no_iid() if 63 - 63: OoooooooOO - OoO0O00.II111iiii / o0oOOo0O0Ooo.OoOoOO00 / O0 if 84 - 84: IiII OOO00O0O = "--" if (ref.eid.is_ultimate_root()): iii = "root" elif (IIi1I11I1II == "configured"): iii = "any" else: iii = ref.print_referral_type() if (ref.is_referral_negative()): iii = lisp.red(iii, True) if 90 - 90: o0oOOo0O0Ooo % i1IIi / OoO0O00 OOO00O0O = "{}<br>{}".format(IIII, str(ref.referral_ttl / 60)) if 44 - 44: Oo0Ooo.OoO0O00 / I1ii11iIi11i + Ii1I if 65 - 65: O0 if (len(ref.referral_set) == 0): output += lispconfig.lisp_table_row(iiIiI, III1Iiii1I11, OOO00O0O, iii, IIi1I11I1II, "--", "--", "--") if 68 - 68: OOooOOo % I1Ii111 if 88 - 88: iIii1I11I1II1 - ooOoO0o + OOooOOo for O0O0OoOO0 in ref.referral_set.values(): IiI111111IIII = O0O0OoOO0.referral_address.print_address_no_iid() IiI111111IIII += "<br>up" if O0O0OoOO0.updown else "<br>down" if 37 - 37: I1Ii111 / OoOoOO00 output += lispconfig.lisp_table_row( iiIiI, III1Iiii1I11, OOO00O0O, iii, IIi1I11I1II, IiI111111IIII, str(O0O0OoOO0.priority) + "<br>" + str(O0O0OoOO0.weight), str(O0O0OoOO0.map_requests_sent) + "<br>" + str(O0O0OoOO0.no_responses)) if 23 - 23: O0 if (iiIiI != ""): iiIiI = "" III1Iiii1I11 = "" OOO00O0O = "" IIi1I11I1II = "" iii = "" if 85 - 85: Ii1I if 84 - 84: I1IiiI.iIii1I11I1II1 % OoooooooOO + Ii1I % OoooooooOO % OoO0O00 return ([True, output]) if 42 - 42: OoO0O00 / I11i / o0oOOo0O0Ooo + iII111i / OoOoOO00 if 84 - 84: ooOoO0o * II111iiii + Oo0Ooo if 53 - 53: iII111i % II111iiii.IiII - iIii1I11I1II1 - IiII * II111iiii if 77 - 77: iIii1I11I1II1 * OoO0O00 if 95 - 95: I1IiiI + i11iIiiIii if 6 - 6: ooOoO0o / i11iIiiIii + iII111i * oO0o if 80 - 80: II111iiii if 83 - 83: I11i.i11iIiiIii + II111iiii.o0oOOo0O0Ooo * I11i
def lisp_display_referral_cache(ref, output): uts = lisp.lisp_print_elapsed(ref.uptime) ets = lisp.lisp_print_future(ref.expires) prefix = ref.print_eid_tuple() ref_source = "configured" if (ref.referral_source.not_set()) else \ ref.referral_source.print_address_no_iid() time_str = "--" if (ref.eid.is_ultimate_root()): ref_type = "root" elif (ref_source == "configured"): ref_type = "any" else: ref_type = ref.print_referral_type() if (ref.is_referral_negative()): ref_type = lisp.red(ref_type, True) #endif time_str = "{}<br>{}".format(ets, str(ref.referral_ttl / 60)) #endif if (len(ref.referral_set) == 0): output += lispconfig.lisp_table_row(prefix, uts, time_str, ref_type, ref_source, "--", "--", "--") #endif for ref_node in ref.referral_set.values(): addr = ref_node.referral_address.print_address_no_iid() addr += "<br>up" if ref_node.updown else "<br>down" output += lispconfig.lisp_table_row( prefix, uts, time_str, ref_type, ref_source, addr, str(ref_node.priority) + "<br>" + str(ref_node.weight), str(ref_node.map_requests_sent) + "<br>" + str(ref_node.no_responses)) if (prefix != ""): prefix = "" uts = "" time_str = "" ref_source = "" ref_type = "" #endif #endfor return ([True, output])
def lisp_display_site_eid_entry(site_eid, site, first, output): eid_str = site_eid.print_eid_tuple() eid_str = eid_str.replace("no-address/0", "") # # Create URL format for all of (*,G), (S,G), and an EID-prefix. # eid = site_eid.eid group = site_eid.group if (eid.is_null() and group.is_null() == False): url = "{}-*-{}".format(group.instance_id, group.print_prefix_url()) eid_str = "<a href='/lisp/show/site/{}'>{}</a>".format(url, eid_str) #endif if (eid.is_null() == False and group.is_null()): url = "{}".format(eid.print_prefix_url()) # # Distinguished-Name EIDs have "'"s in them. # if (url.find("'") != -1): url = url.replace("'", "name-", 1) url = url.replace("'", "") else: # # E.164 EIDs have "+"s in them. # url = url.replace("+", "plus-") #endif eid_str = "<a href='/lisp/show/site/{}'>{}</a>".format(url, eid_str) #endif if (eid.is_null() == False and group.is_null() == False): url = "{}-{}".format(eid.print_prefix_url(), group.print_prefix_url()) eid_str = "<a href='/lisp/show/site/{}'>{}</a>".format(url, eid_str) #endif site_name = site.site_name if first else "" flags = "--" if (site_eid.registered): flags = site_eid.print_flags(True) registerer = "--" if (site_eid.last_registerer.afi != lisp.LISP_AFI_NONE): registerer = site_eid.last_registerer.print_address() #endif registered = lisp.green("yes", True) if site_eid.registered else \ lisp.red("no", True) if (site.shutdown): registered = lisp.red("admin-shutdown", True) if (site_eid.dynamic): registered += " (dynamic)" elif (site_eid.accept_more_specifics): registered = "(ams)" #endif lts = lisp.lisp_print_elapsed(site_eid.last_registered) if (time.time() - site_eid.last_registered >= (site_eid.register_ttl / 2) and lts != "never"): lts = lisp.red(lts, True) #endif fts = lisp.lisp_print_elapsed(site_eid.first_registered) if (site_eid.accept_more_specifics): num = len(site_eid.more_specific_registrations) hover = "{} EID-prefixes registered".format(num) eid_str = lisp.lisp_span(eid_str, hover) #endif output += lispconfig.lisp_table_row(site_name, eid_str, registered, registerer, lts, fts, flags) return (output)
def lisp_ms_show_site_lookup(input_str): eid, eid_exact, group, group_exact = \ lispconfig.lisp_get_lookup_string(input_str) output = "<br>" # # Do lookup in site-cache first. # site_eid = lisp.lisp_site_eid_lookup(eid, group, eid_exact) if (site_eid and site_eid.is_star_g() == False): eid_str = site_eid.print_eid_tuple() registered = lisp.green("registered", True) if site_eid.registered \ else lisp.red("not registered", True) output += "{} '{}' {} {} {} {} {} {}".format( \ lisp.lisp_print_sans("Site"), lisp.lisp_print_cour(site_eid.site.site_name), lisp.lisp_print_sans("entry"), lisp.lisp_print_cour(eid_str), lisp.lisp_print_sans("found for EID"), lisp.lisp_print_cour(input_str), lisp.lisp_print_sans("site EID is"), lisp.lisp_print_cour(registered)) return (output + "<br>") #endif # # Compute negative prefixes. # neg_prefix, gneg_prefix, action = \ lisp.lisp_ms_compute_neg_prefix(eid, group) if (group.is_null()): neg_prefix = lisp.lisp_print_cour(neg_prefix.print_prefix()) else: gneg_prefix = lisp.lisp_print_cour(gneg_prefix.print_prefix()) neg_prefix = lisp.lisp_print_cour(neg_prefix.print_prefix()) neg_prefix = "(" + neg_prefix + ", " + gneg_prefix + ")" #endif if (action == lisp.LISP_DDT_ACTION_NOT_AUTH): banner = "Site entry not found for non-authoritative EID" output += "{} {} {} {}".format( lisp.lisp_print_sans(banner), lisp.lisp_print_cour(input_str), lisp.lisp_print_sans("<br><br>Computed negative-prefix"), neg_prefix) #endif # # Try to find a auth-prefix in the DDT-cache. # if (action == lisp.LISP_DDT_ACTION_DELEGATION_HOLE): ddt_entry = lisp.lisp_ddt_cache_lookup(eid, group, False) if (ddt_entry == None or ddt_entry.is_auth_prefix() == False): banner = "Could not find Authoritative-prefix entry for" output += "{} {} {} {}".format( lisp.lisp_print_sans(banner), lisp.lisp_print_cour(input_str), lisp.lisp_print_sans("<br><br>Computed negative-prefix"), neg_prefix) else: eid_str = ddt_entry.print_eid_tuple() output += "{} {} {} {} {} {}".format( \ lisp.lisp_print_sans("Authoritative-prefix entry"), lisp.lisp_print_cour(eid_str), lisp.lisp_print_sans("found for EID"), lisp.lisp_print_cour(input_str), lisp.lisp_print_sans("<br><br>Computed negative-prefix"), neg_prefix) #endif #endif return (output + "<br>")
def lisp_ms_show_site_detail_command(eid_key, group_key): eid = lisp.lisp_address(lisp.LISP_AFI_NONE, "", 0, 0) if (eid_key): if (eid_key == "[0]/0"): eid.store_iid_range(0, 0) else: eid.store_prefix(eid_key) #endif #endif group = lisp.lisp_address(lisp.LISP_AFI_NONE, "", 0, 0) if (group_key): group.store_prefix(group_key) eid_str = lisp.lisp_print_eid_tuple(eid, group) eid_str = lisp.lisp_print_cour(eid_str) # # Do longest match lookup. We do this so prefix slashes are not in URLs. # site_eid = lisp.lisp_site_eid_lookup(eid, group, True) if (site_eid == None): output = "Could not find EID {} in site cache".format(eid_str) return (output) #endif indent4 = lisp.space(4) indent8 = lisp.space(8) indent12 = lisp.space(12) yesno = lisp.green("yes", True) if site_eid.registered else \ lisp.red("no", True) output = '<font face="Sans-Serif">' sn = lisp.lisp_print_cour(site_eid.site.site_name) si = lisp.lisp_print_cour(str(site_eid.site_id)) xi = "0" if site_eid.xtr_id == 0 else lisp.lisp_hex_string(site_eid.xtr_id) xi = lisp.lisp_print_cour("0x" + xi) fr = lisp.lisp_print_elapsed(site_eid.first_registered) lr = lisp.lisp_print_elapsed(site_eid.last_registered) if (time.time() - site_eid.last_registered >= (site_eid.register_ttl / 2) and lr != "never"): lr = lisp.red(lr, True) #endif if (site_eid.last_registerer.afi == lisp.LISP_AFI_NONE): reger = "none" else: reger = site_eid.last_registerer.print_address() #endif reger = lisp.lisp_print_cour(reger) shutdown = ", " + lisp.lisp_print_cour("site is in admin-shutdown") if \ site_eid.site.shutdown else "" ams = ", accepting more specifics" if site_eid.accept_more_specifics \ else "" if (ams == "" and site_eid.dynamic): ams = ", dynamic" output += '''Site name: {}, EID-prefix: {}, registered: {}{}{} <br>'''.format(sn, eid_str, yesno, ams, shutdown) output += "{}Description: {}<br>".format( indent4, lisp.lisp_print_cour(site_eid.site.description)) output += "{}Last registerer: {}, xTR-ID: {}, site-ID: {}<br>".format( \ indent4, reger, xi, si) flags = site_eid.print_flags(False) flags = lisp.lisp_print_cour(flags) auth_type = "none" if (site_eid.registered): auth_type = "sha1" if (site_eid.auth_sha1_or_sha2) else "sha2" #endif output += ("{}First registered: {}, last registered: {}, auth-type: " + \ "{}, registration flags: {}<br>").format(indent4, lisp.lisp_print_cour(fr), lisp.lisp_print_cour(lr), lisp.lisp_print_cour(auth_type), flags) ttl = lisp.lisp_print_cour(str(site_eid.register_ttl) + " seconds") output += "{}{} registration timeout TTL: {}<br>".format( \ indent4, "Registered" if site_eid.use_register_ttl_requested else \ "Default", ttl) # # First print a policy line, if one is configured for this site-eid. # if (site_eid.policy): p = lisp.lisp_print_cour(site_eid.policy) output += "{}Apply policy: '{}'<br>".format(indent4, p) #endif # # Show proxy-reply settings. # yesno = "yes" if site_eid.force_proxy_reply else "no" yesno = lisp.lisp_print_cour(yesno) output += "{}Forcing proxy Map-Reply: {}<br>".format(indent4, yesno) if (site_eid.force_ttl != None): ttl = lisp.lisp_print_cour(str(site_eid.force_ttl) + " seconds") output += "{}Forced proxy Map-Reply TTL: {}<br>".format( \ indent4, ttl) #endif yesno = "yes" if site_eid.force_nat_proxy_reply else "no" yesno = lisp.lisp_print_cour(yesno) output += "{}Forcing proxy Map-Reply for xTRs behind NATs: {}<br>". \ format(indent4, yesno) yesno = "yes" if site_eid.pitr_proxy_reply_drop else "no" yesno = lisp.lisp_print_cour(yesno) output += "{}Send drop-action proxy Map-Reply to PITR: {}<br>".format( \ indent4, yesno) action = "not configured" if site_eid.proxy_reply_action == "" else \ site_eid.proxy_reply_action action = lisp.lisp_print_cour(action) output += "{}Proxy Map-Reply action: {}<br>".format(indent4, action) if (site_eid.force_proxy_reply and site_eid.echo_nonce_capable): yes = lisp.lisp_print_cour("yes") output += "{}RLOCs are echo-nonce capable: {}<br>".format(indent4, yes) #endif yesno = "yes" if site_eid.require_signature else "no" yesno = lisp.lisp_print_cour(yesno) output += "{}Require signatures: {}<br>".format(indent4, yesno) # # Print configured allowed RLOC-sets, if any. # any_rloc = "any" if len(site_eid.site.allowed_rlocs) == 0 else "" if (any_rloc != ""): any_rloc = lisp.lisp_print_cour(any_rloc) output += "{}Allowed RLOC-set: {}<br>".format(indent4, any_rloc) if (any_rloc == ""): for rloc in site_eid.site.allowed_rlocs.values(): a = lisp.lisp_print_cour(rloc.rloc.print_address()) s = lisp.lisp_print_cour(rloc.print_state()) up = lisp.lisp_print_cour(str(rloc.priority)) uw = lisp.lisp_print_cour(str(rloc.weight)) mp = lisp.lisp_print_cour(str(rloc.mpriority)) mw = lisp.lisp_print_cour(str(rloc.mweight)) rn = rloc.print_rloc_name(True) if (rn != ""): rn = ", " + rn output += '''{}{}, state: {}, up/uw/mp/mw: {}/{}/{}/{}{}<br>'''. \ format(indent8, a, s, up, uw, mp, mw, rn) #endfor #endif none = "none" if len(site_eid.registered_rlocs) == 0 else "" if (none != ""): none = lisp.lisp_print_cour(none) output += "<br>Registered RLOC-set ({}): {}<br>".format("merge-semantics" \ if (site_eid.merge_register_requested) else "replacement-semantics", none) if (none == ""): for rloc in site_eid.registered_rlocs: a = lisp.lisp_print_cour(rloc.rloc.print_address()) s = lisp.lisp_print_cour(rloc.print_state()) up = lisp.lisp_print_cour(str(rloc.priority)) uw = lisp.lisp_print_cour(str(rloc.weight)) mp = lisp.lisp_print_cour(str(rloc.mpriority)) mw = lisp.lisp_print_cour(str(rloc.mweight)) rn = rloc.print_rloc_name(True) if (rn != ""): rn = ", " + rn output += '''{}{}, state: {}, up/uw/mp/mw: {}/{}/{}/{}{}<br>'''.\ format(indent4, a, s, up, uw, mp, mw, rn) if (rloc.geo): geo = lisp.lisp_print_cour(rloc.geo.print_geo_url()) output += "{}geo: {}<br>".format(indent12, geo) #endif if (rloc.elp): elp = lisp.lisp_print_cour(rloc.elp.print_elp(False)) output += "{}elp: {}<br>".format(indent12, elp) #endif if (rloc.rle): rle = lisp.lisp_print_cour(rloc.rle.print_rle(True)) output += "{}rle: {}<br>".format(indent12, rle) #endif if (rloc.json): json = lisp.lisp_print_cour(rloc.json.print_json(True)) output += "{}json: {}<br>".format(indent12, json) #endif #endfor #endif none = "none" if len(site_eid.individual_registrations) == 0 else "" if (none == "none"): none = lisp.lisp_print_cour(none) elif (site_eid.inconsistent_registration): none = lisp.red("inconsistent registrations", True) none = lisp.lisp_print_cour(none) #endif output += "<br>Individual registrations: {}<br>".format(none) for site_eid in site_eid.individual_registrations.values(): yesno = lisp.green("yes", True) if site_eid.registered else \ lisp.red("no", True) auth_type = "sha1" if (site_eid.auth_sha1_or_sha2) else "sha2" auth_type = lisp.lisp_print_cour(auth_type) flags = site_eid.print_flags(False) flags = lisp.lisp_print_cour(flags) a = lisp.lisp_print_cour(site_eid.last_registerer.print_address()) fr = lisp.lisp_print_elapsed(site_eid.first_registered) fr = lisp.lisp_print_cour(fr) lr = lisp.lisp_print_elapsed(site_eid.last_registered) if (time.time() - site_eid.last_registered >= (site_eid.register_ttl / 2) and lr != "never"): lr = lisp.red(lr, True) #endif lr = lisp.lisp_print_cour(lr) si = lisp.lisp_print_cour(str(site_eid.site_id)) xi = lisp.lisp_print_cour(lisp.lisp_hex_string(site_eid.xtr_id)) output += ''' {}Registerer: {}, xTR-ID: 0x{}, site-id: {}, registered: {}<br> {}First registered: {}, last registered: {}, auth-type: {}, registration flags: {}<br> '''.format(indent4, a, xi, si, yesno, indent4, fr, lr, auth_type, flags) none = "none" if len(site_eid.registered_rlocs) == 0 else "" none = lisp.lisp_print_cour(none) output += "{}Registered RLOC-set: {}<br>".format(indent4, none) for rloc in site_eid.registered_rlocs: a = lisp.lisp_print_cour(rloc.rloc.print_address()) s = lisp.lisp_print_cour(rloc.print_state()) up = lisp.lisp_print_cour(str(rloc.priority)) uw = lisp.lisp_print_cour(str(rloc.weight)) mp = lisp.lisp_print_cour(str(rloc.mpriority)) mw = lisp.lisp_print_cour(str(rloc.mweight)) rn = rloc.print_rloc_name(True) if (rn != ""): rn = ", " + rn output += '''{}{}, state: {}, up/uw/mp/mw: {}/{}/{}/{}{}<br>'''.\ format(indent8, a, s, up, uw, mp, mw, rn) if (rloc.geo): geo = lisp.lisp_print_cour(rloc.geo.print_geo_url()) output += "{}geo: {}<br>".format(indent12, geo) #endif if (rloc.elp): elp = lisp.lisp_print_cour(rloc.elp.print_elp(False)) output += "{}elp: {}<br>".format(indent12, elp) #endif if (rloc.rle): rle = lisp.lisp_print_cour(rloc.rle.print_rle(True)) output += "{}rle: {}<br>".format(indent12, rle) #endif if (rloc.json): json = lisp.lisp_print_cour(rloc.json.print_json(True)) output += "{}json: {}<br>".format(indent12, json) #endif #endfor output += "<br>" #endif output += "</font>" return (output)
def II1i1IiiIIi11(mc, parms): iI1Ii11iII1, Oo0O0O0ooO0O, IIIIii, O0o0 = parms if 71 - 71: OOooOOo + ooOoO0o % i11iIiiIii + I1ii11iIi11i - IiII oO0OOoO0 = "{}:{}".format(Oo0O0O0ooO0O.print_address_no_iid(), IIIIii) I111Ii111 = lisp.green(mc.print_eid_tuple(), False) i111IiI1I = "Changed '{}' translated address:port to {} for EID {}, {} {}".format( O0o0, lisp.red(oO0OOoO0, False), I111Ii111, "{}", "{}") if 70 - 70: Ii1I.Oo0Ooo / o0oOOo0O0Ooo.Ii1I - O0 / IiII if 62 - 62: iIii1I11I1II1 * OoOoOO00 for i1 in mc.rloc_set: if (i1.rle): for OOO in i1.rle.rle_nodes: if (OOO.rloc_name != O0o0): continue OOO.store_translated_rloc(Oo0O0O0ooO0O, IIIIii) Oo0oOOo = OOO.address.print_address_no_iid() + ":" + str( OOO.translated_port) if 58 - 58: II111iiii * OOooOOo * I1ii11iIi11i / OOooOOo lisp.lprint(i111IiI1I.format("RLE", Oo0oOOo)) if 75 - 75: oO0o if 50 - 50: Ii1I / Oo0Ooo - oO0o - I11i % iII111i - oO0o if 91 - 91: OoO0O00 / I11i - II111iiii.I11i if (i1.rloc_name != O0o0): continue if 18 - 18: o0oOOo0O0Ooo if 98 - 98: iII111i * iII111i / iII111i + I11i if 34 - 34: ooOoO0o if 15 - 15: I11i * ooOoO0o * Oo0Ooo % i11iIiiIii % OoOoOO00 - OOooOOo if 68 - 68: I1Ii111 % i1IIi.IiII.I1ii11iIi11i if 92 - 92: iII111i.I1Ii111 Oo0oOOo = i1.rloc.print_address_no_iid() + ":" + str( i1.translated_port) if 31 - 31: I1Ii111.OoOoOO00 / O0 if (lisp.lisp_crypto_keys_by_rloc_encap.has_key(Oo0oOOo)): o000O0o = lisp.lisp_crypto_keys_by_rloc_encap[Oo0oOOo] lisp.lisp_crypto_keys_by_rloc_encap[oO0OOoO0] = o000O0o if 42 - 42: OoOoOO00 if 41 - 41: Oo0Ooo.ooOoO0o + O0 * o0oOOo0O0Ooo % Oo0Ooo * Oo0Ooo if 19 - 19: iII111i if 46 - 46: I1ii11iIi11i - Ii1I.iIii1I11I1II1 / I1ii11iIi11i if 7 - 7: i1IIi / I1IiiI * I1Ii111.IiII.iIii1I11I1II1 i1.delete_from_rloc_probe_list(mc.eid, mc.group) i1.store_translated_rloc(Oo0O0O0ooO0O, IIIIii) i1.add_to_rloc_probe_list(mc.eid, mc.group) lisp.lprint(i111IiI1I.format("RLOC", Oo0oOOo)) if 13 - 13: OOooOOo / i11iIiiIii if 2 - 2: I1IiiI / O0 / o0oOOo0O0Ooo % OoOoOO00 % Ii1I if 52 - 52: o0oOOo0O0Ooo if 95 - 95: Ii1I if (lisp.lisp_rloc_probing): O0oOO0O = None if (mc.group.is_null()) else mc.eid oO = mc.eid if (mc.group.is_null()) else mc.group lisp.lisp_send_map_request(iI1Ii11iII1, 0, O0oOO0O, oO, i1) if 7 - 7: o0oOOo0O0Ooo - I1IiiI if 100 - 100: oO0o + I11i.OOooOOo * Ii1I if 73 - 73: i1IIi + I1IiiI if 46 - 46: OoO0O00.Oo0Ooo - OoooooooOO if 93 - 93: iII111i if 10 - 10: I11i lisp.lisp_write_ipc_map_cache(True, mc) return (True, parms) if 82 - 82: I1ii11iIi11i - iIii1I11I1II1 / OOooOOo + Ii1I if 87 - 87: oO0o * I1ii11iIi11i + OOooOOo / iIii1I11I1II1 / iII111i if 37 - 37: iII111i - ooOoO0o * oO0o % i11iIiiIii - I1Ii111 if 83 - 83: I11i / I1IiiI if 34 - 34: IiII if 57 - 57: oO0o.I11i.i1IIi if 42 - 42: I11i + I1ii11iIi11i % O0