-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathebpf-xdp-mptm.db
executable file
·1 lines (1 loc) · 14.3 KB
/
ebpf-xdp-mptm.db
1
{"gitRepoUrl": "https://github.com/ebpf-networking/xdp-mptm.git", "commitId": "b88a55de52a147fc1e3032af75d2036d0a3ba6fd", "humanFuncDescription": [{"filePath": "src/kernel/mptm.c", "funcName": "mptm_encap", "startLine": 52, "endLine": 99, "description": "This function performs the encapsulation of specific tunnel on an outgoing packet. It parse the packet eth and ip header using the parse_pkt_headers helper function. It then performs a map lookup into mptm_tnl_info_map with key which is a struct containing the ip source and dst addr of the packet. The map lookup returns a tunnel_info object *tn, which is used further to encapsulate differnet tunnel based on the rule programmed in the tunnel_info object retrieved from the map. This function will then call appropriate helper function encap_<tunnel> to encapsulate appropriate tunnel on the packet and finally redirects the packet to an outbound interface which is pre programmed in a devmap with the key taken as tn->veth_iface object and flags as none. It will return XDP_REDIRECT on successful encapsulation or XDP_PASS/XDP_ABORTED based on the return value of helper functions used.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm.c", "funcName": "mptm_encap", "startLine": 52, "endLine": 99, "description": "This function performs the encapsulation of specific tunnel on an outgoing packet. It parse the packet eth and ip header using the parse_pkt_headers helper function. It then performs a map lookup into mptm_tnl_info_map with key which is a struct containing the ip source and dst addr of the packet. The map lookup returns a tunnel_info object *tn, which is used further to encapsulate differnet tunnel based on the rule programmed in the tunnel_info object retrieved from the map. This function will then call appropriate helper function encap_<tunnel> to encapsulate appropriate tunnel on the packet and finally redirects the packet to an outbound interface which is pre programmed in a devmap with the key taken as tn->veth_iface object and flags as none. It will return XDP_REDIRECT on successful encapsulation or XDP_PASS/XDP_ABORTED based on the return value of helper functions used.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm.c", "funcName": "mptm_decap", "startLine": 102, "endLine": 167, "description": "This function performs the decapsulation of specific tunnel on an incoming packet. It parse the packet eth, ip and udp header using the parse_pkt_headers helper function. If the packet is a UDP packet and if the UDP dest port is 0xc117 the geneve tunnel destination port, then it will remove the geneve header from the packet,by reducing its data size by sizeof(struct genevehdr+ struct udphdr + struct iphdr + struct ethhdr) by calling bpf_xdp_adjust_head. After that it recalculates the packet headers using parse_pkt_headers and does a sanity check on if Geneve tunnel is what was intended for this packet. Finally the packet is redirected to appropriate interface using mptm_tnl_redirect_devmap", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm.c", "funcName": "mptm_decap", "startLine": 102, "endLine": 167, "description": "This function performs the decapsulation of specific tunnel on an incoming packet. It parse the packet eth, ip and udp header using the parse_pkt_headers helper function. If the packet is a UDP packet and if the UDP dest port is 0xc117 the geneve tunnel destination port, then it will remove the geneve header from the packet,by reducing its data size by sizeof(struct genevehdr+ struct udphdr + struct iphdr + struct ethhdr) by calling bpf_xdp_adjust_head. After that it recalculates the packet headers using parse_pkt_headers and does a sanity check on if Geneve tunnel is what was intended for this packet. Finally the packet is redirected to appropriate interface using mptm_tnl_redirect_devmap", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm_extras.c", "funcName": "mptm_redirect", "startLine": 24, "endLine": 29, "description": "This function takes in a packet represented by struct xdp_md context and redirects it to another interface via a BPF_REDIRECT_DEVMAP with key which is the packet's ingress interface and flags as zero.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm_extras.c", "funcName": "mptm_redirect", "startLine": 24, "endLine": 29, "description": "This function takes in a packet represented by struct xdp_md context and redirects it to another interface via a BPF_REDIRECT_DEVMAP with key which is the packet's ingress interface and flags as zero.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm_extras.c", "funcName": "mptm_pass", "startLine": 32, "endLine": 34, "description": "This function just returns XDP_PASS for any packet that is passed to it as struct xdp_mp context", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/mptm_extras.c", "funcName": "mptm_pass", "startLine": 32, "endLine": 34, "description": "This function just returns XDP_PASS for any packet that is passed to it as struct xdp_mp context", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-parse.h", "funcName": "parse_pkt_headers", "startLine": 41, "endLine": 97, "description": "This function takes in 5 arguments, 1 and 2 correspond to the start and end pointer of a packet data. The next three arguments are pointer to pointers to return values of eth header, ip header and udp header back to the caller. It calls internal libaray functions parse_ethhdr to parse eth header, parse_iphdr function to parse ip header, parse_udphdr to parse udp header, it ignore TCP packets because TCP packets don't represent any tunnel as all tunnels are implemented via udp stream. It sets the appropriate value of the pointer arguments to eth, ip and udp header to return to the caller. For success the function returns 0 and failure it returns -1", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-parse.h", "funcName": "parse_pkt_headers", "startLine": 41, "endLine": 97, "description": "This function takes in 5 arguments, 1 and 2 correspond to the start and end pointer of a packet data. The next three arguments are pointer to pointers to return values of eth header, ip header and udp header back to the caller. It calls internal libaray functions parse_ethhdr to parse eth header, parse_iphdr function to parse ip header, parse_udphdr to parse udp header, it ignore TCP packets because TCP packets don't represent any tunnel as all tunnels are implemented via udp stream. It sets the appropriate value of the pointer arguments to eth, ip and udp header to return to the caller. For success the function returns 0 and failure it returns -1", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "set_dst_mac", "startLine": 38, "endLine": 46, "description": "This function takes in two arguments 1) void *data 2) unsigned char *dst_mac and will set the mac represented by dst_mac array 0,1,2 to the pointer pointed by data at array offset 0,1,2", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "set_dst_mac", "startLine": 38, "endLine": 46, "description": "This function takes in two arguments 1) void *data 2) unsigned char *dst_mac and will set the mac represented by dst_mac array 0,1,2 to the pointer pointed by data at array offset 0,1,2", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "set_src_mac", "startLine": 48, "endLine": 56, "description": "This function takes in two arguments 1) void *data 2) unsigned char *src_mac and will set the mac represented by src_mac array 0,1,2 to the pointer pointed by data at array offset [3,4,5]", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "set_src_mac", "startLine": 48, "endLine": 56, "description": "This function takes in two arguments 1) void *data 2) unsigned char *src_mac and will set the mac represented by src_mac array 0,1,2 to the pointer pointed by data at array offset [3,4,5]", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "csum_fold_helper", "startLine": 58, "endLine": 67, "description": "This function takes in a __u64 csum helps in recomputing ipv4 checksum, return folded checksum as __u16", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "csum_fold_helper", "startLine": 58, "endLine": 67, "description": "This function takes in a __u64 csum helps in recomputing ipv4 checksum, return folded checksum as __u16", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "ipv4_csum_inline", "startLine": 69, "endLine": 77, "description": "This function takes in an ip header void *iph and a checksum __u64 *csum, recomputes ipv4 checksum and stores the result back in *csum argument, does not return anything.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "ipv4_csum_inline", "startLine": 69, "endLine": 77, "description": "This function takes in an ip header void *iph and a checksum __u64 *csum, recomputes ipv4 checksum and stores the result back in *csum argument, does not return anything.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "__encap_geneve", "startLine": 82, "endLine": 192, "description": "This function takes in 3 arguments, 1) packet represented by struct xdp_mp *ctx, 2) struct ethhdr *eth, 3) geneve_tunnel_info *tn. It performs a geneve header encapsulation on top of the existing packet the details of geneve header are taken from tn argument. Specifically it expands the packet header by first calling the function bpf_xdp_adjust_head with extra size outer_hdr_size equal to geneve header + udp header + ip header + eth header and then it recalculates the new outer headers of expanded packet and populates the header information by taking relevant information from geneve_tunnel_info *tn object and programs the headers according to geneve protocol. Return XDP_PASS on success or XDP_ABORTED on failure", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "__encap_geneve", "startLine": 82, "endLine": 192, "description": "This function takes in 3 arguments, 1) packet represented by struct xdp_mp *ctx, 2) struct ethhdr *eth, 3) geneve_tunnel_info *tn. It performs a geneve header encapsulation on top of the existing packet the details of geneve header are taken from tn argument. Specifically it expands the packet header by first calling the function bpf_xdp_adjust_head with extra size outer_hdr_size equal to geneve header + udp header + ip header + eth header and then it recalculates the new outer headers of expanded packet and populates the header information by taking relevant information from geneve_tunnel_info *tn object and programs the headers according to geneve protocol. Return XDP_PASS on success or XDP_ABORTED on failure", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "encap_geneve", "startLine": 194, "endLine": 200, "description": "This function takes in a packet represented by struct xdp_mp *ctx along side its eth header struct ethhdr *eth and mptm_tunnel_info *tn, it computes the geneve tunnel information to be pushed on the packet via mptm_tunnel_info and encapsulates the packet in a geneve tunnel by calling a helper funciton __encap_geneve. Returns XDP_PASS on success or XDP_ABORTED on failure.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "encap_geneve", "startLine": 194, "endLine": 200, "description": "This function takes in a packet represented by struct xdp_mp *ctx along side its eth header struct ethhdr *eth and mptm_tunnel_info *tn, it computes the geneve tunnel information to be pushed on the packet via mptm_tunnel_info and encapsulates the packet in a geneve tunnel by calling a helper funciton __encap_geneve. Returns XDP_PASS on success or XDP_ABORTED on failure.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "encap_vlan", "startLine": 203, "endLine": 214, "description": "This function takes in a packet represented by struct xdp_mp *ctx along side its eth header struct ethhdr *eth and mptm_tunnel_info *tn, it computes the vlan tunnel to be pushed on the packet via mptm_tunnel_info and encapsulates the packet in a vlan by pusing a vlan tag on the packet eth hdr by calling a helper funciton vlan_tag_push. Returns XDP_PASS on success or XDP_ABORTED on failure.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}, {"filePath": "src/kernel/lib/pkt-encap.h", "funcName": "encap_vlan", "startLine": 203, "endLine": 214, "description": "This function takes in a packet represented by struct xdp_mp *ctx along side its eth header struct ethhdr *eth and mptm_tunnel_info *tn, it computes the vlan tunnel to be pushed on the packet via mptm_tunnel_info and encapsulates the packet in a vlan by pusing a vlan tag on the packet eth hdr by calling a helper funciton vlan_tag_push. Returns XDP_PASS on success or XDP_ABORTED on failure.", "author": "Theophilus A. Benson", "authorEmail": "[email protected]", "date": "2023-02-20"}]}