]>
Commit | Line | Data |
---|---|---|
0545caaa | 1 | /* |
f70aedc4 | 2 | * Copyright (C) 1996-2021 The Squid Software Foundation and contributors |
0545caaa AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
f7f3304a | 9 | #include "squid.h" |
4a3b98d7 AJ |
10 | #include "dns/rfc1035.h" |
11 | #include "dns/rfc2671.h" | |
e210930b AJ |
12 | |
13 | int | |
14 | rfc2671RROptPack(char *buf, size_t sz, ssize_t edns_sz) | |
15 | { | |
16 | // set the OPT record correctly. base it on a macro size of the Squid DNS read buffer | |
17 | static rfc1035_rr opt; | |
18 | ||
19 | // EDNS OPT record says only what our DNS buffer size is so far. | |
20 | snprintf(opt.name, RFC1035_MAXHOSTNAMESZ, "."); | |
21 | opt.type = RFC1035_TYPE_OPT; | |
9abd2b76 | 22 | opt._class = min(edns_sz, (ssize_t)SQUID_UDP_SO_RCVBUF-1); |
e210930b AJ |
23 | opt.ttl = 0; // relevant? |
24 | opt.rdata = NULL; | |
25 | opt.rdlength = 0; | |
26 | ||
27 | return rfc1035RRPack(buf, sz, &opt); | |
28 | } | |
f53969cc | 29 |