]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
adjust RR-dumping style a little
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 6 Aug 2021 09:52:26 +0000 (11:52 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 10 Aug 2021 18:16:58 +0000 (20:16 +0200)
The former "default" dumping style isn't really used anywhere in Knot.
The only visible difference is that RRSIGs are now logged *without*
replacing their TTLs by the original non-decremented TTL values.
That can avoid some confusion when reading debug logs.
(Those original TTLs are still shown a bit further on each line.)

daemon/lua/kres-gen-29.lua
daemon/lua/kres-gen-31.lua
daemon/lua/kres-gen.sh
daemon/lua/kres.lua
lib/utils.c
lib/utils.h

index 7649520eec38823bd915c750adbfde8ea3c6cb3e..ebc60488bf977d3562b6b3f35ca827653d454394 100644 (file)
@@ -11,7 +11,7 @@ struct timeval {
 };
 
 typedef struct knot_dump_style knot_dump_style_t;
-extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
+extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
 struct kr_cdb_api {};
 struct lru {};
 typedef enum {KNOT_ANSWER, KNOT_AUTHORITY, KNOT_ADDITIONAL} knot_section_t;
index 4e2b4ed7c29a928d10b7efaf18e853bc96c64859..991da7022541cb26a222dfd66c0fc8a85ba76e38 100644 (file)
@@ -11,7 +11,7 @@ struct timeval {
 };
 
 typedef struct knot_dump_style knot_dump_style_t;
-extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
+extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
 struct kr_cdb_api {};
 struct lru {};
 typedef enum {KNOT_ANSWER, KNOT_AUTHORITY, KNOT_ADDITIONAL} knot_section_t;
index 3fb1f2078b073a9707f3c0baa74334b30824c186..eded99ea97ac52c8b5342ff5d5bdfaf327554313 100755 (executable)
@@ -64,7 +64,7 @@ EOF
 
 printf "
 typedef struct knot_dump_style knot_dump_style_t;
-extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
+extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
 struct kr_cdb_api {};
 struct lru {};
 "
index aa95c232d3a4e663cda796eaac7cba25c0ca249a..5507561958b085152d0153190834b6f0f0a6ca31 100644 (file)
@@ -395,7 +395,7 @@ ffi.metatype( knot_rrset_t, {
                        if rr:rdcount() > 0 then
                                local ret
                                if i ~= nil then
-                                       ret = knot.knot_rrset_txt_dump_data(rr, i, rrset_buf, rrset_buflen, knot.KNOT_DUMP_STYLE_DEFAULT)
+                                       ret = knot.knot_rrset_txt_dump_data(rr, i, rrset_buf, rrset_buflen, C.KR_DUMP_STYLE_DEFAULT)
                                else
                                        ret = -1
                                end
@@ -412,7 +412,7 @@ ffi.metatype( knot_rrset_t, {
                        local size = ffi.new('size_t[1]', { bufsize }) -- one size_t = bufsize
 
                        local ret = knot.knot_rrset_txt_dump(rr, dump, size,
-                                                       style or knot.KNOT_DUMP_STYLE_DEFAULT)
+                                                       style or C.KR_DUMP_STYLE_DEFAULT)
                        local result = nil
                        if ret >= 0 then
                                result = ffi.string(dump[0], ret)
@@ -428,7 +428,7 @@ ffi.metatype( knot_rrset_t, {
                        ffi.gc(dump, C.free)
 
                        local ret = knot.knot_rrset_txt_dump_data(rr, i, dump, 1024,
-                                                       knot.KNOT_DUMP_STYLE_DEFAULT)
+                                                       C.KR_DUMP_STYLE_DEFAULT)
                        if ret >= 0 then
                                local out = {}
                                out.owner = dname2str(rr:owner())
index 789a9b25f5a2bde55d529c38c679ba33e9831703..47f913e41a18dacaa31d6eb8c831ef919143d6e1 100644 (file)
@@ -1010,6 +1010,10 @@ char *kr_pkt_text(const knot_pkt_t *pkt)
        return result;
 }
 
+const knot_dump_style_t KR_DUMP_STYLE_DEFAULT = { /* almost all = false, */
+       .show_ttl = true,
+};
+
 char *kr_rrset_text(const knot_rrset_t *rr)
 {
        if (!rr) {
@@ -1019,7 +1023,7 @@ char *kr_rrset_text(const knot_rrset_t *rr)
        /* Note: knot_rrset_txt_dump will double the size until the rrset fits */
        size_t bufsize = 128;
        char *buf = malloc(bufsize);
-       int ret = knot_rrset_txt_dump(rr, &buf, &bufsize, &KNOT_DUMP_STYLE_DEFAULT);
+       int ret = knot_rrset_txt_dump(rr, &buf, &bufsize, &KR_DUMP_STYLE_DEFAULT);
        if (ret < 0) {
                free(buf);
                return NULL;
index 9232da304246a9ae4d299acde150246bbb3c1178..b372d5f001ed60bf69e917466e32179b9478cc75 100644 (file)
@@ -401,6 +401,11 @@ int kr_ranked_rrarray_set_wire(ranked_rr_array_t *array, bool to_wire,
                               uint32_t qry_uid, bool check_dups,
                               bool (*extraCheck)(const ranked_rr_array_entry_t *));
 
+
+/** Style used by the kr_*_text() functions. */
+KR_EXPORT extern
+const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
+
 /**
  * @return Newly allocated string representation of packet.
  * Caller has to free() returned string.