def o00oo0(): global i1I1ii1II1iII global oooO0oo0oOOOO if 38 - 38: ooOoO0o % II111iiii % I11i / OoO0O00 + OoOoOO00 / i1IIi lisp.lisp_i_am("ddt") lisp.lisp_set_exception() lisp.lisp_print_banner("DDT-Node starting up") if 54 - 54: iIii1I11I1II1 % I1ii11iIi11i - OOooOOo / oO0o - OoO0O00.I11i if 11 - 11: I1ii11iIi11i.OoO0O00 * IiII * OoooooooOO + ooOoO0o if 33 - 33: O0 * o0oOOo0O0Ooo - I1Ii111 % I1Ii111 if 18 - 18: I1Ii111 / Oo0Ooo * I1Ii111 + I1Ii111 * i11iIiiIii * I1ii11iIi11i if (lisp.lisp_get_local_addresses() == False): return (False) if 11 - 11: ooOoO0o / OoOoOO00 - IiII * OoooooooOO + OoooooooOO.OoOoOO00 if 26 - 26: Ii1I % I1ii11iIi11i if 76 - 76: IiII * iII111i if 52 - 52: OOooOOo oooO0oo0oOOOO = lisp.lisp_open_listen_socket("", "lisp-ddt") i1I1ii1II1iII[0] = lisp.lisp_open_send_socket("", lisp.LISP_AFI_IPV4) i1I1ii1II1iII[1] = lisp.lisp_open_send_socket("", lisp.LISP_AFI_IPV6) i1I1ii1II1iII[2] = oooO0oo0oOOOO return if 19 - 19: I1IiiI if 25 - 25: Ii1I / ooOoO0o if 31 - 31: OOooOOo.O0 % I1IiiI.o0oOOo0O0Ooo + IiII if 71 - 71: I1Ii111.II111iiii if 62 - 62: OoooooooOO.I11i if 61 - 61: OoOoOO00 - OOooOOo - i1IIi if 25 - 25: O0 * I11i + I1ii11iIi11i.o0oOOo0O0Ooo.o0oOOo0O0Ooo
def I11i1II(): lisp.lisp_set_exception() Ooo = [] if 21 - 21: Oo0Ooo I1ii1 = lisp.lisp_referral_cache Ooo = I1ii1.walk_cache(iIIII, Ooo) if 99 - 99: ooOoO0o.I1Ii111 % IiII * IiII.i1IIi if 72 - 72: OOooOOo % I1ii11iIi11i + OoO0O00 / oO0o + IiII if 10 - 10: I1Ii111 / ooOoO0o + i11iIiiIii / Ii1I if 74 - 74: OOooOOo + O0 + i1IIi - i1IIi + II111iiii if 83 - 83: I1ii11iIi11i - I1IiiI + OOooOOo for OoooooOoo in Ooo: OoooooOoo.delete_cache() if 5 - 5: Ii1I if 46 - 46: IiII if 45 - 45: ooOoO0o if 21 - 21: oO0o.I1Ii111.OOooOOo / Oo0Ooo / I1Ii111 o00 = threading.Timer(lisp.LISP_REFERRAL_TIMEOUT_CHECK_INTERVAL, I11i1II, []) o00.start() return if 17 - 17: OOooOOo / OOooOOo / I11i if 1 - 1: i1IIi.i11iIiiIii % OOooOOo if 82 - 82: iIii1I11I1II1 + Oo0Ooo.iIii1I11I1II1 % IiII / Ii1I.Ii1I if 14 - 14: o0oOOo0O0Ooo.OOooOOo.I11i + OoooooooOO - OOooOOo + IiII if 9 - 9: Ii1I if 59 - 59: I1IiiI * II111iiii.O0 if 56 - 56: Ii1I - iII111i % I1IiiI - o0oOOo0O0Ooo if 51 - 51: O0 / ooOoO0o * iIii1I11I1II1 + I1ii11iIi11i + o0oOOo0O0Ooo
def O00o00O(): lisp.lisp_set_exception() if 3 - 3: OOooOOo if 20 - 20: II111iiii.iII111i / II111iiii % i11iIiiIii % iII111i if 11 - 11: IiII % I1ii11iIi11i % Ii1I / II111iiii % I1Ii111 - Oo0Ooo if 96 - 96: I1ii11iIi11i / II111iiii.Ii1I - iII111i * I11i * oO0o for o000O0o in lisp.lisp_crypto_keys_by_nonce.values(): for O00oo0ooO in o000O0o: del (O00oo0ooO) if 38 - 38: iIii1I11I1II1 - II111iiii - I1IiiI lisp.lisp_crypto_keys_by_nonce = {} if 71 - 71: OoooooooOO if 33 - 33: I1Ii111 if 62 - 62: I1ii11iIi11i + Ii1I + i1IIi / OoooooooOO if 7 - 7: o0oOOo0O0Ooo + i1IIi.I1IiiI / Oo0Ooo lisp.lisp_timeout_map_cache(lisp.lisp_map_cache) if 22 - 22: ooOoO0o - ooOoO0o % OOooOOo.I1Ii111 + oO0o if 63 - 63: I1IiiI % I1Ii111 * o0oOOo0O0Ooo + I1Ii111 / Oo0Ooo % iII111i if 45 - 45: IiII if 20 - 20: OoooooooOO * o0oOOo0O0Ooo * O0.OOooOOo Ii1IIii11 = threading.Timer(60, O00o00O, []) Ii1IIii11.start() return if 78 - 78: iIii1I11I1II1 + I11i - Ii1I * I1Ii111 - OoooooooOO % OoOoOO00 if 34 - 34: O0 if 80 - 80: i1IIi - Oo0Ooo / OoO0O00 - i11iIiiIii if 68 - 68: oO0o - I1ii11iIi11i % O0 % I1Ii111 if 11 - 11: O0 / OoO0O00 % OOooOOo + o0oOOo0O0Ooo + iIii1I11I1II1 if 40 - 40: ooOoO0o - OOooOOo.Ii1I * Oo0Ooo % I1Ii111 if 56 - 56: i11iIiiIii.o0oOOo0O0Ooo - I1IiiI * I11i
def lisp_mr_startup(): global lisp_send_sockets global lisp_ipc_listen_socket global lisp_send_internal_socket global lisp_ephem_listen_socket lisp.lisp_i_am("mr") lisp.lisp_set_exception() lisp.lisp_print_banner("Map-Resolver starting up") # # Get local address for source RLOC for encapsulation. # if (lisp.lisp_get_local_addresses() == False): return (False) # # Open send socket. # lisp_send_internal_socket = lisp.lisp_open_send_socket("lisp-mrms", "") lisp_ipc_listen_socket = lisp.lisp_open_listen_socket("", "lisp-mr") address = "0.0.0.0" if lisp.lisp_is_raspbian() else "0::0" lisp_ephem_listen_socket = lisp.lisp_open_listen_socket( address, str(lisp_ephem_port)) lisp_send_sockets[0] = lisp_ephem_listen_socket lisp_send_sockets[1] = lisp_ephem_listen_socket lisp_send_sockets[2] = lisp_ipc_listen_socket # # Start site-cache timeout timer. # lisp_referral_timer = threading.Timer( lisp.LISP_REFERRAL_TIMEOUT_CHECK_INTERVAL, lisp_timeout_referral_cache, []) lisp_referral_timer.start() return (True)
def iIi1Ii1i1iI(): lisp.lisp_set_exception() IIiI1 = [] if 17 - 17: OOooOOo / OOooOOo / I11i ii1 = lisp.lisp_referral_cache IIiI1 = ii1.walk_cache(OOOO0O00o, IIiI1) if 1 - 1: ooOoO0o % iIii1I11I1II1 + Oo0Ooo.iIii1I11I1II1 % I1IiiI if 89 - 89: Ii1I if 76 - 76: ooOoO0o if 15 - 15: OOooOOo.I11i + OoooooooOO - OoO0O00 if 69 - 69: iIii1I11I1II1.I1ii11iIi11i % ooOoO0o + iIii1I11I1II1 / O0 / I1ii11iIi11i for II1i1Ii11Ii11 in IIiI1: II1i1Ii11Ii11.delete_cache() if 61 - 61: OOooOOo % OOooOOo * o0oOOo0O0Ooo / o0oOOo0O0Ooo if 75 - 75: IiII.ooOoO0o if 50 - 50: OoOoOO00 if 60 - 60: ooOoO0o * iIii1I11I1II1 * I1ii11iIi11i * Oo0Ooo iiI1iIiI = threading.Timer(lisp.LISP_REFERRAL_TIMEOUT_CHECK_INTERVAL, iIi1Ii1i1iI, []) iiI1iIiI.start() return if 69 - 69: Ii1I * O0.i11iIiiIii / Ii1I.o0oOOo0O0Ooo if 63 - 63: I11i + o0oOOo0O0Ooo.II111iiii - I1IiiI if 52 - 52: o0oOOo0O0Ooo % Oo0Ooo if 64 - 64: O0 % I11i % O0 * OoO0O00.oO0o + I1IiiI if 75 - 75: I11i.OoooooooOO % o0oOOo0O0Ooo * I11i % OoooooooOO if 13 - 13: IiII / i11iIiiIii % II111iiii % I11i.I1ii11iIi11i if 8 - 8: OoOoOO00 + Oo0Ooo - II111iiii if 11 - 11: i1IIi % i11iIiiIii - i1IIi * OoOoOO00
def OO0oo(): lisp.lisp_set_exception() if 15 - 15: iIii1I11I1II1 % OoooooooOO - Oo0Ooo * Ii1I + I11i if 11 - 11: iII111i * Ii1I - OoOoOO00 if 66 - 66: OoOoOO00.i11iIiiIii - iII111i * o0oOOo0O0Ooo + OoooooooOO * I1ii11iIi11i if 74 - 74: Oo0Ooo for o000O0o in lisp.lisp_crypto_keys_by_nonce.values(): for OO000o00 in o000O0o: del (OO000o00) if 46 - 46: OoO0O00 lisp.lisp_crypto_keys_by_nonce = {} if 71 - 71: I11i / I11i * oO0o * oO0o / II111iiii if 35 - 35: OOooOOo * o0oOOo0O0Ooo * I1IiiI % Oo0Ooo.OoOoOO00 if 58 - 58: I11i + II111iiii * iII111i * i11iIiiIii - iIii1I11I1II1 if 68 - 68: OoooooooOO % II111iiii lisp.lisp_timeout_map_cache(lisp.lisp_map_cache) if 26 - 26: II111iiii % i11iIiiIii % iIii1I11I1II1 % I11i * I11i * I1ii11iIi11i if 24 - 24: II111iiii % I1Ii111 - ooOoO0o + I1IiiI * I1ii11iIi11i if 2 - 2: Ii1I - IiII if 83 - 83: oO0o % o0oOOo0O0Ooo % Ii1I - II111iiii * OOooOOo / OoooooooOO Ii1IIii11 = threading.Timer(60, OO0oo, []) Ii1IIii11.start() return if 18 - 18: OoO0O00 + iIii1I11I1II1 - II111iiii - I1IiiI if 71 - 71: OoooooooOO if 33 - 33: I1Ii111 if 62 - 62: I1ii11iIi11i + Ii1I + i1IIi / OoooooooOO if 7 - 7: o0oOOo0O0Ooo + i1IIi.I1IiiI / Oo0Ooo if 22 - 22: ooOoO0o - ooOoO0o % OOooOOo.I1Ii111 + oO0o if 63 - 63: I1IiiI % I1Ii111 * o0oOOo0O0Ooo + I1Ii111 / Oo0Ooo % iII111i
def lisp_rtr_process_timer(): lisp.lisp_set_exception() # # Remove nonce entries from crypto-list. # for keys in lisp.lisp_crypto_keys_by_nonce.values(): for key in keys: del(key) #endfor lisp.lisp_crypto_keys_by_nonce.clear() lisp.lisp_crypto_keys_by_nonce = {} # # Walk map-cache. # lisp.lisp_timeout_map_cache(lisp.lisp_map_cache) # # Clear the LISP-Trace cache so we can optimize memory usage. There is only # a one-time use for the cahced entries. # lisp.lisp_rtr_nat_trace_cache.clear() lisp.lisp_rtr_nat_trace_cache = {} # # Restart periodic timer. # lisp_periodic_timer = threading.Timer(60, lisp_rtr_process_timer, []) lisp_periodic_timer.start() return
def lisp_rtr_worker_thread(lisp_thread): lisp.lisp_set_exception() while (True): # # Dequeue packet from pcap's enqueue. # packet = lisp_thread.input_queue.get() # # Count input packets and bytes. # lisp_thread.input_stats.increment(len(packet)) # # Use pre-defined packet data structure, store packet buffer in it. # lisp_thread.lisp_packet.packet = packet # # Decap and encap, go, go, go. # lisp_rtr_data_plane(lisp_thread.lisp_packet, lisp_thread.thread_name) #endwhile return
def O00oOo00o0o(lisp_thread): lisp.lisp_set_exception() while (True): if 85 - 85: iII111i + OoooooooOO * iII111i - I1Ii111 % i11iIiiIii if 71 - 71: I1ii11iIi11i - ooOoO0o / OoOoOO00 * OoOoOO00 / i1IIi.i1IIi if 53 - 53: I1Ii111 if 21 - 21: I11i oO0OOOO0 = lisp_thread.input_queue.get() if 92 - 92: i11iIiiIii / I1Ii111 - iII111i % ooOoO0o * I1Ii111 + Oo0Ooo if 11 - 11: OoooooooOO.I1Ii111 if 80 - 80: OoooooooOO - OOooOOo * Ii1I * I1ii11iIi11i / I1IiiI / OOooOOo if 13 - 13: I1Ii111 * ooOoO0o + i11iIiiIii * I1Ii111 - ooOoO0o lisp_thread.input_stats.increment(len(oO0OOOO0)) if 23 - 23: iIii1I11I1II1 * i1IIi % OoooooooOO * IiII if 9 - 9: IiII - II111iiii + O0 / iIii1I11I1II1 / i11iIiiIii if 39 - 39: IiII * Oo0Ooo + iIii1I11I1II1 - IiII + OOooOOo if 69 - 69: O0 lisp_thread.lisp_packet.packet = oO0OOOO0 if 85 - 85: ooOoO0o / O0 if 18 - 18: o0oOOo0O0Ooo % O0 * I1ii11iIi11i if 62 - 62: I1Ii111.IiII.OoooooooOO if 11 - 11: OOooOOo / I11i O0O(lisp_thread.lisp_packet, lisp_thread.thread_name) if 73 - 73: i1IIi / i11iIiiIii return if 58 - 58: Oo0Ooo.II111iiii + oO0o - i11iIiiIii / II111iiii / O0 if 85 - 85: OoOoOO00 + OOooOOo if 10 - 10: IiII / OoO0O00 + OoOoOO00 / i1IIi if 27 - 27: Ii1I if 67 - 67: I1IiiI if 55 - 55: I1ii11iIi11i - iII111i * o0oOOo0O0Ooo + OoOoOO00 * OoOoOO00 * O0 if 91 - 91: I1Ii111 - OOooOOo % iIii1I11I1II1 - OoooooooOO % ooOoO0o if 98 - 98: OoO0O00.OoO0O00 * oO0o * II111iiii * I1Ii111
def lisp_itr_pcap_thread(device, pfilter, pcap_lock): lisp.lisp_set_exception() pcap_lock.acquire() pcap = pcappy.open_live(device, 9000, 0, 100) pcap_lock.release() pcap.filter = pfilter pcap.loop(-1, lisp_itr_pcap_process_packet, device) return
def lisp_itr_timeout_dynamic_eids(lisp_socket): lisp.lisp_set_exception() now = lisp.lisp_get_timestamp() for db in lisp.lisp_db_list: if (db.dynamic_eid_configured() == False): continue delete_list = [] for dyn_eid in db.dynamic_eids.values(): ts = dyn_eid.last_packet if (ts == None): continue if (ts + dyn_eid.timeout > now): continue # # Check hardware if dyn-EID has had packets SENT to. We want the # opposite but this is all we get from Arista. # if (lisp.lisp_program_hardware): prefix = dyn_eid.dynamic_eid.print_prefix_no_iid() if (lisp.lisp_arista_is_alive(prefix)): lisp.lprint(("Hardware indicates dynamic-EID {} " + \ "still active").format(lisp.green(prefix, False))) continue #endif #endif # # Tell ETR process so it can register dynamic-EID. # eid_str = dyn_eid.dynamic_eid.print_address() ipc = "learn%{}%None".format(eid_str) ipc = lisp.lisp_command_ipc(ipc, "lisp-itr") lisp.lisp_ipc(ipc, lisp_socket, "lisp-etr") lisp.lprint("Dynamic-EID {}".format( \ lisp.bold(lisp.green(eid_str, False) + " activity timeout", False))) delete_list.append(eid_str) #endfor # # Remove the timed out entries from db.dynamic_eids{}. # for eid_str in delete_list: db.dynamic_eids.pop(eid_str) #endfor # # Restart periodic timer. # threading.Timer(lisp.LISP_DEFAULT_DYN_EID_TIMEOUT, lisp_itr_timeout_dynamic_eids, [lisp_socket]).start() return
def lisp_timeout_sites(): global lisp_send_sockets lisp.lisp_set_exception() rle_list = [] for site in lisp_sites_by_name.values(): for site_eid in site.allowed_prefixes.values(): if (site_eid.merge_register_requested == False): lisp_timeout_site_eid(site_eid, None) #endif parent = site_eid # # Check if we are merging registrations. If so, look at each child. # Individual registrations are not removed from parent. # rle_list = lisp_timeout_individuals(parent, rle_list) # # Check if this site-eid has more-specific registrations. We need # to check their timers. # delete_list = [] for ms in parent.more_specific_registrations: rle_list = lisp_timeout_individuals(ms, rle_list) delete_list = lisp_timeout_site_eid(ms, delete_list) #endfor for ms in delete_list: parent.more_specific_registrations.remove(ms) ms.delete_cache() #endfor #endfor #endfor # # Send Map-Noitfy to ITRs if any (S,G) RLE has changed. # if (len(rle_list) != 0): lisp.lisp_queue_multicast_map_notify(lisp_send_sockets, rle_list) #endif # # Restart periodic timer. # lisp_site_timer = threading.Timer(lisp.LISP_SITE_TIMEOUT_CHECK_INTERVAL, lisp_timeout_sites, []) lisp_site_timer.start() return
def lisp_timeout_pubsub(): lisp.lisp_set_exception() # # Return quickly if inject mode is not enabled. # lisp_ms_scale_inject() now = lisp.lisp_get_timestamp() delete_list = [] for e in lisp.lisp_pubsub_cache: for pubsub in lisp.lisp_pubsub_cache[e].values(): ttl = pubsub.ttl * 60 if (pubsub.uptime + ttl > now): continue delete_list.append([e, pubsub.xtr_id]) #endfor #endfor # # Remove entries from delete queue. # for e, xtr_id in delete_list: eid = lisp.green(e, False) lisp.lprint("Pubsub state {} for xtr-id 0x{} has {}".format( eid, lisp.lisp_hex_string(xtr_id), lisp.bold("timed out", False))) # # Remove entry from dictionary array. And explictly free memory. # entry = lisp.lisp_pubsub_cache[e][xtr_id] lisp.lisp_pubsub_cache[e].pop(xtr_id) del (entry) # # If not more subscriptions for this EID-prefix, remove EID-prefix # from parent dictionary array. # if (len(lisp.lisp_pubsub_cache[e]) == 0): lisp.lisp_pubsub_cache.pop(e) #endif #endfor # # Restart periodic timer. # lisp_pubsub_timer = threading.Timer( \ lisp.LISP_PUBSUB_TIMEOUT_CHECK_INTERVAL, lisp_timeout_pubsub, []) lisp_pubsub_timer.start() return
def Ii111(lisp_thread): lisp.lisp_set_exception() if (lisp.lisp_myrlocs[0] == None): return if 67 - 67: O0 oOOo000oOoO0 = "lo0" if lisp.lisp_is_macos() else "any" if 52 - 52: II111iiii.ooOoO0o / OoOoOO00 / OoooooooOO.i11iIiiIii I1i1i = pcappy.open_live(oOOo000oOoO0, 9000, 0, 100) if 86 - 86: Oo0Ooo / oO0o + O0 * iII111i iiI11I1i1i1iI = "(dst host " OoOOo000o0 = "" for oO0OOoO0 in lisp.lisp_get_all_addresses(): iiI11I1i1i1iI += "{} or ".format(oO0OOoO0) OoOOo000o0 += "{} or ".format(oO0OOoO0) if 12 - 12: II111iiii.I11i / OOooOOo iiI11I1i1i1iI = iiI11I1i1i1iI[0:-4] iiI11I1i1i1iI += ") and ((udp dst port 4341 or 8472 or 4789) or " iiI11I1i1i1iI += "(proto 17 and (ip[6]&0xe0 == 0x20 or " + "(ip[6]&0xe0 == 0 and ip[7] != 0))))" if 77 - 77: ooOoO0o - I1IiiI % I11i - O0 if 67 - 67: OOooOOo + Oo0Ooo if 84 - 84: O0 * OoooooooOO - IiII * IiII if 8 - 8: ooOoO0o / i1IIi.oO0o if 41 - 41: iII111i + OoO0O00 if 86 - 86: OoOoOO00.iIii1I11I1II1 - OoO0O00 OoOOo000o0 = OoOOo000o0[0:-4] iiI11I1i1i1iI += ( " or (not (src host {}) and " + "((udp src port 4342 and ip[28] == 0x28) or " + "(udp dst port 4342 and ip[28] == 0x12)))").format(OoOOo000o0) if 56 - 56: O0 if 61 - 61: o0oOOo0O0Ooo / OOooOOo / Oo0Ooo * O0 if 23 - 23: oO0o - OOooOOo + I11i lisp.lprint("Capturing packets for: '{}'".format(iiI11I1i1i1iI)) I1i1i.filter = iiI11I1i1i1iI if 12 - 12: I1IiiI / ooOoO0o % o0oOOo0O0Ooo / i11iIiiIii % OoooooooOO if 15 - 15: iIii1I11I1II1 % OoooooooOO - Oo0Ooo * Ii1I + I11i if 11 - 11: iII111i * Ii1I - OoOoOO00 if 66 - 66: OoOoOO00.i11iIiiIii - iII111i * o0oOOo0O0Ooo + OoooooooOO * I1ii11iIi11i I1i1i.loop(-1, Oo, [oOOo000oOoO0, lisp_thread]) return if 74 - 74: Oo0Ooo if 61 - 61: Oo0Ooo - I1Ii111 * II111iiii % ooOoO0o * iIii1I11I1II1 + OoO0O00 if 71 - 71: I11i / I11i * oO0o * oO0o / II111iiii if 35 - 35: OOooOOo * o0oOOo0O0Ooo * I1IiiI % Oo0Ooo.OoOoOO00 if 58 - 58: I11i + II111iiii * iII111i * i11iIiiIii - iIii1I11I1II1 if 68 - 68: OoooooooOO % II111iiii if 26 - 26: II111iiii % i11iIiiIii % iIii1I11I1II1 % I11i * I11i * I1ii11iIi11i
def lisp_rtr_pcap_thread(lisp_thread): lisp.lisp_set_exception() if (lisp.lisp_myrlocs[0] == None): return device = "lo0" if lisp.lisp_is_macos() else "any" pcap = pcappy.open_live(device, 9000, 0, 100) # # If "lisp-nat = yes" is configured, then a PETR is co-located with this # RTR functionality. We need to pcap *all* packets (0.0.0.0/0 and 0::/0). # lisp_nat = commands.getoutput("egrep 'lisp-nat = yes' ./lisp.config") lisp_nat = (lisp_nat != "" and lisp_nat[0] == " ") pfilter = "(dst host " afilter = "" for addr in lisp.lisp_get_all_addresses(): pfilter += "{} or ".format(addr) afilter += "{} or ".format(addr) #endif pfilter = pfilter[0:-4] pfilter += ") and ((udp dst port 4341 or 8472 or 4789) or " pfilter += "(proto 17 and (ip[6]&0xe0 == 0x20 or " + \ "(ip[6]&0xe0 == 0 and ip[7] != 0))))" # # For RLOC-probe messages that come via pcap interface so we have the # IP header to grab the TTL. # afilter = afilter[0:-4] pfilter += (" or (not (src host {}) and " + \ "((udp src port 4342 and ip[28] == 0x28) or " + \ "(udp dst port 4342 and ip[28] == 0x12)))").format(afilter) if (lisp_nat): pfilter += " or (dst net 0.0.0.0/0 and not (host {}))".format(afilter) #endif lisp.lprint("Capturing packets for: '{}'".format(pfilter)) pcap.filter = pfilter # # Enter receive loop. # pcap.loop(-1, lisp_rtr_pcap_process_packet, [device, lisp_thread]) return
def oo0OOo0O(lisp_thread): lisp.lisp_set_exception() if (lisp.lisp_myrlocs[0] == None): return if 39 - 39: OoooooooOO + oO0o % OOooOOo / OOooOOo Ii1ii111i1 = "lo0" if lisp.lisp_is_macos() else "any" if 27 - 27: iII111i.I11i.iIii1I11I1II1.iIii1I11I1II1 iIi1i = pcappy.open_live(Ii1ii111i1, 9000, 0, 100) if 4 - 4: I1Ii111 / i11iIiiIii / OOooOOo OooO0ooo0o = "(dst host " iii1 = "" for oO0OOoO0 in lisp.lisp_get_all_addresses(): OooO0ooo0o += "{} or ".format(oO0OOoO0) iii1 += "{} or ".format(oO0OOoO0) if 32 - 32: Ii1I.IiII.OoooooooOO - OoO0O00 + oO0o OooO0ooo0o = OooO0ooo0o[0:-4] OooO0ooo0o += ") and ((udp dst port 4341 or 8472 or 4789) or " OooO0ooo0o += "(proto 17 and (ip[6]&0xe0 == 0x20 or " + "(ip[6]&0xe0 == 0 and ip[7] != 0))))" if 88 - 88: iII111i if 19 - 19: II111iiii * IiII + Ii1I if 65 - 65: OOooOOo.I1Ii111.OoO0O00.iII111i - OOooOOo if 19 - 19: i11iIiiIii + iII111i % ooOoO0o if 14 - 14: OoO0O00.II111iiii.I11i / Ii1I % I1ii11iIi11i - ooOoO0o if 67 - 67: I11i - OOooOOo.i1IIi iii1 = iii1[0:-4] OooO0ooo0o += (" or (not (src host {}) and " + "((udp src port 4342 and ip[28] == 0x28) or " + "(udp dst port 4342 and ip[28] == 0x12)))").format(iii1) if 35 - 35: iII111i + ooOoO0o - oO0o.iII111i.IiII if 87 - 87: OoOoOO00 if 25 - 25: i1IIi.OoO0O00 - OoOoOO00 / OoO0O00 % OoO0O00 * iIii1I11I1II1 lisp.lprint("Capturing packets for: '{}'".format(OooO0ooo0o)) iIi1i.filter = OooO0ooo0o if 50 - 50: OoO0O00.i11iIiiIii - oO0o.oO0o if 31 - 31: OOooOOo / Oo0Ooo * i1IIi.OoOoOO00 if 57 - 57: OOooOOo + iIii1I11I1II1 % i1IIi % I1IiiI if 83 - 83: o0oOOo0O0Ooo / i11iIiiIii % iIii1I11I1II1.I11i % oO0o.OoooooooOO iIi1i.loop(-1, OoO, [Ii1ii111i1, lisp_thread]) return if 94 - 94: Ii1I + iIii1I11I1II1 % OoO0O00 if 93 - 93: Ii1I - OOooOOo + iIii1I11I1II1 * o0oOOo0O0Ooo + I1Ii111.iII111i if 49 - 49: OoooooooOO * I11i - Oo0Ooo.oO0o if 89 - 89: ooOoO0o + Ii1I * ooOoO0o / ooOoO0o if 46 - 46: OoO0O00 if 71 - 71: I11i / I11i * oO0o * oO0o / II111iiii if 35 - 35: OOooOOo * o0oOOo0O0Ooo * I1IiiI % Oo0Ooo.OoOoOO00
def I1iIII1(lisp_thread): lisp.lisp_set_exception() if (lisp.lisp_myrlocs[0] == None): return if 39 - 39: OoooooooOO OOOOoO000 = "lo0" if lisp.lisp_is_macos() else "any" if 38 - 38: I1IiiI oOo0OoOOo0 = pcappy.open_live(OOOOoO000, 9000, 0, 100) if 30 - 30: I1ii11iIi11i % I1IiiI O0Oo00 = "(dst host " ii1IiIIi1i = "" for oO0OOoO0 in lisp.lisp_get_all_addresses(): O0Oo00 += "{} or ".format(oO0OOoO0) ii1IiIIi1i += "{} or ".format(oO0OOoO0) if 54 - 54: ooOoO0o O0Oo00 = O0Oo00[0:-4] O0Oo00 += ") and ((udp dst port 4341 or 8472 or 4789) or " O0Oo00 += "(proto 17 and (ip[6]&0xe0 == 0x20 or " + "(ip[6]&0xe0 == 0 and ip[7] != 0))))" if 67 - 67: OOooOOo.Oo0Ooo + OoOoOO00 - OoooooooOO if 70 - 70: OOooOOo / II111iiii - iIii1I11I1II1 - iII111i if 11 - 11: iIii1I11I1II1.OoooooooOO.II111iiii / i1IIi - I11i if 30 - 30: OoOoOO00 if 21 - 21: i11iIiiIii / I1Ii111 % OOooOOo * O0.I11i - iIii1I11I1II1 if 26 - 26: II111iiii * OoOoOO00 ii1IiIIi1i = ii1IiIIi1i[0:-4] O0Oo00 += (" or (not (src host {}) and " + "((udp src port 4342 and ip[28] == 0x28) or " + "(udp dst port 4342 and ip[28] == 0x12)))").format(ii1IiIIi1i) if 10 - 10: II111iiii.iII111i if 32 - 32: Ii1I.IiII.OoooooooOO - OoO0O00 + oO0o if 88 - 88: iII111i lisp.lprint("Capturing packets for: '{}'".format(O0Oo00)) oOo0OoOOo0.filter = O0Oo00 if 19 - 19: II111iiii * IiII + Ii1I if 65 - 65: OOooOOo.I1Ii111.OoO0O00.iII111i - OOooOOo if 19 - 19: i11iIiiIii + iII111i % ooOoO0o if 14 - 14: OoO0O00.II111iiii.I11i / Ii1I % I1ii11iIi11i - ooOoO0o oOo0OoOOo0.loop(-1, OO0, [OOOOoO000, lisp_thread]) return if 67 - 67: I11i - OOooOOo.i1IIi if 35 - 35: iII111i + ooOoO0o - oO0o.iII111i.IiII if 87 - 87: OoOoOO00 if 25 - 25: i1IIi.OoO0O00 - OoOoOO00 / OoO0O00 % OoO0O00 * iIii1I11I1II1 if 50 - 50: OoO0O00.i11iIiiIii - oO0o.oO0o if 31 - 31: OOooOOo / Oo0Ooo * i1IIi.OoOoOO00 if 57 - 57: OOooOOo + iIii1I11I1II1 % i1IIi % I1IiiI
def lisp_ddt_startup(): global lisp_send_sockets global lisp_ipc_listen_socket lisp.lisp_i_am("ddt") lisp.lisp_set_exception() lisp.lisp_print_banner("DDT-Node starting up") # # Get local address for source RLOC for encapsulation. # if (lisp.lisp_get_local_addresses() == False): return (False) # # Open send socket and IPC socket. # lisp_ipc_listen_socket = lisp.lisp_open_listen_socket("", "lisp-ddt") lisp_send_sockets[0] = lisp.lisp_open_send_socket("", lisp.LISP_AFI_IPV4) lisp_send_sockets[1] = lisp.lisp_open_send_socket("", lisp.LISP_AFI_IPV6) lisp_send_sockets[2] = lisp_ipc_listen_socket return
def lisp_timeout_referral_cache(): lisp.lisp_set_exception() delete_list = [] c = lisp.lisp_referral_cache delete_list = c.walk_cache(lisp_timeout_referral_cache_walk, delete_list) # # Now remove from lisp_referral_cache all the timed out entries on the # delete_list[]. # for referral in delete_list: referral.delete_cache() # # Restart periodic timer. # lisp_referral_timer = threading.Timer( lisp.LISP_REFERRAL_TIMEOUT_CHECK_INTERVAL, lisp_timeout_referral_cache, []) lisp_referral_timer.start() return
def Oo0OO0000oooo(): global i1I1ii1II1iII global oooO0oo0oOOOO global o0oO0 global O0oO if 7 - 7: oO0o - OoO0O00 - O0 % oO0o - II111iiii lisp.lisp_i_am("mr") lisp.lisp_set_exception() lisp.lisp_print_banner("Map-Resolver starting up") if 31 - 31: iII111i / Oo0Ooo - iII111i - OOooOOo if 7 - 7: iII111i % O0.OoOoOO00 + I1IiiI - I11i if 75 - 75: I11i if 71 - 71: ooOoO0o if (lisp.lisp_get_local_addresses() == False): return (False) if 53 - 53: OoooooooOO % Ii1I.IiII / i11iIiiIii % iII111i if 28 - 28: I11i if 58 - 58: OoOoOO00 if 37 - 37: Oo0Ooo - iIii1I11I1II1 / I1ii11iIi11i o0oO0 = lisp.lisp_open_send_socket("lisp-mrms", "") oooO0oo0oOOOO = lisp.lisp_open_listen_socket("", "lisp-mr") oo0oOOo0 = "0.0.0.0" if lisp.lisp_is_raspbian() else "0::0" O0oO = lisp.lisp_open_listen_socket(oo0oOOo0, str(Oo0oO0ooo)) i1I1ii1II1iII[0] = O0oO i1I1ii1II1iII[1] = O0oO i1I1ii1II1iII[2] = oooO0oo0oOOOO if 86 - 86: I11i * I1IiiI + I11i + II111iiii if 8 - 8: I1Ii111 - iII111i / ooOoO0o if 96 - 96: OoOoOO00 if 29 - 29: I1ii11iIi11i / i1IIi.I1IiiI - OoOoOO00 - OoOoOO00 - Ii1I o00 = threading.Timer(lisp.LISP_REFERRAL_TIMEOUT_CHECK_INTERVAL, I11i1II, []) o00.start() return (True) if 20 - 20: i1IIi % OoO0O00.I1IiiI / IiII * i11iIiiIii * OOooOOo if 85 - 85: o0oOOo0O0Ooo.OoOoOO00 / ooOoO0o.O0 % I1Ii111 if 90 - 90: Oo0Ooo % O0 * iIii1I11I1II1.iII111i if 8 - 8: ooOoO0o + II111iiii / iII111i / I11i if 74 - 74: O0 / i1IIi if 78 - 78: OoooooooOO.OoO0O00 + ooOoO0o - i1IIi if 31 - 31: OoooooooOO.OOooOOo
def i1I11IiI1iiII(): global II1iII1i global oO0oIIII global i111I global Oo0oO0oo0oO00 if 91 - 91: ooOoO0o % ooOoO0o lisp.lisp_i_am("mr") lisp.lisp_set_exception() lisp.lisp_print_banner("Map-Resolver starting up") if 7 - 7: iII111i / I1ii11iIi11i / i11iIiiIii if 21 - 21: oO0o / I1ii11iIi11i + Ii1I + OoooooooOO if 91 - 91: i11iIiiIii / i1IIi + iII111i + ooOoO0o * i11iIiiIii if 66 - 66: iIii1I11I1II1 % i1IIi - O0 + I11i * I1Ii111.IiII if (lisp.lisp_get_local_addresses() == False): return (False) if 52 - 52: ooOoO0o + O0.iII111i.I1ii11iIi11i.OoO0O00 if 97 - 97: I1IiiI / iII111i if 71 - 71: II111iiii / i1IIi.I1ii11iIi11i % OoooooooOO.OoOoOO00 if 41 - 41: i1IIi * II111iiii / OoooooooOO.OOooOOo i111I = lisp.lisp_open_send_socket("lisp-mrms", "") oO0oIIII = lisp.lisp_open_listen_socket("", "lisp-mr") O0iII1 = "0.0.0.0" if lisp.lisp_is_raspbian() else "0::0" Oo0oO0oo0oO00 = lisp.lisp_open_listen_socket(O0iII1, str(OOo)) II1iII1i[0] = Oo0oO0oo0oO00 II1iII1i[1] = Oo0oO0oo0oO00 II1iII1i[2] = oO0oIIII if 27 - 27: OoO0O00.I11i + OoOoOO00 / iIii1I11I1II1 % iII111i.ooOoO0o if 14 - 14: oO0o + I1ii11iIi11i - iII111i / O0.I1Ii111 if 45 - 45: I1Ii111 if 83 - 83: OoOoOO00.OoooooooOO iiI1iIiI = threading.Timer(lisp.LISP_REFERRAL_TIMEOUT_CHECK_INTERVAL, iIi1Ii1i1iI, []) iiI1iIiI.start() return (True) if 58 - 58: i11iIiiIii + OoooooooOO % OoooooooOO / IiII / i11iIiiIii if 62 - 62: OoO0O00 / I1ii11iIi11i if 7 - 7: OoooooooOO.IiII if 53 - 53: Ii1I % Ii1I * o0oOOo0O0Ooo + OoOoOO00 if 92 - 92: OoooooooOO + i1IIi / Ii1I * O0 if 100 - 100: ooOoO0o % iIii1I11I1II1 * II111iiii - iII111i if 92 - 92: ooOoO0o
def IiI1I11iIii(): lisp.lisp_set_exception() if 63 - 63: iII111i * I11i * Ii1I - oO0o - Ii1I if 97 - 97: OOooOOo / OoooooooOO if 18 - 18: OoO0O00 + iIii1I11I1II1 - II111iiii - I1IiiI if 71 - 71: OoooooooOO for o000O0o in lisp.lisp_crypto_keys_by_nonce.values(): for iIIIII1iiiiII in o000O0o: del (iIIIII1iiiiII) if 54 - 54: i1IIi lisp.lisp_crypto_keys_by_nonce.clear() lisp.lisp_crypto_keys_by_nonce = {} if 22 - 22: i1IIi + Ii1I if 54 - 54: ooOoO0o % OOooOOo.I1Ii111 + oO0o - OOooOOo * I1IiiI if 92 - 92: o0oOOo0O0Ooo + I1Ii111 / Oo0Ooo % OoO0O00 % IiII.OoooooooOO if 52 - 52: ooOoO0o / i11iIiiIii - OOooOOo.IiII % iIii1I11I1II1 + o0oOOo0O0Ooo lisp.lisp_timeout_map_cache(lisp.lisp_map_cache) if 71 - 71: oO0o % I11i * OoOoOO00.O0 / Ii1I.I1ii11iIi11i if 58 - 58: Oo0Ooo / oO0o if 44 - 44: OOooOOo if 54 - 54: Ii1I - I11i - I1Ii111.iIii1I11I1II1 if 79 - 79: Ii1I.OoO0O00 lisp.lisp_rtr_nat_trace_cache.clear() lisp.lisp_rtr_nat_trace_cache = {} if 40 - 40: o0oOOo0O0Ooo + Oo0Ooo.o0oOOo0O0Ooo % ooOoO0o if 15 - 15: Ii1I * Oo0Ooo % I1ii11iIi11i * iIii1I11I1II1 - i11iIiiIii if 60 - 60: I1IiiI * I1Ii111 % OoO0O00 + oO0o if 52 - 52: i1IIi Oooo0000 = threading.Timer(60, IiI1I11iIii, []) Oooo0000.start() return if 84 - 84: Ii1I / IiII if 86 - 86: OoOoOO00 * II111iiii - O0.OoOoOO00 % iIii1I11I1II1 / OOooOOo if 11 - 11: I1IiiI * oO0o + I1ii11iIi11i / I1ii11iIi11i if 37 - 37: i11iIiiIii + i1IIi if 23 - 23: iII111i + I11i.OoOoOO00 * I1IiiI + I1ii11iIi11i if 18 - 18: IiII * o0oOOo0O0Ooo.IiII / O0 if 8 - 8: o0oOOo0O0Ooo
def lisp_rtr_process_timer(): lisp.lisp_set_exception() # # Remove nonce entries from crypto-list. # for keys in lisp.lisp_crypto_keys_by_nonce.values(): for key in keys: del(key) #endfor lisp.lisp_crypto_keys_by_nonce = {} # # Walk map-cache. # lisp.lisp_timeout_map_cache(lisp.lisp_map_cache) # # Restart periodic timer. # lisp_periodic_timer = threading.Timer(60, lisp_rtr_process_timer, []) lisp_periodic_timer.start() return
def lisp_itr_process_info_timer(): global lisp_itr_info_timer global lisp_ephem_nat_socket global lisp_send_sockets lisp.lisp_set_exception() # # Build Info-Request messages if we have any private RLOCs in database- # mappings. # sockets = [lisp_ephem_nat_socket, lisp_ephem_nat_socket, lisp_ipc_listen_socket] lisp.lisp_build_info_requests(sockets, None, lisp.LISP_CTRL_PORT) # # Restart periodic timer. # lisp_itr_info_timer.cancel() lisp_itr_info_timer = threading.Timer(lisp.LISP_INFO_INTERVAL, lisp_itr_process_info_timer, []) lisp_itr_info_timer.start() return
def lisp_ms_startup(): global lisp_ipc_listen_socket global lisp_send_sockets global lisp_site_timer, lisp_pubsub_timer lisp.lisp_i_am("ms") lisp.lisp_set_exception() lisp.lisp_print_banner("Map-Server starting up") # # Get local address for source RLOC for encapsulation. # if (lisp.lisp_get_local_addresses() == False): return (False) # # Open send socket. # lisp_ipc_listen_socket = lisp.lisp_open_listen_socket("", "lisp-ms") lisp_send_sockets[0] = lisp.lisp_open_send_socket("", lisp.LISP_AFI_IPV4) lisp_send_sockets[1] = lisp.lisp_open_send_socket("", lisp.LISP_AFI_IPV6) lisp_send_sockets[2] = lisp_ipc_listen_socket # # Start site-cache timeout timer. # lisp_site_timer = threading.Timer(lisp.LISP_SITE_TIMEOUT_CHECK_INTERVAL, lisp_timeout_sites, []) lisp_site_timer.start() # # Start pubsub-cache timeout timer. # timer = lisp.LISP_PUBSUB_TIMEOUT_CHECK_INTERVAL if (lisp_inject_mode_count != 0): timer = 5 lisp_pubsub_timer = threading.Timer(timer, lisp_timeout_pubsub, []) lisp_pubsub_timer.start() return (True)
def lisp_itr_process_timer(lisp_sockets, lisp_ephem_port): lisp.lisp_set_exception() # # Remove nonce entries from crypto-list. # for keys in lisp.lisp_crypto_keys_by_nonce.values(): for key in keys: del (key) #endfor lisp.lisp_crypto_keys_by_nonce = {} # # If doing L2-overlays, get map-cache entry from (0000-0000-0000/0, # ffff-ffff-ffff/48). # if (lisp.lisp_l2_overlay): afi = lisp.LISP_AFI_MAC iid = lisp.lisp_default_iid s = lisp.lisp_address(afi, "0000-0000-0000", 0, iid) s.mask_len = 0 d = lisp.lisp_address(afi, "ffff-ffff-ffff", 48, iid) lisp.lisp_send_map_request(lisp_sockets, lisp_ephem_port, s, d, None) #endif # # Timeout Map-Cache entries. # lisp.lisp_timeout_map_cache(lisp.lisp_map_cache) # # Restart periodic timer. # lisp_periodic_timer = threading.Timer(60, lisp_itr_process_timer, [lisp_sockets, lisp_ephem_port]) lisp_periodic_timer.start() return
def lisp_rtr_pcap_thread(lisp_thread): lisp.lisp_set_exception() if (lisp.lisp_myrlocs[0] == None): return device = "lo0" if lisp.lisp_is_macos() else "any" pcap = pcappy.open_live(device, 9000, 0, 100) pfilter = "(dst host " afilter = "" for addr in lisp.lisp_get_all_addresses(): pfilter += "{} or ".format(addr) afilter += "{} or ".format(addr) #endif pfilter = pfilter[0:-4] pfilter += ") and ((udp dst port 4341 or 8472 or 4789) or " pfilter += "(proto 17 and (ip[6]&0xe0 == 0x20 or " + \ "(ip[6]&0xe0 == 0 and ip[7] != 0))))" # # For RLOC-probe messages that come via pcap interface so we have the # IP header to grab the TTL. # afilter = afilter[0:-4] pfilter += (" or (not (src host {}) and " + \ "((udp src port 4342 and ip[28] == 0x28) or " + \ "(udp dst port 4342 and ip[28] == 0x12)))").format(afilter) lisp.lprint("Capturing packets for: '{}'".format(pfilter)) pcap.filter = pfilter # # Enter receive loop. # pcap.loop(-1, lisp_rtr_pcap_process_packet, [device, lisp_thread]) return
def i1iiIiI1Ii1i(lisp_thread): lisp.lisp_set_exception() while (True): if 22 - 22: IiII / i11iIiiIii if 62 - 62: OoO0O00 / I1ii11iIi11i if 7 - 7: OoooooooOO.IiII if 53 - 53: Ii1I % Ii1I * o0oOOo0O0Ooo + OoOoOO00 oO0OOOO0 = lisp_thread.input_queue.get() if 92 - 92: OoooooooOO + i1IIi / Ii1I * O0 if 100 - 100: ooOoO0o % iIii1I11I1II1 * II111iiii - iII111i if 92 - 92: ooOoO0o if 22 - 22: Oo0Ooo % iII111i * I1ii11iIi11i / OOooOOo % i11iIiiIii * I11i lisp_thread.input_stats.increment(len(oO0OOOO0)) if 95 - 95: OoooooooOO - IiII * I1IiiI + OoOoOO00 if 10 - 10: o0oOOo0O0Ooo / i11iIiiIii if 92 - 92: I11i.I1Ii111 if 85 - 85: I1ii11iIi11i.I1Ii111 lisp_thread.lisp_packet.packet = oO0OOOO0 if 78 - 78: ooOoO0o * I1Ii111 + iIii1I11I1II1 + iIii1I11I1II1 / I1Ii111.Ii1I if 97 - 97: ooOoO0o / I1Ii111 % i1IIi % I1ii11iIi11i if 18 - 18: iIii1I11I1II1 % I11i if 95 - 95: ooOoO0o + i11iIiiIii * I1Ii111 - i1IIi * I1Ii111 - iIii1I11I1II1 O0O(lisp_thread.lisp_packet, lisp_thread.thread_name) if 75 - 75: OoooooooOO * IiII return if 9 - 9: IiII - II111iiii + O0 / iIii1I11I1II1 / i11iIiiIii if 39 - 39: IiII * Oo0Ooo + iIii1I11I1II1 - IiII + OOooOOo if 69 - 69: O0 if 85 - 85: ooOoO0o / O0 if 18 - 18: o0oOOo0O0Ooo % O0 * I1ii11iIi11i if 62 - 62: I1Ii111.IiII.OoooooooOO if 11 - 11: OOooOOo / I11i if 73 - 73: i1IIi / i11iIiiIii
def Iiiiii111i1ii(lisp_thread): lisp.lisp_set_exception() while (True): if 25 - 25: OOooOOo - ooOoO0o / i11iIiiIii if 41 - 41: i1IIi % iII111i + iIii1I11I1II1 if 2 - 2: iIii1I11I1II1 * Oo0Ooo % oO0o - II111iiii - iII111i if 3 - 3: I1Ii111 oO0OOOO0 = lisp_thread.input_queue.get() if 45 - 45: I1Ii111 if 83 - 83: OoOoOO00.OoooooooOO if 58 - 58: i11iIiiIii + OoooooooOO % OoooooooOO / IiII / i11iIiiIii if 62 - 62: OoO0O00 / I1ii11iIi11i lisp_thread.input_stats.increment(len(oO0OOOO0)) if 7 - 7: OoooooooOO.IiII if 53 - 53: Ii1I % Ii1I * o0oOOo0O0Ooo + OoOoOO00 if 92 - 92: OoooooooOO + i1IIi / Ii1I * O0 if 100 - 100: ooOoO0o % iIii1I11I1II1 * II111iiii - iII111i lisp_thread.lisp_packet.packet = oO0OOOO0 if 92 - 92: ooOoO0o if 22 - 22: Oo0Ooo % iII111i * I1ii11iIi11i / OOooOOo % i11iIiiIii * I11i if 95 - 95: OoooooooOO - IiII * I1IiiI + OoOoOO00 if 10 - 10: o0oOOo0O0Ooo / i11iIiiIii O0O(lisp_thread.lisp_packet, lisp_thread.thread_name) if 92 - 92: I11i.I1Ii111 return if 85 - 85: I1ii11iIi11i.I1Ii111 if 78 - 78: ooOoO0o * I1Ii111 + iIii1I11I1II1 + iIii1I11I1II1 / I1Ii111.Ii1I if 97 - 97: ooOoO0o / I1Ii111 % i1IIi % I1ii11iIi11i if 18 - 18: iIii1I11I1II1 % I11i if 95 - 95: ooOoO0o + i11iIiiIii * I1Ii111 - i1IIi * I1Ii111 - iIii1I11I1II1 if 75 - 75: OoooooooOO * IiII if 9 - 9: IiII - II111iiii + O0 / iIii1I11I1II1 / i11iIiiIii if 39 - 39: IiII * Oo0Ooo + iIii1I11I1II1 - IiII + OOooOOo
def lisp_itr_get_capture_info(): global lisp_pcap_lock lisp.lisp_set_exception() # # Wait for database-mapping commands to execute. We need to retrieve # EID-prefixes we need to listen on. # sources, dyn_eids = lisp_itr_get_local_eid_prefixes() # # If "ipc-data-plane = yes" is configured, we do not need to do any # data-plane forwarding. There is another module running with the # lispers.net control-plane that is doing data-plane forwarding. We'll # get punts via the lispers.net-itr named socket. But we do have to # packet capture RLOC-probe replies. Also capture multicast Map-Register # messages for LISP-Decent. # cp_pfilter = None if (lisp.lisp_ipc_data_plane): lisp.lprint(lisp.bold("Data-plane packet capture disabled", False)) cp_pfilter = "(udp src port 4342 and ip[28] == 0x28)" + \ " or (ip[16] >= 224 and ip[16] < 240 and (ip[28] & 0xf0) == 0x30)" lisp.lprint("Control-plane capture: '{}'".format(cp_pfilter)) else: lisp.lprint("Capturing packets for source-EIDs {}".format( \ lisp.green(str(sources), False))) #endif if (lisp.lisp_pitr): lisp.lprint("Configured for PITR functionality") # # We want the kernel to handle any packets with source AND destination # that matches any EID-prefixes for the site. Any other case, we want # the pcap filters to get the packet to this lisp-itr process. # l2_overlay = lisp.lisp_l2_overlay if (l2_overlay == False): if (lisp.lisp_is_linux()): lisp_itr_kernel_filter(sources, dyn_eids) #endif # # Build packet capture filter so we get packets for configured source EID- # prefixes. # if (cp_pfilter == None): if (lisp.lisp_pitr): pfilter = lisp_itr_build_pcap_filter(sources, [], False, True) else: pfilter = lisp_itr_build_pcap_filter(sources, dyn_eids, l2_overlay, False) #endif else: pfilter = cp_pfilter #endif # # User can select which interfaces to pcap on. # interfaces = lisp_get_active_interfaces() pcap_list = os.getenv("LISP_PCAP_LIST") if (pcap_list == None): us = "" rloc_interfaces = [] else: eid_interfaces = list(set(pcap_list.split()) & set(interfaces)) rloc_interfaces = list(set(pcap_list.split()) ^ set(interfaces)) us = "user-selected " lisp.lprint("User pcap-list: {}, active-interfaces: {}".format( \ pcap_list, interfaces)) interfaces = eid_interfaces #endif # # Start a pcap thread so we can receive packets from applications on this # system. But make sure the device is up on A10 devices. If ethernet MAC # capturing, do not listen on non ethernet interfaces. # mac_capturing = (pfilter.find("ether host") != -1) for device in interfaces: if (device in ["lo", "lispers.net"] and mac_capturing): lisp.lprint(("Capturing suppressed on interface {}, " + \ "MAC filters configured").format(device)) continue #endif args = [device, pfilter, lisp_pcap_lock] lisp.lprint("Capturing packets on {}interface {}".format(us, device)) threading.Thread(target=lisp_itr_pcap_thread, args=args).start() #endfor if (cp_pfilter): return # # Start a pcap thread so we can receive RLOC-probe Map-Replies packets on # RLOC interfaces. This is only called when LISP_PCAP_LIST is set. # probe_pfilter = "(udp src port 4342 and ip[28] == 0x28)" for device in rloc_interfaces: args = [device, probe_pfilter, lisp_pcap_lock] lisp.lprint("Capture RLOC-probe replies on RLOC interface {}".format( \ device)) threading.Thread(target=lisp_itr_pcap_thread, args=args).start() #endfor return