This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static __always_inline | |
int udp_dns_reply(struct cursor *c) | |
{ | |
struct udphdr *udp; | |
struct dnshdr *dns; | |
if (!(udp = parse_udphdr(c))|| udp->dest != __bpf_htons(DNS_PORT) | |
|| !(dns = parse_dnshdr(c))) | |
return -1; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// continuing: | |
if (dns->arcount) { | |
struct dns_rr *opt_rr; | |
uint8_t *opt_owner = c->pos; | |
opt_owner = c->pos; | |
if (++c->pos > c->end || *opt_owner | |
|| !(opt_rr = parse_dns_rr(c)) | |
|| opt_rr->type != __bpf_htons(RR_TYPE_OPT)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static __always_inline | |
void csum_remove_data(uint32_t *csum, struct cursor *c, uint16_t len) | |
{ | |
if (c->pos + len <= c->end) { | |
*csum = bpf_csum_diff(c->pos, len, 0, 0, *csum); | |
c->pos += len; | |
} | |
} | |
int xdp_dns_says_no(struct xdp_md *ctx) |
OlderNewer