1/* Code snippet for optionally inserting ignored SIG records in resolver tests.
2 Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* Set to true for an alternative pass that inserts (ignored) SIG
20 records. This does not alter the response, so this property is not
21 encoded in the QNAME. The variable needs to be volatile because
22 leaf attributes tell GCC that the response function is not
23 called. */
24static volatile bool insert_sig;
25
26static void
27maybe_insert_sig (struct resolv_response_builder *b, const char *owner)
28{
29 resolv_response_open_record (b, name: owner, C_IN, T_SIG, ttl: 60);
30 resolv_response_add_data (b, "", 1);
31 resolv_response_close_record (b);
32}
33

source code of glibc/resolv/tst-resolv-maybe_insert_sig.h