summaryrefslogtreecommitdiffstats
path: root/src/vlibapi
AgeCommit message (Expand)AuthorFilesLines
2020-10-06feature: Add packet trace APIJon Loeliger1-0/+29
2020-08-25api: register endian handlers for reply messagesOle Troan1-1/+20
2020-07-16misc: add callback hooks and refactor pmcTom Seidenberg2-1/+21
2020-06-17docs: add more FEATURE.yaml documentationDave Barach1-0/+14
2020-06-15api: check id is valid for bounce checkingBenoît Ganne1-1/+1
2020-05-27api: make vpp api handlers endian independentOle Troan3-1/+43
2020-05-25api: add new stream message conventionOle Troan1-0/+37
2020-05-06docs: clean up make docs jobPaul Vinciguerra1-1/+2
2020-05-04misc: binary api fuzz test fixesDave Barach3-2/+28
2020-04-14vat: fix socket connectionDave Barach1-15/+15
2020-02-26api: add macro that zeros out api reply bufferPaul Vinciguerra1-0/+32
2020-02-26api: improve api string safetyJakub Grajciar2-13/+34
2019-12-17ip: Protocol Independent IP NeighborsNeale Ranns1-13/+4
2019-12-11api: Use vl_msg_push/pop_heapNathan Skrzypczak2-4/+18
2019-12-10api: pass api and client main to rx threadFlorin Coras1-0/+6
2019-12-10api: multiple connections per processDave Barach3-24/+41
2019-12-06api: avoid swapping vlib_rp before barrier syncFlorin Coras2-4/+19
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne1-0/+20
2019-10-08api: add bapi thread handle to api main structure.IJsbrand Wijnands1-0/+3
2019-09-25api: split api generated filesOle Troan1-0/+15
2019-09-16api: autogenerate api trace print/endianOle Troan2-3/+12
2019-08-20api: Cleanup APIs interface.apiJakub Grajciar1-0/+2
2019-08-08api: vppapitrace JSON/API trace converterOle Troan2-4/+36
2019-07-19api: fix coverity warningDave Barach1-3/+8
2019-07-16api: enable binary API event logging in vatDave Barach2-28/+86
2019-07-09vat: unload unused vat pluginsDave Barach1-0/+21
2019-07-02api: fix coverity warningsDave Barach1-7/+7
2019-06-26api: Remove the inlines file and replace with library functionsNeale Ranns3-59/+55
2019-06-18api: string type to convert to vectorOle Troan2-27/+59
2019-06-14api: add mp-safe/barrier-sync indication to elogsDave Barach1-6/+17
2019-06-12infra: fix minor memory leak in "api trace..."Dave Barach1-1/+3
2019-03-25add api trace printezkexma1-1/+16
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan1-3/+1
2019-03-15API: Cleanup APIs interface.apiJakub Grajciar1-1/+3
2019-01-24perfmon plugin: 2-way parallel stat collectionDave Barach1-9/+2
2019-01-14api_helper_macro mp->pid is network endianOle Troan1-1/+1
2018-12-18VAPI/VOM: Removing legacy stats tests, add string type.Ole Troan1-4/+6
2018-12-17String type: Not include \0 in show_versionOle Troan1-0/+6
2018-12-14String type: Fix off by one errorOle Troan1-3/+2
2018-12-13API: Use string type instead of u8.Ole Troan3-0/+56
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-1/+1
2018-10-23c11 safe string handling supportDave Barach3-7/+7
2018-10-22X86_64 perf counter pluginDave Barach1-2/+9
2018-10-02PAPI: Use UNIX domain sockets instead of shared memoryOle Troan1-1/+1
2018-10-01API / CLI event-log tracingDave Barach1-45/+38
2018-09-07cmake: set packaging component for different filesDamjan Marion1-0/+2
2018-08-26cmake: add add_vpp_library and add_vpp_executable macrosDamjan Marion1-1/+5
2018-08-25cmake: add more headers to the install listDamjan Marion1-0/+19
2018-08-03svm: add support for eventfd signaling to queueFlorin Coras1-3/+0
2018-07-09IGMP improvementsNeale Ranns1-2/+2
n class="k">return [ # TCP Ether(src=src_mac, dst=dst_mac) / sa.encrypt( IP(src=src_ip, dst=dst_ip) / TCP(dport=self.tcp_port_out, sport=20) ), # UDP Ether(src=src_mac, dst=dst_mac) / sa.encrypt( IP(src=src_ip, dst=dst_ip) / UDP(dport=self.udp_port_out, sport=20) ), # ICMP Ether(src=src_mac, dst=dst_mac) / sa.encrypt( IP(src=src_ip, dst=dst_ip) / ICMP(id=self.icmp_id_out, type="echo-request") ), ] def verify_capture_plain(self, capture): for packet in capture: try: self.assert_packet_checksums_valid(packet) self.assert_equal( packet[IP].src, self.tun_if.remote_ip4, "decrypted packet source address", ) self.assert_equal( packet[IP].dst, self.pg1.remote_ip4, "decrypted packet destination address", ) if packet.haslayer(TCP): self.assertFalse( packet.haslayer(UDP), "unexpected UDP header in decrypted packet", ) self.assert_equal( packet[TCP].dport, self.tcp_port_in, "decrypted packet TCP destination port", ) elif packet.haslayer(UDP): if packet[UDP].payload: self.assertFalse( packet[UDP][1].haslayer(UDP), "unexpected UDP header in decrypted packet", ) self.assert_equal( packet[UDP].dport, self.udp_port_in, "decrypted packet UDP destination port", ) else: self.assertFalse( packet.haslayer(UDP), "unexpected UDP header in decrypted packet", ) self.assert_equal( packet[ICMP].id, self.icmp_id_in, "decrypted packet ICMP ID" ) except Exception: self.logger.error(ppp("Unexpected or invalid plain packet:", packet)) raise def verify_capture_encrypted(self, capture, sa): for packet in capture: try: copy = packet.__class__(scapy.compat.raw(packet)) del copy[UDP].len copy = packet.__class__(scapy.compat.raw(copy)) self.assert_equal(packet[UDP].len, copy[UDP].len, "UDP header length") self.assert_packet_checksums_valid(packet) self.assertIn(ESP, packet[IP]) decrypt_pkt = sa.decrypt(packet[IP]) self.assert_packet_checksums_valid(decrypt_pkt) self.assert_equal( decrypt_pkt[IP].src, self.pg1.remote_ip4, "encrypted packet source address", ) self.assert_equal( decrypt_pkt[IP].dst, self.tun_if.remote_ip4, "encrypted packet destination address", ) except Exception: self.logger.error( ppp("Unexpected or invalid encrypted packet:", packet) ) raise def config_esp_tun(self, params): addr_type = params.addr_type scapy_tun_sa_id = params.scapy_tun_sa_id scapy_tun_spi = params.scapy_tun_spi vpp_tun_sa_id = params.vpp_tun_sa_id vpp_tun_spi = params.vpp_tun_spi auth_algo_vpp_id = params.auth_algo_vpp_id auth_key = params.auth_key crypt_algo_vpp_id = params.crypt_algo_vpp_id crypt_key = params.crypt_key addr_any = params.addr_any addr_bcast = params.addr_bcast flags = VppEnum.vl_api_ipsec_sad_flags_t.IPSEC_API_SAD_FLAG_UDP_ENCAP e = VppEnum.vl_api_ipsec_spd_action_t VppIpsecSA( self, scapy_tun_sa_id, scapy_tun_spi, auth_algo_vpp_id, auth_key, crypt_algo_vpp_id, crypt_key, self.vpp_esp_protocol, self.pg1.remote_addr[addr_type], self.tun_if.remote_addr[addr_type], flags=flags, ).add_vpp_config() VppIpsecSA( self, vpp_tun_sa_id, vpp_tun_spi, auth_algo_vpp_id, auth_key, crypt_algo_vpp_id, crypt_key, self.vpp_esp_protocol, self.tun_if.remote_addr[addr_type], self.pg1.remote_addr[addr_type], flags=flags, ).add_vpp_config() VppIpsecSpdEntry( self, self.tun_spd, scapy_tun_sa_id, addr_any, addr_bcast, addr_any, addr_bcast, socket.IPPROTO_ESP, ).add_vpp_config() VppIpsecSpdEntry( self, self.tun_spd, scapy_tun_sa_id, addr_any, addr_bcast, addr_any, addr_bcast, socket.IPPROTO_ESP, is_outbound=0, ).add_vpp_config() VppIpsecSpdEntry( self, self.tun_spd, scapy_tun_sa_id, addr_any, addr_bcast, addr_any, addr_bcast, socket.IPPROTO_UDP, remote_port_start=4500, remote_port_stop=4500, ).add_vpp_config() VppIpsecSpdEntry( self, self.tun_spd, scapy_tun_sa_id, addr_any, addr_bcast, addr_any, addr_bcast, socket.IPPROTO_UDP, remote_port_start=4500, remote_port_stop=4500, is_outbound=0, ).add_vpp_config() VppIpsecSpdEntry( self, self.tun_spd, vpp_tun_sa_id, self.tun_if.remote_addr[addr_type], self.tun_if.remote_addr[addr_type], self.pg1.remote_addr[addr_type], self.pg1.remote_addr[addr_type], socket.IPPROTO_RAW, priority=10, policy=e.IPSEC_API_SPD_ACTION_PROTECT, is_outbound=0, ).add_vpp_config() VppIpsecSpdEntry( self, self.tun_spd, scapy_tun_sa_id, self.pg1.remote_addr[addr_type], self.pg1.remote_addr[addr_type], self.tun_if.remote_addr[addr_type], self.tun_if.remote_addr[addr_type], socket.IPPROTO_RAW, policy=e.IPSEC_API_SPD_ACTION_PROTECT, priority=10, ).add_vpp_config() def test_ipsec_nat_tun(self): """IPSec/NAT tunnel test case""" p = self.ipv4_params scapy_tun_sa = SecurityAssociation( ESP, spi=p.scapy_tun_spi, crypt_algo=p.crypt_algo, crypt_key=p.crypt_key, auth_algo=p.auth_algo, auth_key=p.auth_key, tunnel_header=IP(src=self.pg1.remote_ip4, dst=self.tun_if.remote_ip4), nat_t_header=UDP(sport=4500, dport=4500), ) # in2out - from private network to public pkts = self.create_stream_plain( self.pg1.remote_mac, self.pg1.local_mac, self.pg1.remote_ip4, self.tun_if.remote_ip4, ) self.pg1.add_stream(pkts) self.pg_enable_capture(self.pg_interfaces) self.pg_start() capture = self.tun_if.get_capture(len(pkts)) self.verify_capture_encrypted(capture, scapy_tun_sa) vpp_tun_sa = SecurityAssociation( ESP, spi=p.vpp_tun_spi, crypt_algo=p.crypt_algo, crypt_key=p.crypt_key, auth_algo=p.auth_algo, auth_key=p.auth_key, tunnel_header=IP(src=self.tun_if.remote_ip4, dst=self.pg1.remote_ip4), nat_t_header=UDP(sport=4500, dport=4500), ) # out2in - from public network to private pkts = self.create_stream_encrypted( self.tun_if.remote_mac, self.tun_if.local_mac, self.tun_if.remote_ip4, self.pg1.remote_ip4, vpp_tun_sa, ) self.logger.info(ppc("Sending packets:", pkts)) self.tun_if.add_stream(pkts) self.pg_enable_capture(self.pg_interfaces) self.pg_start() capture = self.pg1.get_capture(len(pkts)) self.verify_capture_plain(capture)