1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421
|
<pre>Internet Engineering Task Force (IETF) J. Dickinson
Request for Comments: 8618 J. Hague
Category: Standards Track S. Dickinson
ISSN: 2070-1721 Sinodun IT
T. Manderson
ICANN
J. Bond
Wikimedia Foundation, Inc.
September 2019
<span class="h1">Compacted-DNS (C-DNS): A Format for DNS Packet Capture</span>
Abstract
This document describes a data representation for collections of DNS
messages. The format is designed for efficient storage and
transmission of large packet captures of DNS traffic; it attempts to
minimize the size of such packet capture files but retain the full
DNS message contents along with the most useful transport metadata.
It is intended to assist with the development of DNS traffic-
monitoring applications.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc7841#section-2">Section 2 of RFC 7841</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="https://www.rfc-editor.org/info/rfc8618">https://www.rfc-editor.org/info/rfc8618</a>.
<span class="grey">Dickinson, et al. Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-2">2</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-3">3</a>. Data Collection Use Cases . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-4">4</a>. Design Considerations . . . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a>
<a href="#section-5">5</a>. Choice of CBOR . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-6">6</a>. C-DNS Format Conceptual Overview . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-6.1">6.1</a>. Block Parameters . . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-6.2">6.2</a>. Storage Parameters . . . . . . . . . . . . . . . . . . . <a href="#page-14">14</a>
<a href="#section-6.2.1">6.2.1</a>. Optional Data Items . . . . . . . . . . . . . . . . . <a href="#page-15">15</a>
<a href="#section-6.2.2">6.2.2</a>. Optional RRs and OPCODEs . . . . . . . . . . . . . . <a href="#page-16">16</a>
<a href="#section-6.2.3">6.2.3</a>. Storage Flags . . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-6.2.4">6.2.4</a>. IP Address Storage . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-7">7</a>. C-DNS Format Detailed Description . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-7.1">7.1</a>. Map Quantities and Indexes . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-7.2">7.2</a>. Tabular Representation . . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-7.3">7.3</a>. "File" . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-19">19</a>
<a href="#section-7.3.1">7.3.1</a>. "FilePreamble" . . . . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-7.3.1.1">7.3.1.1</a>. "BlockParameters" . . . . . . . . . . . . . . . . <a href="#page-20">20</a>
<a href="#section-7.3.1.1.1">7.3.1.1.1</a>. "StorageParameters" . . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-7.3.1.1.1.1">7.3.1.1.1.1</a>. "StorageHints" . . . . . . . . . . . . . <a href="#page-22">22</a>
<a href="#section-7.3.1.1.2">7.3.1.1.2</a>. "CollectionParameters" . . . . . . . . . . . <a href="#page-24">24</a>
<a href="#section-7.3.2">7.3.2</a>. "Block" . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-25">25</a>
<a href="#section-7.3.2.1">7.3.2.1</a>. "BlockPreamble" . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#section-7.3.2.2">7.3.2.2</a>. "BlockStatistics" . . . . . . . . . . . . . . . . <a href="#page-27">27</a>
<a href="#section-7.3.2.3">7.3.2.3</a>. "BlockTables" . . . . . . . . . . . . . . . . . . <a href="#page-28">28</a>
<a href="#section-7.3.2.3.1">7.3.2.3.1</a>. "ClassType" . . . . . . . . . . . . . . . . . <a href="#page-29">29</a>
<a href="#section-7.3.2.3.2">7.3.2.3.2</a>. "QueryResponseSignature" . . . . . . . . . . <a href="#page-30">30</a>
<a href="#section-7.3.2.3.3">7.3.2.3.3</a>. "Question" . . . . . . . . . . . . . . . . . <a href="#page-33">33</a>
<a href="#section-7.3.2.3.4">7.3.2.3.4</a>. "RR" . . . . . . . . . . . . . . . . . . . . <a href="#page-34">34</a>
<a href="#section-7.3.2.3.5">7.3.2.3.5</a>. "MalformedMessageData" . . . . . . . . . . . <a href="#page-34">34</a>
<span class="grey">Dickinson, et al. Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<a href="#section-7.3.2.4">7.3.2.4</a>. "QueryResponse" . . . . . . . . . . . . . . . . . <a href="#page-35">35</a>
<a href="#section-7.3.2.4.1">7.3.2.4.1</a>. "ResponseProcessingData" . . . . . . . . . . <a href="#page-36">36</a>
<a href="#section-7.3.2.4.2">7.3.2.4.2</a>. "QueryResponseExtended" . . . . . . . . . . . <a href="#page-37">37</a>
<a href="#section-7.3.2.5">7.3.2.5</a>. "AddressEventCount" . . . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-7.3.2.6">7.3.2.6</a>. "MalformedMessage" . . . . . . . . . . . . . . . <a href="#page-39">39</a>
<a href="#section-8">8</a>. Versioning . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-39">39</a>
<a href="#section-9">9</a>. C-DNS to PCAP . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-40">40</a>
<a href="#section-9.1">9.1</a>. Name Compression . . . . . . . . . . . . . . . . . . . . <a href="#page-42">42</a>
<a href="#section-10">10</a>. Data Collection . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-42">42</a>
<a href="#section-10.1">10.1</a>. Matching Algorithm . . . . . . . . . . . . . . . . . . . <a href="#page-43">43</a>
<a href="#section-10.2">10.2</a>. Message Identifiers . . . . . . . . . . . . . . . . . . <a href="#page-45">45</a>
<a href="#section-10.2.1">10.2.1</a>. Primary ID (Required) . . . . . . . . . . . . . . . <a href="#page-45">45</a>
<a href="#section-10.2.2">10.2.2</a>. Secondary ID (Optional) . . . . . . . . . . . . . . <a href="#page-46">46</a>
<a href="#section-10.3">10.3</a>. Algorithm Parameters . . . . . . . . . . . . . . . . . . <a href="#page-46">46</a>
<a href="#section-10.4">10.4</a>. Algorithm Requirements . . . . . . . . . . . . . . . . . <a href="#page-46">46</a>
<a href="#section-10.5">10.5</a>. Algorithm Limitations . . . . . . . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-10.6">10.6</a>. Workspace . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-10.7">10.7</a>. Output . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-10.8">10.8</a>. Post-Processing . . . . . . . . . . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-11">11</a>. Implementation Guidance . . . . . . . . . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-11.1">11.1</a>. Optional Data . . . . . . . . . . . . . . . . . . . . . <a href="#page-48">48</a>
<a href="#section-11.2">11.2</a>. Trailing Bytes . . . . . . . . . . . . . . . . . . . . . <a href="#page-48">48</a>
<a href="#section-11.3">11.3</a>. Limiting Collection of RDATA . . . . . . . . . . . . . . <a href="#page-49">49</a>
<a href="#section-11.4">11.4</a>. Timestamps . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-49">49</a>
<a href="#section-12">12</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-49">49</a>
<a href="#section-12.1">12.1</a>. Transport Types . . . . . . . . . . . . . . . . . . . . <a href="#page-49">49</a>
<a href="#section-12.2">12.2</a>. Data Storage Flags . . . . . . . . . . . . . . . . . . . <a href="#page-50">50</a>
<a href="#section-12.3">12.3</a>. Response-Processing Flags . . . . . . . . . . . . . . . <a href="#page-51">51</a>
<a href="#section-12.4">12.4</a>. AddressEvent Types . . . . . . . . . . . . . . . . . . . <a href="#page-51">51</a>
<a href="#section-13">13</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-52">52</a>
<a href="#section-14">14</a>. Privacy Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-52">52</a>
<a href="#section-15">15</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-15.1">15.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-15.2">15.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-55">55</a>
<a href="#appendix-A">Appendix A</a>. CDDL . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-58">58</a>
<a href="#appendix-B">Appendix B</a>. DNS Name Compression Example . . . . . . . . . . . . <a href="#page-69">69</a>
<a href="#appendix-B.1">B.1</a>. NSD Compression Algorithm . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#appendix-B.2">B.2</a>. Knot Authoritative Compression Algorithm . . . . . . . . <a href="#page-70">70</a>
<a href="#appendix-B.3">B.3</a>. Observed Differences . . . . . . . . . . . . . . . . . . <a href="#page-71">71</a>
<a href="#appendix-C">Appendix C</a>. Comparison of Binary Formats . . . . . . . . . . . . <a href="#page-71">71</a>
<a href="#appendix-C.1">C.1</a>. Comparison with Full PCAP Files . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#appendix-C.2">C.2</a>. Simple versus Block Coding . . . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#appendix-C.3">C.3</a>. Binary versus Text Formats . . . . . . . . . . . . . . . <a href="#page-75">75</a>
<a href="#appendix-C.4">C.4</a>. Performance . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-75">75</a>
<a href="#appendix-C.5">C.5</a>. Conclusions . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-75">75</a>
<a href="#appendix-C.6">C.6</a>. Block Size Choice . . . . . . . . . . . . . . . . . . . . <a href="#page-76">76</a>
<span class="grey">Dickinson, et al. Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<a href="#appendix-D">Appendix D</a>. Data Fields for Traffic Regeneration . . . . . . . . <a href="#page-77">77</a>
<a href="#appendix-D.1">D.1</a>. Recommended Fields for Traffic Regeneration . . . . . . . <a href="#page-77">77</a>
<a href="#appendix-D.2">D.2</a>. Issues with Small Data Captures . . . . . . . . . . . . . <a href="#page-77">77</a>
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-78">78</a>
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-79">79</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
There has long been a need for server operators to collect DNS
Queries and Responses on authoritative and recursive name servers for
monitoring and analysis. This data is used in a number of ways,
including traffic monitoring, analyzing network attacks, and "day in
the life" (DITL) [<a href="#ref-ditl" title=""DITL"">ditl</a>] analysis.
A wide variety of tools already exist that facilitate the collection
of DNS traffic data, such as the DNS Statistics Collector (DSC)
[<a href="#ref-dsc" title=""DSC"">dsc</a>], packetq [<a href="#ref-packetq" title=""PacketQ"">packetq</a>], dnscap [<a href="#ref-dnscap" title=""DNSCAP"">dnscap</a>], and dnstap [<a href="#ref-dnstap" title=""dnstap"">dnstap</a>].
However, there is no standard exchange format for large DNS packet
captures. The PCAP ("packet capture") [<a href="#ref-pcap" title=""PCAP"">pcap</a>] format or the PCAP Next
Generation (PCAP-NG) [<a href="#ref-pcapng" title=""pcapng: PCAP next generation file format specification"">pcapng</a>] format is typically used in practice
for packet captures, but these file formats can contain a great deal
of additional information that is not directly pertinent to DNS
traffic analysis and thus unnecessarily increases the capture file
size. Additionally, these tools and formats typically have no filter
mechanism to selectively record only certain fields at capture time,
requiring post-processing for anonymization or pseudonymization of
data to protect user privacy.
There has also been work on using text-based formats to describe DNS
packets (for example, see [<a href="#ref-dnsxml" title=""dnsxml - A standard XML representation of DNS data"">dnsxml</a>] and [<a href="./rfc8427" title=""Representing DNS Messages in JSON"">RFC8427</a>]), but this work is
largely aimed at producing convenient representations of single
messages.
Many DNS operators may receive hundreds of thousands of Queries per
second on a single name server instance, so a mechanism to minimize
the storage and transmission size (and therefore upload overhead) of
the data collected is highly desirable.
The format described in this document, C-DNS (Compacted-DNS), focuses
on the problem of capturing and storing large packet capture files of
DNS traffic with the following goals in mind:
o Minimize the file size for storage and transmission.
o Minimize the overhead of producing the packet capture file and the
cost of any further (general-purpose) compression of the file.
<span class="grey">Dickinson, et al. Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
This document contains:
o A discussion of some common use cases in which DNS data is
collected; see <a href="#section-3">Section 3</a>.
o A discussion of the major design considerations in developing an
efficient data representation for collections of DNS messages; see
<a href="#section-4">Section 4</a>.
o A description of why the Concise Binary Object Representation
(CBOR) [<a href="./rfc7049" title=""Concise Binary Object Representation (CBOR)"">RFC7049</a>] was chosen for this format; see <a href="#section-5">Section 5</a>.
o A conceptual overview of the C-DNS format; see <a href="#section-6">Section 6</a>.
o The definition of the C-DNS format for the collection of DNS
messages; see <a href="#section-7">Section 7</a>.
o Notes on converting C-DNS data to PCAP format; see <a href="#section-9">Section 9</a>.
o Some high-level implementation considerations for applications
designed to produce C-DNS; see <a href="#section-10">Section 10</a>.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
<a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>] [<a href="./rfc8174" title=""Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"">RFC8174</a>] when, and only when, they appear in all
capitals, as shown here.
"Packet" refers to an individual IPv4 or IPv6 packet. Typically,
packets are UDP datagrams, but such packets may also be part of a TCP
data stream. "Message", unless otherwise qualified, refers to a DNS
payload extracted from a UDP datagram or a TCP data stream.
The parts of DNS messages are named as they are in [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>].
Specifically, the DNS message has five sections: Header, Question,
Answer, Authority, and Additional.
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Data Collection Use Cases</span>
From a purely server operator perspective, collecting full packet
captures of all packets going into or out of a name server provides
the most comprehensive picture of network activity. However, there
are several design choices or other limitations that are common to
many DNS installations and operators.
<span class="grey">Dickinson, et al. Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
o DNS servers are hosted in a variety of situations:
* Self-hosted servers
* Third-party hosting (including multiple third parties)
* Third-party hardware (including multiple third parties)
o Data is collected under different conditions:
* On well-provisioned servers running in a steady state
* On heavily loaded servers
* On virtualized servers
* On servers that are under DoS attack
* On servers that are unwitting intermediaries in DoS attacks
o Traffic can be collected via a variety of mechanisms:
* Within the name server implementation itself
* On the same hardware as the name server itself
* Using a network tap on an adjacent host to listen to DNS
traffic
* Using port mirroring to listen from another host
o The capabilities of data collection (and upload) networks vary:
* Out-of-band networks with the same capacity as the in-band
network
* Out-of-band networks with less capacity than the in-band
network
* Everything being on the in-band network
Thus, there is a wide range of use cases, from very limited data
collection environments (third-party hardware, servers that are under
attack, packet capture on the name server itself and no out-of-band
network) to "limitless" environments (self-hosted, well-provisioned
servers, using a network tap or port mirroring with out-of-band
networks with the same capacity as the in-band network). In the
<span class="grey">Dickinson, et al. Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
former case, it is infeasible to reliably collect full packet
captures, especially if the server is under attack. In the latter
case, collection of full packet captures may be reasonable.
As a result of these restrictions, the C-DNS data format is designed
with the most limited use case in mind, such that:
o Data collection will occur on the same hardware as the name server
itself
o Collected data will be stored on the same hardware as the name
server itself, at least temporarily
o Collected data being returned to some central analysis system will
use the same network interface as the DNS Queries and Responses
o There can be multiple third-party servers involved
Because of these considerations, a major factor in the design of the
format is minimal storage size of the capture files.
Another significant consideration for any application that records
DNS traffic is that the running of the name server software and the
transmission of DNS Queries and Responses are the most important jobs
of a name server; capturing data is not. Any data collection system
co-located with the name server needs to be intelligent enough to
carefully manage its CPU, disk, memory, and network utilization.
This leads to designing a format that requires a relatively low
overhead to produce and minimizes the requirement for further
potentially costly compression.
However, it is also essential that interoperability with less
restricted infrastructure is maintained. In particular, it is highly
desirable that the collection format should facilitate the
re-creation of common formats (such as PCAP) that are as close to the
original as is realistic, given the restrictions above.
<span class="grey">Dickinson, et al. Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Design Considerations</span>
This section presents some of the major design considerations used in
the development of the C-DNS format.
1. The basic unit of data is a combined DNS Query and the associated
Response (a "Query/Response (Q/R) data item"). The same
structure will be used for unmatched Queries and Responses.
Queries without Responses will be captured omitting the Response
data. Responses without Queries will be captured omitting the
Query data (but using the Question section from the Response, if
present, as an identifying QNAME).
* Rationale: A Query and the associated Response represent the
basic level of a client's interaction with the server. Also,
combining the Query and Response into one item often reduces
storage requirements due to commonality in the data of the two
messages.
In the context of generating a C-DNS file, it is assumed that
only those DNS payloads that can be parsed to produce a
well-formed DNS message are stored in the structured Query/
Response data items of the C-DNS format and that all other
messages will (optionally) be recorded as separate malformed
messages. Parsing a well-formed message means, at a minimum, the
following:
* The packet has a well-formed 12-byte DNS Header with a
recognized OPCODE.
* The section counts are consistent with the section contents.
* All of the Resource Records (RRs) can be fully parsed.
2. All top-level fields in each Query/Response data item will be
optional.
* Rationale: Different operators will have different
requirements for data to be available for analysis. Operators
with minimal requirements should not have to pay the cost of
recording full data, though this will limit the ability to
perform certain kinds of data analysis and also to reconstruct
packet captures. For example, omitting the RRs from a
Response will reduce the C-DNS file size; in principle,
Responses can be synthesized if there is enough context.
Operators may have different policies for collecting user data
and can choose to omit or anonymize certain fields at capture
time, e.g., client address.
<span class="grey">Dickinson, et al. Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
3. Multiple Query/Response data items will be collected into blocks
in the format. Common data in a block will be abstracted and
referenced from individual Query/Response data items by indexing.
The maximum number of Query/Response data items in a block will
be configurable.
* Rationale: This blocking and indexing action provides a
significant reduction in the volume of file data generated.
Although this introduces complexity, it provides compression
of the data that makes use of knowledge of the DNS message
structure.
* It is anticipated that the files produced can be subject to
further compression using general-purpose compression tools.
Measurements show that blocking significantly reduces the CPU
required to perform such strong compression. See
<a href="#appendix-C.2">Appendix C.2</a>.
* Examples of commonality between DNS messages are that in most
cases the QUESTION RR is the same in the Query and Response
and that there is a finite set of Query "signatures" (based on
a subset of attributes). For many authoritative servers,
there is very likely to be a finite set of Responses that are
generated, of which a large number are NXDOMAIN.
4. Traffic metadata can optionally be included in each block.
Specifically, counts of some types of non-DNS packets (e.g.,
ICMP, TCP resets) sent to the server may be of interest.
5. The wire-format content of malformed DNS messages may optionally
be recorded.
* Rationale: Any structured capture format that does not capture
the DNS payload byte for byte will be limited to some extent
in that it cannot represent malformed DNS messages. Only
those messages that can be fully parsed and transformed into
the structured format can be fully represented. Note,
however, that this can result in rather misleading statistics.
For example, a malformed Query that cannot be represented in
the C-DNS format will lead to the (well-formed) DNS Response
with error code FORMERR appearing as "unmatched". Therefore,
it can greatly aid downstream analysis to have the wire format
of the malformed DNS messages available directly in the
C-DNS file.
<span class="grey">Dickinson, et al. Standards Track [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Choice of CBOR</span>
This document presents a detailed format description for C-DNS. The
format uses CBOR [<a href="./rfc7049" title=""Concise Binary Object Representation (CBOR)"">RFC7049</a>].
The choice of CBOR was made taking a number of factors into account.
o CBOR is a binary representation and thus is economical in storage
space.
o Other binary representations were investigated, and whilst all had
attractive features, none had a significant advantage over CBOR.
See <a href="#appendix-C">Appendix C</a> for some discussion of this.
o CBOR is an IETF specification and is familiar to IETF
participants. It is based on the now-common ideas of lists and
objects and thus requires very little familiarization for those in
the wider industry.
o CBOR is a simple format and can easily be implemented from scratch
if necessary. Formats that are more complex require library
support, which may present problems on unusual platforms.
o CBOR can also be easily converted to text formats such as JSON
[<a href="./rfc8259" title=""The JavaScript Object Notation (JSON) Data Interchange Format"">RFC8259</a>] for debugging and other human inspection requirements.
o CBOR data schemas can be described using the Concise Data
Definition Language (CDDL) [<a href="./rfc8610" title=""Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures"">RFC8610</a>].
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. C-DNS Format Conceptual Overview</span>
The following figures show purely schematic representations of the
C-DNS format to convey the high-level structure of the C-DNS format.
<a href="#section-7">Section 7</a> provides a detailed discussion of the CBOR representation
and individual elements.
Figure 1 shows the C-DNS format at the top level, including the file
header and data blocks. The Query/Response data items, Address/Event
Count data items, and Malformed Message data items link to various
Block Tables.
<span class="grey">Dickinson, et al. Standards Track [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
+-------+
+ C-DNS |
+-------+--------------------------+
| File Type Identifier |
+----------------------------------+
| File Preamble |
| +--------------------------------+
| | Format Version |
| +--------------------------------+
| | Block Parameters |
+-+--------------------------------+
| Block |
| +--------------------------------+
| | Block Preamble |
| +--------------------------------+
| | Block Statistics |
| +--------------------------------+
| | Block Tables |
| +--------------------------------+
| | Query/Response data items |
| +--------------------------------+
| | Address/Event Count data items |
| +--------------------------------+
| | Malformed Message data items |
+-+--------------------------------+
| Block |
| +--------------------------------+
| | Block Preamble |
| +--------------------------------+
| | Block Statistics |
| +--------------------------------+
| | Block Tables |
| +--------------------------------+
| | Query/Response data items |
| +--------------------------------+
| | Address/Event Count data items |
| +--------------------------------+
| | Malformed Message data items |
+-+--------------------------------+
| Further Blocks... |
+----------------------------------+
Figure 1: The C-DNS Format
Figure 2 shows some more-detailed relationships within each Block,
specifically those between the Query/Response data item and the
relevant Block Tables. Some fields have been omitted for clarity.
<span class="grey">Dickinson, et al. Standards Track [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
+----------------+
| Query/Response |
+-------------------------+
| Time Offset |
+-------------------------+ +------------------+
| Client Address |---------+->| IP Address array |
+-------------------------+ | +------------------+
| Client Port | |
+-------------------------+ | +------------------+
| Transaction ID | +---)->| Name/RDATA array |<--------+
+-------------------------+ | | +------------------+ |
| Query Signature |--+ | | |
+-------------------------+ | | | +-----------------+ |
| Client Hoplimit (q) | +--)---)->| Query Signature | |
+-------------------------+ | | +-----------------+-------+ |
| Response Delay (r) | | +--| Server Address | |
+-------------------------+ | +-------------------------+ |
| Query Name |--+--+ | Server Port | |
+-------------------------+ | +-------------------------+ |
| Query Size (q) | | | Transport Flags | |
+-------------------------+ | +-------------------------+ |
| Response Size (r) | | | QR Type | |
+-------------------------+ | +-------------------------+ |
| Response Processing (r) | | | QR Signature Flags | |
| +-----------------------+ | +-------------------------+ |
| | Bailiwick |--+ | Query OPCODE (q) | |
| +-----------------------+ +-------------------------+ |
| | Flags | | QR DNS Flags | |
+-+-----------------------+ +-------------------------+ |
| Extra Query Info (q) | | Query RCODE (q) | |
| +-----------------------+ +-------------------------+ |
| | Question |--+---+ +--+-Query Class/Type (q) | |
| +-----------------------+ | | +-------------------------+ |
| | Answer |--+ | | | Query QDCOUNT (q) | |
| +-----------------------+ | | | +-------------------------+ |
| | Authority |--+ | | | Query ANCOUNT (q) | |
| +-----------------------+ | | | +-------------------------+ |
| | Additional |--+ | | | Query NSCOUNT (q) | |
<span class="grey">Dickinson, et al. Standards Track [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
+-+-----------------------+ | | | +-------------------------+ |
| Extra Response Info (r) | |-+ | | | Query ARCOUNT (q) | |
| +-----------------------+ | | | | +-------------------------+ |
| | Answer |--+ | | | | Query EDNS version (q) | |
| +-----------------------+ | | | | +-------------------------+ |
| | Authority |--+ | | | | Query EDNS UDP Size (q) | |
| +-----------------------+ | | | | +-------------------------+ |
| | Additional |--+ | | | | Query OPT RDATA (q) |--+
+-+-----------------------+ | | | +-------------------------+ |
| | | | Response RCODE (r) | |
| | | +-------------------------+ |
+ -----------------------------+ | +----------+ |
| | | |
| + -----------------------------+ | |
| | +---------------+ +----------+ | |
| +->| Question List |->| Question | | |
| | array | | array | | |
| +---------------+ +----------+--+ | |
| | Name |--+-----)--------------------+
| +-------------+ | | +------------+
| | Class/Type |--)---+-+->| Class/Type |
| +-------------+ | | | array |
| | | +------------+--+
| | | | CLASS |
| +---------------+ +----------+ | | +---------------+
+--->| RR List array |->| RR array | | | | TYPE |
+---------+-----+ +----------+--+ | | +---------------+
| Name |--+ |
+-------------+ |
| Class/Type |------+
+-------------+
Figure 2: The Query/Response Data Item and Subsidiary Tables
In Figure 2, data items annotated (q) are only present when a
Query/Response has a Query, and those annotated (r) are only present
when a Query/Response Response is present.
A C-DNS file begins with a file header containing a File Type
Identifier and a File Preamble. The File Preamble contains
information on the file Format Version and an array of Block
Parameters items (the contents of which include Collection and
Storage Parameters used for one or more Blocks).
The file header is followed by a series of Blocks.
<span class="grey">Dickinson, et al. Standards Track [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
A Block consists of a Block Preamble item, some Block Statistics for
the traffic stored within the Block, and then various arrays of
common data collectively called the Block Tables. This is then
followed by an array of the Query/Response data items detailing the
Queries and Responses stored within the Block. The array of
Query/Response data items is in turn followed by the Address/Event
Count data items (an array of per-client counts of particular IP
events) and then Malformed Message data items (an array of malformed
messages that are stored in the Block).
The exact nature of the DNS data will affect what Block size is the
best fit; however, sample data for a root server indicated that Block
sizes up to 10,000 Query/Response data items give good results. See
<a href="#appendix-C.6">Appendix C.6</a> for more details.
This design exploits data commonality and block-based storage to
minimize the C-DNS file size. As a result, C-DNS cannot be streamed
below the level of a Block.
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Block Parameters</span>
The details of the Block Parameters items are not shown in the
diagrams but are discussed here for context.
An array of Block Parameters items is stored in the File Preamble
(with a minimum of one item at index 0); a Block Parameters item
consists of a collection of Storage and Collection Parameters that
applies to any given Block. An array is used in order to support use
cases such as wanting to merge C-DNS files from different sources.
The Block Preamble item then contains an optional index for the Block
Parameters item that applies for that Block; if not present, the
index defaults to 0. Hence, in effect, a global Block Parameters
item is defined that can then be overridden per Block.
<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Storage Parameters</span>
The Block Parameters item includes a Storage Parameters item -- this
contains information about the specific data fields stored in the
C-DNS file.
These parameters include:
o The sub-second timing resolution used by the data.
o Information (hints) on which optional data are omitted. See
<a href="#section-6.2.1">Section 6.2.1</a>.
<span class="grey">Dickinson, et al. Standards Track [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
o Recorded OPCODES [<a href="#ref-opcodes" title=""DNS OpCodes"">opcodes</a>] and RR TYPEs [<a href="#ref-rrtypes" title=""Resource Record (RR) TYPEs"">rrtypes</a>]. See
<a href="#section-6.2.2">Section 6.2.2</a>.
o Flags indicating, for example, whether the data is sampled or
anonymized. See Sections <a href="#section-6.2.3">6.2.3</a> and <a href="#section-14">14</a>.
o Client and server IPv4 and IPv6 address prefixes. See
<a href="#section-6.2.4">Section 6.2.4</a>.
<span class="h4"><a class="selflink" id="section-6.2.1" href="#section-6.2.1">6.2.1</a>. Optional Data Items</span>
To enable implementations to store data to their precise requirements
in as space-efficient a manner as possible, all fields in the
following arrays are optional:
o Query/Response
o Query Signature
o Malformed Messages
In other words, an implementation can choose to omit any data item
that is not required for its use case (whilst observing the
restrictions relating to IP address storage described in
<a href="#section-6.2.4">Section 6.2.4</a>). In addition, implementations may be configured to
not record all RRs or to only record messages with certain OPCODES.
This does, however, mean that a consumer of a C-DNS file faces two
problems:
1. How can it quickly determine if a file definitely does not
contain the data items it requires to complete a particular task
(e.g., reconstructing DNS traffic or performing a specific piece
of data analysis)?
2. How can it determine whether a data item is not present because
it was (1) explicitly not recorded or (2) not available/present?
For example, capturing C-DNS data from within a name server
implementation makes it unlikely that the Client Hoplimit can be
recorded. Or, if there is no Query ARCOUNT recorded and no Query OPT
RDATA [<a href="./rfc6891" title=""Extension Mechanisms for DNS (EDNS(0))"">RFC6891</a>] recorded, is that because no Query contained an OPT
RR, or because that data was not stored?
The Storage Parameters item therefore also contains a Storage Hints
item, which specifies which items the encoder of the file omits from
the stored data and will therefore never be present. (This approach
is taken because a flag that indicated which items were included for
<span class="grey">Dickinson, et al. Standards Track [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
collection would not guarantee that the item was present -- only that
it might be.) An implementation decoding that file can then use
these flags to quickly determine whether the input data is not rich
enough for its needs.
One scenario where this may be particularly important is the case of
regenerating traffic. It is possible to collect such a small set of
data items that an implementation decoding the file cannot determine
if a given Query/Response data item was generated from just a Query,
just a Response, or a Query/Response pair. This makes it impossible
to reconstruct DNS traffic even if sensible defaults are provided for
the missing data items. This is discussed in more detail in
<a href="#section-9">Section 9</a>.
<span class="h4"><a class="selflink" id="section-6.2.2" href="#section-6.2.2">6.2.2</a>. Optional RRs and OPCODEs</span>
Also included in the Storage Parameters item are explicit arrays
listing the RR TYPEs and the OPCODEs to be recorded. These arrays
remove any ambiguity over whether, for example, messages containing
particular OPCODEs are not present because (1) certain OPCODEs did
not occur or (2) the implementation is not configured to record them.
In the case of OPCODEs, for a message to be fully parsable, the
OPCODE must be known to the collecting implementation. Any message
with an OPCODE unknown to the collecting implementation cannot be
validated as correctly formed and so must be treated as malformed.
Messages with OPCODES known to the recording application but not
listed in the Storage Parameters item are discarded by the recording
application during C-DNS capture (regardless of whether they are
malformed or not).
In the case of RRs, each record in a message must be fully parsable,
including parsing the record RDATA, as otherwise the message cannot
be validated as correctly formed. Any RR with an RR TYPE not known
to the collecting implementation cannot be validated as correctly
formed and so must be treated as malformed.
Once a message is correctly parsed, an implementation is free to
record only a subset of the RRs present.
<span class="grey">Dickinson, et al. Standards Track [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h4"><a class="selflink" id="section-6.2.3" href="#section-6.2.3">6.2.3</a>. Storage Flags</span>
The Storage Parameters item contains flags that can be used to
indicate if:
o the data is anonymized,
o the data is produced from sample data, or
o names in the data have been normalized (converted to uniform
case).
The Storage Parameters item also contains optional fields holding
details of the sampling method used and the anonymization method
used. It is RECOMMENDED that these fields contain URIs [<a href="./rfc3986" title=""Uniform Resource Identifier (URI): Generic Syntax"">RFC3986</a>]
pointing to resources describing the methods used. See <a href="#section-14">Section 14</a>
for further discussion of anonymization and normalization.
<span class="h4"><a class="selflink" id="section-6.2.4" href="#section-6.2.4">6.2.4</a>. IP Address Storage</span>
The format can store either full IP addresses or just IP prefixes;
the Storage Parameters item contains fields to indicate if only IP
prefixes were stored.
If the IP address prefixes are absent, then full addresses are
stored. In this case, the IP version can be directly inferred from
the stored address length and the fields "qr-transport-flags" in
QueryResponseSignature, "ae-transport-flags" in AddressEventCount,
and "mm-transport-flags" in MalformedMessageData (which contain the
IP version bit) are optional.
If IP address prefixes are given, only the prefix bits of addresses
are stored. In this case, in order to determine the IP version, the
fields "qr-transport-flags" in QueryResponseSignature, "ae-transport-
flags" in AddressEventCount, and "mm-transport-flags" in
MalformedMessageData MUST be present. See Sections <a href="#section-7.3.2.3.2">7.3.2.3.2</a> and
7.3.2.3.5.
As an example of storing only IP prefixes, if a client IPv6 prefix of
48 is specified, a client address of 2001:db8:85a3::8a2e:370:7334
will be stored as 0x20010db885a3, reducing address storage space
requirements. Similarly, if a client IPv4 prefix of 16 is specified,
a client address of 192.0.2.1 will be stored as 0xc000 (192.0).
<span class="grey">Dickinson, et al. Standards Track [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. C-DNS Format Detailed Description</span>
The CDDL definition for the C-DNS format is given in <a href="#appendix-A">Appendix A</a>.
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Map Quantities and Indexes</span>
All map keys are integers with values specified in the CDDL. String
keys would significantly bloat the file size.
All key values specified are positive integers under 24, so their
CBOR representation is a single byte. Positive integer values not
currently used as keys in a map are reserved for use in future
standard extensions.
Implementations may choose to add additional implementation-specific
entries to any map. Negative integer map keys are reserved for these
values. Key values from -1 to -24 also have a single-byte CBOR
representation, so such implementation-specific extensions are not at
any space efficiency disadvantage.
An item described as an index is the index of the data item in the
referenced array. Indexes are 0-based.
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Tabular Representation</span>
The following sections present the C-DNS specification in tabular
format with a detailed description of each item.
In all quantities that contain bit flags, bit 0 indicates the least
significant bit, i.e., flag "n" in quantity "q" is on if
"(q & (1 << n)) != 0".
For the sake of readability, all type and field names defined in the
CDDL definition are shown in double quotes. Type names are by
convention camel case (e.g., "BlockTables"), and field names are
lowercase with hyphens (e.g., "block-tables").
For the sake of brevity, the following conventions are used in the
tables:
o The column M marks whether items in a map are mandatory.
* X - Mandatory items.
* C - Conditionally mandatory items. Such items are usually
optional but may be mandatory in some configurations.
* If the column is empty, the item is optional.
<span class="grey">Dickinson, et al. Standards Track [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
o The column T gives the CBOR datatype of the item.
* U - Unsigned integer.
* I - Signed integer (i.e., either a CBOR unsigned integer or a
CBOR negative integer).
* B - Boolean.
* S - Byte string.
* T - Text string.
* M - Map.
* A - Array.
In the case of maps and arrays, more information on the type of each
value, including the CDDL definition name if applicable, is given in
the description.
<span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. "File"</span>
A C-DNS file has an outer structure "File", an array that contains
the following:
+---------------+---+---+-------------------------------------------+
| Field | M | T | Description |
+---------------+---+---+-------------------------------------------+
| file-type-id | X | T | String "C-DNS" identifying the file type. |
| | | | |
| file-preamble | X | M | Version and parameter information for the |
| | | | whole file. Map of type "FilePreamble"; |
| | | | see <a href="#section-7.3.1">Section 7.3.1</a>. |
| | | | |
| file-blocks | X | A | Array of items of type "Block"; see |
| | | | <a href="#section-7.3.2">Section 7.3.2</a>. The array may be empty if |
| | | | the file contains no data. |
+---------------+---+---+-------------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h4"><a class="selflink" id="section-7.3.1" href="#section-7.3.1">7.3.1</a>. "FilePreamble"</span>
Information about data in the file. A map containing the following:
+----------------------+---+---+------------------------------------+
| Field | M | T | Description |
+----------------------+---+---+------------------------------------+
| major-format-version | X | U | Unsigned integer "1". The major |
| | | | version of the format used in the |
| | | | file. See <a href="#section-8">Section 8</a>. |
| | | | |
| minor-format-version | X | U | Unsigned integer "0". The minor |
| | | | version of the format used in the |
| | | | file. See <a href="#section-8">Section 8</a>. |
| | | | |
| private-version | | U | Version indicator available for |
| | | | private use by implementations. |
| | | | |
| block-parameters | X | A | Array of items of type |
| | | | "BlockParameters". See Section |
| | | | 7.3.1.1. The array must contain |
| | | | at least one entry. (The |
| | | | "block-parameters-index" item in |
| | | | each "BlockPreamble" indicates |
| | | | which array entry applies to that |
| | | | "Block".) |
+----------------------+---+---+------------------------------------+
<span class="h5"><a class="selflink" id="section-7.3.1.1" href="#section-7.3.1.1">7.3.1.1</a>. "BlockParameters"</span>
Parameters relating to data storage and collection that apply to one
or more items of type "Block". A map containing the following:
+-----------------------+---+---+-----------------------------------+
| Field | M | T | Description |
+-----------------------+---+---+-----------------------------------+
| storage-parameters | X | M | Parameters relating to data |
| | | | storage in a "Block" item. Map |
| | | | of type "StorageParameters"; see |
| | | | <a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a>. |
| | | | |
| collection-parameters | | M | Parameters relating to collection |
| | | | of the data in a "Block" item. |
| | | | Map of type |
| | | | "CollectionParameters"; see |
| | | | <a href="#section-7.3.1.1.2">Section 7.3.1.1.2</a>. |
+-----------------------+---+---+-----------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h6"><a class="selflink" id="section-7.3.1.1.1" href="#section-7.3.1.1.1">7.3.1.1.1</a>. "StorageParameters"</span>
Parameters relating to how data is stored in the items of type
"Block". A map containing the following:
+------------------+---+---+----------------------------------------+
| Field | M | T | Description |
+------------------+---+---+----------------------------------------+
| ticks-per-second | X | U | Sub-second timing is recorded in |
| | | | ticks. This specifies the number of |
| | | | ticks in a second. |
| | | | |
| max-block-items | X | U | The maximum number of items stored in |
| | | | any of the arrays in a "Block" item |
| | | | (Q/R, Address/Event Count, or |
| | | | Malformed Message data items). An |
| | | | indication to a decoder of the |
| | | | resources needed to process the file. |
| | | | |
| storage-hints | X | M | Collection of hints as to which fields |
| | | | are omitted in the arrays that have |
| | | | optional fields. Map of type |
| | | | "StorageHints". See Section |
| | | | 7.3.1.1.1.1. |
| | | | |
| opcodes | X | A | Array of OPCODES [<a href="#ref-opcodes" title=""DNS OpCodes"">opcodes</a>] (unsigned |
| | | | integers, each in the range 0 to 15 |
| | | | inclusive) recorded by the collecting |
| | | | implementation. See <a href="#section-6.2.2">Section 6.2.2</a>. |
| | | | |
| rr-types | X | A | Array of RR TYPEs [<a href="#ref-rrtypes" title=""Resource Record (RR) TYPEs"">rrtypes</a>] (unsigned |
| | | | integers, each in the range 0 to 65535 |
| | | | inclusive) recorded by the collecting |
| | | | implementation. See <a href="#section-6.2.2">Section 6.2.2</a>. |
| | | | |
| storage-flags | | U | Bit flags indicating attributes of |
| | | | stored data. |
| | | | Bit 0. 1 if the data has been |
| | | | anonymized. |
| | | | Bit 1. 1 if the data is sampled data. |
| | | | Bit 2. 1 if the names have been |
| | | | normalized (converted to uniform |
| | | | case). |
| | | | |
| client-address | | U | IPv4 client address prefix length, in |
| -prefix-ipv4 | | | the range 1 to 32 inclusive. If |
| | | | specified, only the address prefix |
| | | | bits are stored. |
<span class="grey">Dickinson, et al. Standards Track [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| | | | |
| client-address | | U | IPv6 client address prefix length, in |
| -prefix-ipv6 | | | the range 1 to 128 inclusive. If |
| | | | specified, only the address prefix |
| | | | bits are stored. |
| | | | |
| server-address | | U | IPv4 server address prefix length, in |
| -prefix-ipv4 | | | the range 1 to 32 inclusive. If |
| | | | specified, only the address prefix |
| | | | bits are stored. |
| | | | |
| server-address | | U | IPv6 server address prefix length, in |
| -prefix-ipv6 | | | the range 1 to 128 inclusive. If |
| | | | specified, only the address prefix |
| | | | bits are stored. |
| | | | |
| sampling-method | | T | Information on the sampling method |
| | | | used. See <a href="#section-6.2.3">Section 6.2.3</a>. |
| | | | |
| anonymization | | T | Information on the anonymization |
| -method | | | method used. See <a href="#section-6.2.3">Section 6.2.3</a>. |
+------------------+---+---+----------------------------------------+
<span class="h6"><a class="selflink" id="section-7.3.1.1.1.1" href="#section-7.3.1.1.1.1">7.3.1.1.1.1</a>. "StorageHints"</span>
An indicator of which fields the collecting implementation omits in
the maps with optional fields. Note that hints have a top-down
precedence. In other words, where a map contains another map, the
hint on the containing map overrides any hints in the contained map
and the contained map is omitted. A map containing the following:
+------------------+---+---+----------------------------------------+
| Field | M | T | Description |
+------------------+---+---+----------------------------------------+
| query-response | X | U | Hints indicating which "QueryResponse" |
| -hints | | | fields are omitted; see Section |
| | | | 7.3.2.4. If a bit is unset, the field |
| | | | is omitted from the capture. |
| | | | Bit 0. time-offset |
| | | | Bit 1. client-address-index |
| | | | Bit 2. client-port |
| | | | Bit 3. transaction-id |
| | | | Bit 4. qr-signature-index |
| | | | Bit 5. client-hoplimit |
| | | | Bit 6. response-delay |
| | | | Bit 7. query-name-index |
| | | | Bit 8. query-size |
| | | | Bit 9. response-size |
<span class="grey">Dickinson, et al. Standards Track [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| | | | Bit 10. response-processing-data |
| | | | Bit 11. query-question-sections |
| | | | Bit 12. query-answer-sections |
| | | | Bit 13. query-authority-sections |
| | | | Bit 14. query-additional-sections |
| | | | Bit 15. response-answer-sections |
| | | | Bit 16. response-authority-sections |
| | | | Bit 17. response-additional-sections |
| | | | |
| query-response | X | U | Hints indicating which |
| -signature-hints | | | "QueryResponseSignature" fields are |
| | | | omitted; see <a href="#section-7.3.2.3.2">Section 7.3.2.3.2</a>. If a |
| | | | bit is unset, the field is omitted |
| | | | from the capture. |
| | | | Bit 0. server-address-index |
| | | | Bit 1. server-port |
| | | | Bit 2. qr-transport-flags |
| | | | Bit 3. qr-type |
| | | | Bit 4. qr-sig-flags |
| | | | Bit 5. query-opcode |
| | | | Bit 6. qr-dns-flags |
| | | | Bit 7. query-rcode |
| | | | Bit 8. query-classtype-index |
| | | | Bit 9. query-qdcount |
| | | | Bit 10. query-ancount |
| | | | Bit 11. query-nscount |
| | | | Bit 12. query-arcount |
| | | | Bit 13. query-edns-version |
| | | | Bit 14. query-udp-size |
| | | | Bit 15. query-opt-rdata-index |
| | | | Bit 16. response-rcode |
| | | | |
| rr-hints | X | U | Hints indicating which optional "RR" |
| | | | fields are omitted; see Section |
| | | | 7.3.2.3.4. If a bit is unset, the |
| | | | field is omitted from the capture. |
| | | | Bit 0. ttl |
| | | | Bit 1. rdata-index |
| other-data-hints | X | U | Hints indicating which other datatypes |
| | | | are omitted. If a bit is unset, the |
| | | | datatype is omitted from the capture. |
| | | | Bit 0. malformed-messages |
| | | | Bit 1. address-event-counts |
+------------------+---+---+----------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h6"><a class="selflink" id="section-7.3.1.1.2" href="#section-7.3.1.1.2">7.3.1.1.2</a>. "CollectionParameters"</span>
Parameters providing information regarding how data in the file was
collected (applicable for some, but not all, collection
environments). The values are informational only and serve as
metadata to downstream analyzers as to the configuration of a
collecting implementation. They can provide context when
interpreting what data is present/absent from the capture but cannot
necessarily be validated against the data captured.
These parameters have no default. If they do not appear, nothing can
be inferred about their value.
A map containing the following items:
+------------------+---+---+----------------------------------------+
| Field | M | T | Description |
+------------------+---+---+----------------------------------------+
| query-timeout | | U | To be matched with a Query, a Response |
| | | | must arrive within this number of |
| | | | milliseconds. |
| | | | |
| skew-timeout | | U | The network stack may report a |
| | | | Response before the corresponding |
| | | | Query. A Response is not considered |
| | | | to be missing a Query until after this |
| | | | many microseconds. |
| | | | |
| snaplen | | U | Collect up to this many bytes per |
| | | | packet. |
| | | | |
| promisc | | B | "true" if promiscuous mode |
| | | | [<a href="#ref-pcap-options">pcap-options</a>] was enabled on the |
| | | | interface, "false" otherwise. |
| | | | |
| interfaces | | A | Array of identifiers (of type text |
| | | | string) of the interfaces used for |
| | | | collection. |
| | | | |
| server-addresses | | A | Array of server collection IP |
| | | | addresses (of type byte string). |
| | | | Metadata for downstream analyzers; |
| | | | does not affect collection. |
| | | | |
<span class="grey">Dickinson, et al. Standards Track [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| vlan-ids | | A | Array of identifiers (of type unsigned |
| | | | integer, each in the range 1 to 4094 |
| | | | inclusive) of VLANs [<a href="#ref-IEEE802.1Q">IEEE802.1Q</a>] |
| | | | selected for collection. VLAN IDs are |
| | | | unique only within an administrative |
| | | | domain. |
| | | | |
| filter | | T | Filter for input, in "tcpdump" |
| | | | [<a href="#ref-pcap-filter">pcap-filter</a>] style. |
| | | | |
| generator-id | | T | Implementation-specific human-readable |
| | | | string identifying the collection |
| | | | method. |
| | | | |
| host-id | | T | String identifying the collecting |
| | | | host. |
+------------------+---+---+----------------------------------------+
<span class="h4"><a class="selflink" id="section-7.3.2" href="#section-7.3.2">7.3.2</a>. "Block"</span>
Container for data with common collection and storage parameters. A
map containing the following:
+--------------------+---+---+--------------------------------------+
| Field | M | T | Description |
+--------------------+---+---+--------------------------------------+
| block-preamble | X | M | Overall information for the "Block" |
| | | | item. Map of type "BlockPreamble"; |
| | | | see <a href="#section-7.3.2.1">Section 7.3.2.1</a>. |
| | | | |
| block-statistics | | M | Statistics about the "Block" item. |
| | | | Map of type "BlockStatistics"; see |
| | | | <a href="#section-7.3.2.2">Section 7.3.2.2</a>. |
| | | | |
| block-tables | | M | The arrays containing data |
| | | | referenced by individual |
| | | | "QueryResponse" or |
| | | | "MalformedMessage" items. Map of |
| | | | type "BlockTables"; see Section |
| | | | 7.3.2.3. |
| | | | |
| query-responses | | A | Details of individual C-DNS Q/R data |
| | | | items. Array of items of type |
| | | | "QueryResponse"; see Section |
| | | | 7.3.2.4. If present, the array must |
| | | | not be empty. |
| | | | |
<span class="grey">Dickinson, et al. Standards Track [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| address-event | | A | Per-client counts of ICMP messages |
| -counts | | | and TCP resets. Array of items of |
| | | | type "AddressEventCount"; see |
| | | | <a href="#section-7.3.2.5">Section 7.3.2.5</a>. If present, the |
| | | | array must not be empty. |
| | | | |
| malformed-messages | | A | Details of malformed DNS messages. |
| | | | Array of items of type |
| | | | "MalformedMessage"; see Section |
| | | | 7.3.2.6. If present, the array must |
| | | | not be empty. |
+--------------------+---+---+--------------------------------------+
<span class="h5"><a class="selflink" id="section-7.3.2.1" href="#section-7.3.2.1">7.3.2.1</a>. "BlockPreamble"</span>
Overall information for a "Block" item. A map containing the
following:
+------------------+---+---+----------------------------------------+
| Field | M | T | Description |
+------------------+---+---+----------------------------------------+
| earliest-time | C | A | A timestamp (two unsigned integers, of |
| | | | type "Timestamp") for the earliest |
| | | | record in the "Block" item. The first |
| | | | integer is the number of seconds since |
| | | | the POSIX epoch [<a href="#ref-posix-time">posix-time</a>] |
| | | | ("time_t"), excluding leap seconds. |
| | | | The second integer is the number of |
| | | | ticks (see <a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a>) since |
| | | | the start of the second. This field |
| | | | is mandatory unless all block items |
| | | | containing a time offset from the |
| | | | start of the Block also omit that time |
| | | | offset. |
| | | | |
| block-parameters | | U | The index of the item in the |
| -index | | | "block-parameters" array (in the |
| | | | "file-preamble" item) applicable to |
| | | | this block. If not present, index 0 |
| | | | is used. See <a href="#section-7.3.1">Section 7.3.1</a>. |
+------------------+---+---+----------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h5"><a class="selflink" id="section-7.3.2.2" href="#section-7.3.2.2">7.3.2.2</a>. "BlockStatistics"</span>
Basic statistical information about a "Block" item. A map containing
the following:
+---------------------+---+---+-------------------------------------+
| Field | M | T | Description |
+---------------------+---+---+-------------------------------------+
| processed-messages | | U | Total number of well-formed DNS |
| | | | messages processed from the input |
| | | | traffic stream during collection of |
| | | | data in this "Block" item. |
| | | | |
| qr-data-items | | U | Total number of Q/R data items in |
| | | | this "Block" item. |
| | | | |
| unmatched-queries | | U | Number of unmatched Queries in this |
| | | | "Block" item. |
| | | | |
| unmatched-responses | | U | Number of unmatched Responses in |
| | | | this "Block" item. |
| | | | |
| discarded-opcode | | U | Number of DNS messages processed |
| | | | from the input traffic stream |
| | | | during collection of data in this |
| | | | "Block" item but not recorded |
| | | | because their OPCODE is not in the |
| | | | list to be collected. |
| | | | |
| malformed-items | | U | Number of malformed messages |
| | | | processed from the input traffic |
| | | | stream during collection of data in |
| | | | this "Block" item. |
+---------------------+---+---+-------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h5"><a class="selflink" id="section-7.3.2.3" href="#section-7.3.2.3">7.3.2.3</a>. "BlockTables"</span>
Map of arrays containing data referenced by individual
"QueryResponse" or "MalformedMessage" items in this "Block". Each
element is an array that, if present, must not be empty.
An item in the "qlist" array contains indexes to values in the "qrr"
array. Therefore, if "qlist" is present, "qrr" must also be present.
Similarly, if "rrlist" is present, "rr" must also be present.
The map contains the following items:
+-------------------+---+---+---------------------------------------+
| Field | M | T | Description |
+-------------------+---+---+---------------------------------------+
| ip-address | | A | Array of IP addresses, in network |
| | | | byte order (of type byte string). If |
| | | | client or server address prefixes are |
| | | | set, only the address prefix bits are |
| | | | stored. Each string is therefore up |
| | | | to 4 bytes long for an IPv4 address, |
| | | | or up to 16 bytes long for an IPv6 |
| | | | address. See <a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a>. |
| | | | |
| classtype | | A | Array of RR CLASS and TYPE |
| | | | information. Type is "ClassType". |
| | | | See <a href="#section-7.3.2.3.1">Section 7.3.2.3.1</a>. |
| | | | |
| name-rdata | | A | Array where each entry is the |
| | | | contents of a single NAME or RDATA in |
| | | | wire format (of type byte string). |
| | | | Note that NAMEs, and labels within |
| | | | RDATA contents, are full domain names |
| | | | or labels; no name compression (per |
| | | | [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>]) is used on the individual |
| | | | names/labels within the format. |
| | | | |
| qr-sig | | A | Array of Q/R data item signatures. |
| | | | Type is "QueryResponseSignature". |
| | | | See <a href="#section-7.3.2.3.2">Section 7.3.2.3.2</a>. |
| | | | |
| qlist | | A | Array of type "QuestionList". A |
| | | | "QuestionList" is an array of |
| | | | unsigned integers, indexes to |
| | | | "Question" items in the "qrr" array. |
| | | | |
<span class="grey">Dickinson, et al. Standards Track [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| qrr | | A | Array of type "Question". Each entry |
| | | | is the contents of a single Question, |
| | | | where a Question is the second or |
| | | | subsequent Question in a Query. See |
| | | | <a href="#section-7.3.2.3.3">Section 7.3.2.3.3</a>. |
| | | | |
| rrlist | | A | Array of type "RRList". An "RRList" |
| | | | is an array of unsigned integers, |
| | | | indexes to "RR" items in the "rr" |
| | | | array. |
| | | | |
| rr | | A | Array of type "RR". Each entry is |
| | | | the contents of a single RR. See |
| | | | <a href="#section-7.3.2.3.4">Section 7.3.2.3.4</a>. |
| | | | |
| malformed-message | | A | Array of the contents of malformed |
| -data | | | messages. Array of type |
| | | | "MalformedMessageData". See Section |
| | | | 7.3.2.3.5. |
+-------------------+---+---+---------------------------------------+
<span class="h6"><a class="selflink" id="section-7.3.2.3.1" href="#section-7.3.2.3.1">7.3.2.3.1</a>. "ClassType"</span>
RR CLASS and TYPE information. A map containing the following:
+-------+---+---+--------------------------+
| Field | M | T | Description |
+-------+---+---+--------------------------+
| type | X | U | TYPE value [<a href="#ref-rrtypes" title=""Resource Record (RR) TYPEs"">rrtypes</a>]. |
| | | | |
| class | X | U | CLASS value [<a href="#ref-rrclasses">rrclasses</a>]. |
+-------+---+---+--------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h6"><a class="selflink" id="section-7.3.2.3.2" href="#section-7.3.2.3.2">7.3.2.3.2</a>. "QueryResponseSignature"</span>
Elements of a Q/R data item that are often common between multiple
individual Q/R data items. A map containing the following:
+--------------------+---+---+--------------------------------------+
| Field | M | T | Description |
+--------------------+---+---+--------------------------------------+
| server-address | | U | The index in the "ip-address" array |
| -index | | | of the server IP address. See |
| | | | <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| server-port | | U | The server port. |
| | | | |
| qr-transport-flags | C | U | Bit flags describing the transport |
| | | | used to service the Query. Same |
| | | | definition as "mm-transport-flags" |
| | | | in <a href="#section-7.3.2.3.5">Section 7.3.2.3.5</a>, with an |
| | | | additional indicator for trailing |
| | | | bytes. See <a href="#appendix-A">Appendix A</a>. |
| | | | Bit 0. IP version. 0 if IPv4, 1 if |
| | | | IPv6. See <a href="#section-6.2.4">Section 6.2.4</a>. |
| | | | Bits 1-4. Transport. 4-bit |
| | | | unsigned value where |
| | | | 0 = UDP [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] |
| | | | 1 = TCP [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] |
| | | | 2 = TLS [<a href="./rfc7858" title=""Specification for DNS over Transport Layer Security (TLS)"">RFC7858</a>] |
| | | | 3 = DTLS [<a href="./rfc8094" title=""DNS over Datagram Transport Layer Security (DTLS)"">RFC8094</a>] |
| | | | 4 = HTTPS [<a href="./rfc8484" title=""DNS Queries over HTTPS (DoH)"">RFC8484</a>] |
| | | | 15 = Non-standard transport (see |
| | | | below) |
| | | | Values 5-14 are reserved for future |
| | | | use. |
| | | | Bit 5. 1 if trailing bytes in Query |
| | | | packet. See <a href="#section-11.2">Section 11.2</a>. |
| | | | |
| qr-type | | U | Type of Query/Response transaction |
| | | | based on the definitions in the |
| | | | dnstap schema [<a href="#ref-dnstap-schema">dnstap-schema</a>]. |
| | | | 0 = Stub. A transaction between a |
| | | | stub resolver and a DNS server from |
| | | | the perspective of the stub |
| | | | resolver. |
| | | | 1 = Client. A transaction between a |
| | | | client and a DNS server (a proxy or |
| | | | full recursive resolver) from the |
| | | | perspective of the DNS server. |
<span class="grey">Dickinson, et al. Standards Track [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| | | | 2 = Resolver. A transaction between |
| | | | a recursive resolver and an |
| | | | authoritative server from the |
| | | | perspective of the recursive |
| | | | resolver. |
| | | | 3 = Authoritative. A transaction |
| | | | between a recursive resolver and an |
| | | | authoritative server from the |
| | | | perspective of the authoritative |
| | | | server. |
| | | | 4 = Forwarder. A transaction |
| | | | between a downstream forwarder and |
| | | | an upstream DNS server (a recursive |
| | | | resolver) from the perspective of |
| | | | the downstream forwarder. |
| | | | 5 = Tool. A transaction between a |
| | | | DNS software tool and a DNS server, |
| | | | from the perspective of the tool. |
| | | | |
| qr-sig-flags | | U | Bit flags explicitly indicating |
| | | | attributes of the message pair |
| | | | represented by this Q/R data item |
| | | | (not all attributes may be recorded |
| | | | or deducible). |
| | | | Bit 0. 1 if a Query was present. |
| | | | Bit 1. 1 if a Response was present. |
| | | | Bit 2. 1 if a Query was present and |
| | | | it had an OPT RR. |
| | | | Bit 3. 1 if a Response was present |
| | | | and it had an OPT RR. |
| | | | Bit 4. 1 if a Query was present but |
| | | | had no Question. |
| | | | Bit 5. 1 if a Response was present |
| | | | but had no Question (only one |
| | | | query-name-index is stored per Q/R |
| | | | data item). |
| | | | |
| query-opcode | | U | Query OPCODE. |
| | | | |
| qr-dns-flags | | U | Bit flags with values from the Query |
| | | | and Response DNS flags. Flag values |
| | | | are 0 if the Query or Response is |
| | | | not present. |
| | | | Bit 0. Query Checking Disabled |
| | | | (CD). |
| | | | Bit 1. Query Authenticated Data |
| | | | (AD). |
| | | | Bit 2. Query reserved (Z). |
<span class="grey">Dickinson, et al. Standards Track [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| | | | Bit 3. Query Recursion Available |
| | | | (RA). |
| | | | Bit 4. Query Recursion Desired |
| | | | (RD). |
| | | | Bit 5. Query TrunCation (TC). |
| | | | Bit 6. Query Authoritative Answer |
| | | | (AA). |
| | | | Bit 7. Query DNSSEC answer OK (DO). |
| | | | Bit 8. Response Checking Disabled |
| | | | (CD). |
| | | | Bit 9. Response Authenticated Data |
| | | | (AD). |
| | | | Bit 10. Response reserved (Z). |
| | | | Bit 11. Response Recursion |
| | | | Available (RA). |
| | | | Bit 12. Response Recursion Desired |
| | | | (RD). |
| | | | Bit 13. Response TrunCation (TC). |
| | | | Bit 14. Response Authoritative |
| | | | Answer (AA). |
| | | | |
| query-rcode | | U | Query RCODE. If the Query contains |
| | | | an OPT RR [<a href="./rfc6891" title=""Extension Mechanisms for DNS (EDNS(0))"">RFC6891</a>], this value |
| | | | incorporates any EXTENDED-RCODE |
| | | | value [<a href="#ref-rcodes" title=""DNS RCODEs"">rcodes</a>]. |
| | | | |
| query-classtype | | U | The index in the "classtype" array |
| -index | | | of the CLASS and TYPE of the first |
| | | | Question. See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| query-qdcount | | U | The QDCOUNT in the Query, or |
| | | | Response if no Query present. |
| | | | |
| query-ancount | | U | Query ANCOUNT. |
| | | | |
| query-nscount | | U | Query NSCOUNT. |
| | | | |
| query-arcount | | U | Query ARCOUNT. |
| | | | |
| query-edns-version | | U | The Query EDNS version. ("EDNS" |
| | | | stands for Extension Mechanisms for |
| | | | DNS.) |
| | | | |
| query-udp-size | | U | The Query EDNS sender's UDP payload |
| | | | size. |
| | | | |
<span class="grey">Dickinson, et al. Standards Track [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| query-opt-rdata | | U | The index in the "name-rdata" array |
| -index | | | of the OPT RDATA. See Section |
| | | | 7.3.2.3. |
| | | | |
| response-rcode | | U | Response RCODE. If the Response |
| | | | contains an OPT RR [<a href="./rfc6891" title=""Extension Mechanisms for DNS (EDNS(0))"">RFC6891</a>], this |
| | | | value incorporates any EXTENDED- |
| | | | RCODE value [<a href="#ref-rcodes" title=""DNS RCODEs"">rcodes</a>]. |
+--------------------+---+---+--------------------------------------+
Version 1.0 of C-DNS supports transport values corresponding to DNS
transports defined in IETF Standards Track documents at the time of
writing. There are numerous non-standard methods of sending DNS
messages over various transports using a variety of protocols, but
they are out of scope for this document. With the current
specification, these can be generically stored using value 15
(Non-standard transport), or implementations are free to use the
negative integer map keys to define their own mappings. Such
non-standard transports may also be the subject of a future extension
to the specification.
<span class="h6"><a class="selflink" id="section-7.3.2.3.3" href="#section-7.3.2.3.3">7.3.2.3.3</a>. "Question"</span>
Details on individual Questions in a Question section. A map
containing the following:
+-----------------+---+---+-----------------------------------------+
| Field | M | T | Description |
+-----------------+---+---+-----------------------------------------+
| name-index | X | U | The index in the "name-rdata" array of |
| | | | the QNAME. See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| classtype-index | X | U | The index in the "classtype" array of |
| | | | the CLASS and TYPE of the Question. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
+-----------------+---+---+-----------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h6"><a class="selflink" id="section-7.3.2.3.4" href="#section-7.3.2.3.4">7.3.2.3.4</a>. "RR"</span>
Details on individual RRs in RR sections. A map containing the
following:
+-----------------+---+---+-----------------------------------------+
| Field | M | T | Description |
+-----------------+---+---+-----------------------------------------+
| name-index | X | U | The index in the "name-rdata" array of |
| | | | the NAME. See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| classtype-index | X | U | The index in the "classtype" array of |
| | | | the CLASS and TYPE of the RR. See |
| | | | <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| ttl | | U | The RR Time to Live. |
| | | | |
| rdata-index | | U | The index in the "name-rdata" array of |
| | | | the RR RDATA. See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
+-----------------+---+---+-----------------------------------------+
<span class="h6"><a class="selflink" id="section-7.3.2.3.5" href="#section-7.3.2.3.5">7.3.2.3.5</a>. "MalformedMessageData"</span>
Details on malformed DNS messages stored in this "Block" item. A map
containing the following:
+--------------------+---+---+--------------------------------------+
| Field | M | T | Description |
+--------------------+---+---+--------------------------------------+
| server-address | | U | The index in the "ip-address" array |
| -index | | | of the server IP address. See |
| | | | <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| server-port | | U | The server port. |
| | | | |
| mm-transport-flags | C | U | Bit flags describing the transport |
| | | | used to service the Query. See |
| | | | <a href="#section-6.2.4">Section 6.2.4</a>. |
| | | | Bits 1-4. Transport. 4-bit |
| | | | unsigned value where |
| | | | 0 = UDP [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] |
| | | | 1 = TCP [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] |
| | | | 2 = TLS [<a href="./rfc7858" title=""Specification for DNS over Transport Layer Security (TLS)"">RFC7858</a>] |
| | | | 3 = DTLS [<a href="./rfc8094" title=""DNS over Datagram Transport Layer Security (DTLS)"">RFC8094</a>] |
| | | | 4 = HTTPS [<a href="./rfc8484" title=""DNS Queries over HTTPS (DoH)"">RFC8484</a>] |
| | | | 15 = Non-standard transport |
| | | | Values 5-14 are reserved for future |
| | | | use. |
<span class="grey">Dickinson, et al. Standards Track [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| | | | |
| mm-payload | | S | The payload (raw bytes) of the DNS |
| | | | message. |
+--------------------+---+---+--------------------------------------+
<span class="h5"><a class="selflink" id="section-7.3.2.4" href="#section-7.3.2.4">7.3.2.4</a>. "QueryResponse"</span>
Details on individual Q/R data items.
Note that there is no requirement that the elements of the
"query-responses" array are presented in strict chronological order.
A map containing the following items:
+----------------------+---+---+------------------------------------+
| Field | M | T | Description |
+----------------------+---+---+------------------------------------+
| time-offset | | U | Q/R timestamp as an offset in |
| | | | ticks (see <a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a>) from |
| | | | "earliest-time". The timestamp is |
| | | | the timestamp of the Query, or the |
| | | | Response if there is no Query. |
| | | | |
| client-address-index | | U | The index in the "ip-address" |
| | | | array of the client IP address. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| client-port | | U | The client port. |
| | | | |
| transaction-id | | U | DNS transaction identifier. |
| | | | |
| qr-signature-index | | U | The index in the "qr-sig" array of |
| | | | the "QueryResponseSignature" item. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| client-hoplimit | | U | The IPv4 TTL or IPv6 Hoplimit from |
| | | | the Query packet. |
| | | | |
| response-delay | | I | The time difference between Query |
| | | | and Response, in ticks. See |
| | | | <a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a>. Only present |
| | | | if there is a Query and a |
| | | | Response. The delay can be |
| | | | negative if the network |
| | | | stack/capture library returns |
| | | | packets out of order. |
| | | | |
<span class="grey">Dickinson, et al. Standards Track [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| query-name-index | | U | The index in the "name-rdata" |
| | | | array of the item containing the |
| | | | QNAME for the first Question. See |
| | | | <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| query-size | | U | DNS Query message size (see |
| | | | below). |
| | | | |
| response-size | | U | DNS Response message size (see |
| | | | below). |
| | | | |
| response-processing | | M | Data on Response processing. Map |
| -data | | | of type "ResponseProcessingData". |
| | | | See <a href="#section-7.3.2.4.1">Section 7.3.2.4.1</a>. |
| | | | |
| query-extended | | M | Extended Query data. Map of type |
| | | | "QueryResponseExtended". See |
| | | | <a href="#section-7.3.2.4.2">Section 7.3.2.4.2</a>. |
| | | | |
| response-extended | | M | Extended Response data. Map of |
| | | | type "QueryResponseExtended". See |
| | | | <a href="#section-7.3.2.4.2">Section 7.3.2.4.2</a>. |
+----------------------+---+---+------------------------------------+
The "query-size" and "response-size" fields hold the DNS message
size. For UDP, this is the size of the UDP payload that contained
the DNS message. For TCP, it is the size of the DNS message as
specified in the two-byte message length header. Trailing bytes in
UDP Queries are routinely observed in traffic to authoritative
servers, and this value allows a calculation of how many trailing
bytes were present.
<span class="h6"><a class="selflink" id="section-7.3.2.4.1" href="#section-7.3.2.4.1">7.3.2.4.1</a>. "ResponseProcessingData"</span>
Information on the server processing that produced the Response. A
map containing the following:
+------------------+---+---+----------------------------------------+
| Field | M | T | Description |
+------------------+---+---+----------------------------------------+
| bailiwick-index | | U | The index in the "name-rdata" array of |
| | | | the owner name for the Response |
| | | | bailiwick. See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| processing-flags | | U | Flags relating to Response processing. |
| | | | Bit 0. 1 if the Response came from |
| | | | cache. |
+------------------+---+---+----------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h6"><a class="selflink" id="section-7.3.2.4.2" href="#section-7.3.2.4.2">7.3.2.4.2</a>. "QueryResponseExtended"</span>
Extended data on the Q/R data item.
Each item in the map is present only if collection of the relevant
details is configured.
A map containing the following items:
+------------------+---+---+----------------------------------------+
| Field | M | T | Description |
+------------------+---+---+----------------------------------------+
| question-index | | U | The index in the "qlist" array of the |
| | | | entry listing any second and |
| | | | subsequent Questions in the Question |
| | | | section for the Query or Response. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| answer-index | | U | The index in the "rrlist" array of the |
| | | | entry listing the Answer RR sections |
| | | | for the Query or Response. See |
| | | | <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| authority-index | | U | The index in the "rrlist" array of the |
| | | | entry listing the Authority RR |
| | | | sections for the Query or Response. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| additional-index | | U | The index in the "rrlist" array of the |
| | | | entry listing the Additional RR |
| | | | sections for the Query or Response. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. Note that Query |
| | | | OPT RR data can optionally be stored |
| | | | in the QuerySignature. |
+------------------+---+---+----------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h5"><a class="selflink" id="section-7.3.2.5" href="#section-7.3.2.5">7.3.2.5</a>. "AddressEventCount"</span>
Counts of various IP-related events relating to traffic with
individual client addresses. A map containing the following:
+--------------------+---+---+--------------------------------------+
| Field | M | T | Description |
+--------------------+---+---+--------------------------------------+
| ae-type | X | U | The type of event. The following |
| | | | event types are currently defined: |
| | | | 0. TCP reset. |
| | | | 1. ICMP time exceeded. |
| | | | 2. ICMP destination unreachable. |
| | | | 3. ICMPv6 time exceeded. |
| | | | 4. ICMPv6 destination unreachable. |
| | | | 5. ICMPv6 packet too big. |
| | | | |
| ae-code | | U | A code relating to the event. For |
| | | | ICMP or ICMPv6 events, this MUST be |
| | | | the ICMP [<a href="./rfc792" title=""Internet Control Message Protocol"">RFC792</a>] or ICMPv6 |
| | | | [<a href="./rfc4443" title=""Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification"">RFC4443</a>] code. For other events, |
| | | | the contents are undefined. |
| | | | |
| ae-transport-flags | C | U | Bit flags describing the transport |
| | | | used to service the event. See |
| | | | <a href="#section-6.2.4">Section 6.2.4</a>. |
| | | | Bit 0. IP version. 0 if IPv4, 1 if |
| | | | IPv6. |
| | | | Bits 1-4. Transport. 4-bit |
| | | | unsigned value where |
| | | | 0 = UDP [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] |
| | | | 1 = TCP [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] |
| | | | 2 = TLS [<a href="./rfc7858" title=""Specification for DNS over Transport Layer Security (TLS)"">RFC7858</a>] |
| | | | 3 = DTLS [<a href="./rfc8094" title=""DNS over Datagram Transport Layer Security (DTLS)"">RFC8094</a>] |
| | | | 4 = HTTPS [<a href="./rfc8484" title=""DNS Queries over HTTPS (DoH)"">RFC8484</a>] |
| | | | 15 = Non-standard transport |
| | | | Values 5-14 are reserved for future |
| | | | use. |
| | | | |
| ae-address-index | X | U | The index in the "ip-address" array |
| | | | of the client address. See Section |
| | | | 7.3.2.3. |
| | | | |
| ae-count | X | U | The number of occurrences of this |
| | | | event during the Block collection |
| | | | period. |
+--------------------+---+---+--------------------------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 38]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h5"><a class="selflink" id="section-7.3.2.6" href="#section-7.3.2.6">7.3.2.6</a>. "MalformedMessage"</span>
Details on Malformed Message data items. A map containing the
following:
+----------------------+---+---+------------------------------------+
| Field | M | T | Description |
+----------------------+---+---+------------------------------------+
| time-offset | | U | Message timestamp as an offset in |
| | | | ticks (see <a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a>) from |
| | | | "earliest-time". |
| | | | |
| client-address-index | | U | The index in the "ip-address" |
| | | | array of the client IP address. |
| | | | See <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
| | | | |
| client-port | | U | The client port. |
| | | | |
| message-data-index | | U | The index in the "malformed- |
| | | | message-data" array of the message |
| | | | data for this message. See |
| | | | <a href="#section-7.3.2.3">Section 7.3.2.3</a>. |
+----------------------+---+---+------------------------------------+
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Versioning</span>
The C-DNS File Preamble includes a file Format Version; a major and
minor version number are required fields. This document defines
version 1.0 of the C-DNS specification. This section describes the
intended use of these version numbers in future specifications.
It is noted that version 1.0 includes many optional fields;
therefore, consumers of version 1.0 should be inherently robust to
parsing files with variable data content.
Within a major version, a new minor version MUST be a strict superset
of the previous minor version, with no semantic changes to existing
fields. New keys MAY be added to existing maps, and new maps MAY be
added. A consumer capable of reading a particular major.minor
version MUST also be capable of reading all previous minor versions
of the same major version. It SHOULD also be capable of parsing all
subsequent minor versions, ignoring any keys or maps that it does not
recognize.
<span class="grey">Dickinson, et al. Standards Track [Page 39]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
A new major version indicates changes to the format that are not
backwards compatible with previous major versions. A consumer
capable of only reading a particular major version (greater than 1)
is neither required nor expected to be capable of reading a previous
major version.
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. C-DNS to PCAP</span>
It is usually possible to reconstruct PCAP files from the C-DNS
format in a lossy fashion. Some of the issues with reconstructing
both the DNS payload and the full packet stream are outlined here.
The reconstruction of well-formed DNS messages depends on two
factors:
1. Whether or not a particular subset of the optional fields were
captured in the C-DNS file, specifically the data fields
necessary to reconstruct a valid IP header and DNS payload for
both Query and Response (see <a href="#appendix-D.1">Appendix D.1</a>). Clearly, if not all
these data fields were captured, the reconstruction is likely to
be imperfect even if reasonable defaults are provided for the
reconstruction.
2. Whether or not at least one field was captured that unambiguously
identifies the Query/Response data item as containing just a
Query, just a Response, or a Query/Response pair. Obviously, the
qr-sig-flags defined in <a href="#section-7.3.2.3.2">Section 7.3.2.3.2</a> is such a field;
however, this field is optional. For more details, see
<a href="#appendix-D.2">Appendix D.2</a>.
It is noted again that simply having hints that indicate that certain
data fields were not omitted does not guarantee that those data
fields were actually captured. Therefore, the ability to reconstruct
PCAP data (in the absence of defaults) can in principle vary for each
record captured in a C-DNS file, and between Blocks that have
differing hints.
Even if all sections of the Response were captured, one cannot
reconstruct the DNS Response payload exactly, due to the fact that
some DNS names in the message on the wire may have been compressed.
<a href="#section-9.1">Section 9.1</a> discusses this in more detail.
<span class="grey">Dickinson, et al. Standards Track [Page 40]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
Some transport information is not captured in the C-DNS format. For
example, the following aspects of the original packet stream cannot
be reconstructed from the C-DNS format:
o IP fragmentation
o TCP stream information:
* Multiple DNS messages may have been sent in a single TCP
segment
* A DNS payload may have been split across multiple TCP segments
* Multiple DNS messages may have been sent on a single TCP
session
o TLS session information:
* TLS version or cipher suites
* TLS-related features such as TCP Fast Open (TFO) [<a href="./rfc7413" title=""TCP Fast Open"">RFC7413</a>] or
TLS session resumption [<a href="./rfc5077" title=""Transport Layer Security (TLS) Session Resumption without Server-Side State"">RFC5077</a>]
o DNS-over-HTTPS [<a href="./rfc8484" title=""DNS Queries over HTTPS (DoH)"">RFC8484</a>] message details:
* Whether the message used POST or GET
* HTTPS Headers
o Malformed DNS messages if the wire format is not recorded
o Any non-DNS messages that were in the original packet stream,
e.g., ICMP
Simple assumptions can be made on the reconstruction: fragmented and
DNS-over-TCP messages can be reconstructed into single packets, and a
single TCP session can be constructed for each TCP packet.
Additionally, if malformed messages and non-DNS packets are captured
separately, they can be merged with packet captures reconstructed
from C-DNS to produce a more complete packet stream.
<span class="grey">Dickinson, et al. Standards Track [Page 41]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="section-9.1" href="#section-9.1">9.1</a>. Name Compression</span>
All the names stored in the C-DNS format are full domain names; no
name compression (per [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>]) is used on the individual names
within the format. Therefore, when reconstructing a packet, name
compression must be used in order to reproduce the on-the-wire
representation of the packet.
Name compression per [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>] works by substituting trailing
sections of a name with a reference back to the occurrence of those
sections earlier in the message. Not all name server software uses
the same algorithm when compressing domain names within the
Responses. Some attempt maximum recompression at the expense of
runtime resources, others use heuristics to balance compression and
speed, and others use different rules for what is a valid compression
target.
This means that Responses to the same Query from different name
server software that match in terms of DNS payload content (header,
counts, RRs with name compression removed) do not necessarily match
byte for byte on the wire.
Therefore, it is not possible to ensure that the DNS Response payload
is reconstructed byte for byte from C-DNS data. However, it can at
least, in principle, be reconstructed to have the correct payload
length (since the original Response length is captured) if there is
enough knowledge of the commonly implemented name compression
algorithms. For example, a simplistic approach would be to try each
algorithm in turn to see if it reproduces the original length,
stopping at the first match. This would not guarantee that the
correct algorithm has been used, as it is possible to match the
length whilst still not matching the on-the-wire bytes; however,
without further information added to the C-DNS data, this is the best
that can be achieved.
<a href="#appendix-B">Appendix B</a> presents an example of two different compression
algorithms used by well-known name server software.
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Data Collection</span>
This section describes a non-normative proposed algorithm for the
processing of a captured stream of DNS Queries and Responses and
production of a stream of Q/R data items, matching Queries and
Responses where possible.
<span class="grey">Dickinson, et al. Standards Track [Page 42]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
For the purposes of this discussion, it is assumed that the input has
been preprocessed such that:
1. All IP fragmentation reassembly, TCP stream reassembly, and
so on, have already been performed.
2. Each message is associated with transport metadata required to
generate the Primary ID (see <a href="#section-10.2.1">Section 10.2.1</a>).
3. Each message has a well-formed DNS Header of 12 bytes, and (if
present) the first Question in the Question section can be parsed
to generate the Secondary ID (see below). As noted earlier, this
requirement can result in a malformed Query being removed in the
preprocessing stage, but the correctly formed Response with RCODE
of FORMERR being present.
DNS messages are processed in the order they are delivered to the
implementation.
It should be noted that packet capture libraries do not necessarily
provide packets in strict chronological order. This can, for
example, arise on multi-core platforms where packets arriving at a
network device are processed by different cores. On systems where
this behavior has been observed, the timestamps associated with each
packet are consistent; Queries always have a timestamp prior to the
Response timestamp. However, the order in which these packets appear
in the packet capture stream is not necessarily strictly
chronological; a Response can appear in the capture stream before the
Query that provoked the Response. For this discussion, this
non-chronological delivery is termed "skew".
In the presence of skew, Response packets can arrive for matching
before the corresponding Query. To avoid generating false instances
of Responses without a matching Query, and Queries without a matching
Response, the matching algorithm must take the possibility of skew
into account.
<span class="h3"><a class="selflink" id="section-10.1" href="#section-10.1">10.1</a>. Matching Algorithm</span>
A schematic representation of the algorithm for matching Q/R data
items is shown in Figure 3. It takes individual DNS Query or
Response messages as input, and it outputs matched Q/R data items.
The numbers in the figure identify matching operations listed in
Table 1. Specific details of the algorithm -- for example, queues,
timers, and identifiers -- are given in the following sections.
<span class="grey">Dickinson, et al. Standards Track [Page 43]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
.----------------------.
| Process next message |<------------------+
`----------------------' |
| |
+------------------------------+ |
| Generate message identifiers | |
+------------------------------+ |
| |
Response | Query |
+--------------< >---------------+ |
| | |
+--------------------+ +--------------------+ |
| Find earliest QR | | Create QR item (2) | |
| item in OFIFO (1) | +--------------------+ |
+--------------------+ | |
| +---------------+ |
Match | No match | Append new QR | |
+--------< >------+ | item to OFIFO | |
| | +---------------+ |
+-----------+ +--------+ | |
| Update QR | | Add to | +-------------------+ |
| item (3) | | RFIFO | | Find earliest QR | |
+-----------+ +--------+ | item in RFIFO (1) | |
| | +-------------------+ |
+-----------------+ | |
| | |
| +----------------+ Match | No match |
| | Remove R |-------< >-----+ |
| | from RFIFO (3) | | |
| +----------------+ | |
| | | |
+--------------+-----------------------+ |
| |
+----------------------------------------------+ |
| Update all timed-out (QT) OFIFO QR items (4) | |
+----------------------------------------------+ |
| |
+--------------------------------+ |
| Remove all timed-out (ST) R | |
| from RFIFO, create QR item (5) | |
+--------------------------------+ |
____________________|_______________________ |
/ / |
/ Remove all consecutive done entries from /-------+
/ front of OFIFO for further processing /
/____________________________________________/
<span class="grey">Dickinson, et al. Standards Track [Page 44]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
OFIFO = output FIFO containing Q/R data items (<a href="#section-10.6">Section 10.6</a>)
RFIFO = Response FIFO containing unmatched Response items
(<a href="#section-10.6">Section 10.6</a>)
QT = Query Timeout (<a href="#section-10.3">Section 10.3</a>)
ST = Skew Timeout (<a href="#section-10.3">Section 10.3</a>)
Figure 3: Query/Response Matching Algorithm
+-----------+-------------------------------------------+
| Reference | Operation |
+-----------+-------------------------------------------+
| (1) | Find earliest QR item in FIFO where: |
| | * QR.done = false |
| | * QR.Q.PrimaryID == R.PrimaryID |
| | and, if both QR.Q and R have SecondaryID: |
| | * QR.Q.SecondaryID == R.SecondaryID |
| | |
| (2) | Set: |
| | QR.Q := Q |
| | QR.R := nil |
| | QR.done := false |
| | |
| (3) | Set: |
| | QR.R := R |
| | QR.done := true |
| | |
| (4) | Set: |
| | QR.done := true |
| | |
| (5) | Set: |
| | QR.Q := nil |
| | QR.R := R |
| | QR.done := true |
+-----------+-------------------------------------------+
Table 1: Operations Used in the Matching Algorithm
<span class="h3"><a class="selflink" id="section-10.2" href="#section-10.2">10.2</a>. Message Identifiers</span>
<span class="h4"><a class="selflink" id="section-10.2.1" href="#section-10.2.1">10.2.1</a>. Primary ID (Required)</span>
A Primary ID is constructed for each message. It is composed of the
following data:
1. Source IP Address
2. Destination IP Address
<span class="grey">Dickinson, et al. Standards Track [Page 45]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
3. Source Port
4. Destination Port
5. Transport
6. DNS Message ID
<span class="h4"><a class="selflink" id="section-10.2.2" href="#section-10.2.2">10.2.2</a>. Secondary ID (Optional)</span>
If present, the first Question in the Question section is used as a
Secondary ID for each message. Note that there may be well-formed
DNS Queries that have a QDCOUNT of 0, and some Responses may have a
QDCOUNT of 0 (for example, Responses with RCODE=FORMERR or NOTIMP).
In this case, the Secondary ID is not used in matching.
<span class="h3"><a class="selflink" id="section-10.3" href="#section-10.3">10.3</a>. Algorithm Parameters</span>
1. Query Timeout (QT). A Query arrives with timestamp t1. If no
Response matching that Query has arrived before other input
arrives timestamped later than (t1 + QT), a Q/R data item
containing only a Query is recorded. The QT value is typically
on the order of 5 seconds.
2. Skew Timeout (ST). A Response arrives with timestamp t2. If a
Response has not been matched by a Query before input arrives
timestamped later than (t2 + ST), a Q/R data item containing only
a Response is recorded. The ST value is typically a few
microseconds.
<span class="h3"><a class="selflink" id="section-10.4" href="#section-10.4">10.4</a>. Algorithm Requirements</span>
The algorithm is designed to handle the following input data:
1. Multiple Queries with the same Primary ID (but different
Secondary ID) arriving before any Responses for these Queries
are seen.
2. Multiple Queries with the same Primary and Secondary ID arriving
before any Responses for these Queries are seen.
3. Queries for which no later Response can be found within the
specified timeout.
4. Responses for which no previous Query can be found within the
specified timeout.
<span class="grey">Dickinson, et al. Standards Track [Page 46]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="section-10.5" href="#section-10.5">10.5</a>. Algorithm Limitations</span>
For cases 1 and 2 listed in the above requirements, it is not
possible to unambiguously match Queries with Responses. This
algorithm chooses to match to the earliest Query with the correct
Primary and Secondary ID.
<span class="h3"><a class="selflink" id="section-10.6" href="#section-10.6">10.6</a>. Workspace</span>
The algorithm employs two FIFO queues:
o OFIFO: an output FIFO containing Q/R data items in chronological
order.
o RFIFO: a FIFO holding Responses without a matching Query in order
of arrival.
<span class="h3"><a class="selflink" id="section-10.7" href="#section-10.7">10.7</a>. Output</span>
The output is a list of Q/R data items. Both the Query and Response
elements are optional in these items; therefore, Q/R data items have
one of three types of content:
1. A matched pair of Query and Response messages
2. A Query message with no Response
3. A Response message with no Query
The timestamp of a list item is that of the Query for cases 1 and 2
and that of the Response for case 3.
<span class="h3"><a class="selflink" id="section-10.8" href="#section-10.8">10.8</a>. Post-Processing</span>
When ending a capture, all items in the RFIFO are timed out
immediately, generating Response only entries to the OFIFO. These
and all other remaining entries in the OFIFO should be treated as
timed-out Queries.
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. Implementation Guidance</span>
Whilst this document makes no specific recommendations with respect
to "Canonical CBOR" (see <a href="./rfc7049#section-3.9">Section 3.9 of [RFC7049]</a>), the following
guidance may be of use to implementers.
Adherence to the first two rules given in <a href="./rfc7049#section-3.9">Section 3.9 of [RFC7049]</a>
will minimize file sizes.
<span class="grey">Dickinson, et al. Standards Track [Page 47]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
Adherence to the last two rules given in <a href="./rfc7049#section-3.9">Section 3.9 of [RFC7049]</a> for
all maps and arrays would unacceptably constrain implementations --
for example, in the use case of real-time data collection in
constrained environments where outputting Block Tables after Q/R data
items and allowing indefinite-length maps and arrays could reduce
memory requirements.
It is recommended that implementations that have fundamental
restrictions on what data fields they can collect SHOULD always store
hints with the bits unset for those fields, i.e., they unambiguously
indicate that those data fields will be omitted from captured C-DNS.
<span class="h3"><a class="selflink" id="section-11.1" href="#section-11.1">11.1</a>. Optional Data</span>
When decoding C-DNS data, some of the items required for a particular
function that the consumer wishes to perform may be missing.
Consumers should consider providing configurable default values to be
used in place of the missing values in their output.
<span class="h3"><a class="selflink" id="section-11.2" href="#section-11.2">11.2</a>. Trailing Bytes</span>
A DNS Query message in a UDP or TCP payload can be followed by some
additional (spurious) bytes, which are not stored in C-DNS.
When DNS traffic is sent over TCP, each message is prefixed with a
two-byte length field, which gives the message length, excluding the
two-byte length field. In this context, trailing bytes can occur in
two circumstances, with different results:
1. The number of bytes consumed by fully parsing the message is less
than the number of bytes given in the length field (i.e., the
length field is incorrect and too large). In this case, the
surplus bytes are considered trailing bytes in a manner analogous
to UDP and recorded as such. If only this case occurs, it is
possible to process a packet containing multiple DNS messages
where one or more have trailing bytes.
2. There are surplus bytes between the end of a well-formed message
and the start of the length field for the next message. In this
case, the first of the surplus bytes will be processed as the
first byte of the next length field, and parsing will proceed
from there, almost certainly leading to the next and any
subsequent messages in the packet being considered malformed.
This will not generate a trailing-bytes record for the processed
well-formed message.
<span class="grey">Dickinson, et al. Standards Track [Page 48]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="section-11.3" href="#section-11.3">11.3</a>. Limiting Collection of RDATA</span>
Implementations should consider providing a configurable maximum
RDATA size for captures -- for example, to avoid memory issues when
confronted with large zone transfer records.
<span class="h3"><a class="selflink" id="section-11.4" href="#section-11.4">11.4</a>. Timestamps</span>
The preamble to each block includes a timestamp of the earliest
record in the Block. As described in <a href="#section-7.3.2.1">Section 7.3.2.1</a>, the timestamp
is an array of two unsigned integers. The first is a POSIX "time_t"
[<a href="#ref-posix-time">posix-time</a>]. Consumers of C-DNS should be aware of this, as it
excludes leap seconds and therefore may cause minor anomalies in the
data, e.g., when calculating Query throughput.
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. IANA Considerations</span>
IANA has created a registry "C-DNS DNS Capture Format" containing the
subregistries defined in Sections <a href="#section-12.1">12.1</a> to <a href="#section-12.4">12.4</a> inclusive.
In all cases, new entries may be added to the subregistries by Expert
Review as defined in [<a href="./rfc8126" title="">RFC8126</a>]. Experts are expected to exercise
their own expert judgment and should consider the following general
guidelines in addition to any provided guidelines that are particular
to a subregistry.
o There should be a real and compelling use for any new value.
o Values assigned should be carefully chosen to minimize storage
requirements for common cases.
<span class="h3"><a class="selflink" id="section-12.1" href="#section-12.1">12.1</a>. Transport Types</span>
IANA has created a registry "C-DNS Transports" of C-DNS transport
type identifiers. The primary purpose of this registry is to provide
unique identifiers for all transports used for DNS Queries.
The following note is included in this registry: "In version 1.0 of
C-DNS [<a href="./rfc8618">RFC8618</a>], there is a field to identify the type of DNS
transport. This field is 4 bits in size."
<span class="grey">Dickinson, et al. Standards Track [Page 49]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
The initial contents of the registry are as follows. See
Sections <a href="#section-7.3.2.3.2">7.3.2.3.2</a>, <a href="#section-7.3.2.3.5">7.3.2.3.5</a>, and <a href="#section-7.3.2.5">7.3.2.5</a> of this document:
+------------+------------------------+-----------+
| Identifier | Name | Reference |
+------------+------------------------+-----------+
| 0 | UDP | <a href="./rfc8618">RFC 8618</a> |
| 1 | TCP | <a href="./rfc8618">RFC 8618</a> |
| 2 | TLS | <a href="./rfc8618">RFC 8618</a> |
| 3 | DTLS | <a href="./rfc8618">RFC 8618</a> |
| 4 | HTTPS | <a href="./rfc8618">RFC 8618</a> |
| 5-14 | Unassigned | |
| 15 | Non-standard transport | <a href="./rfc8618">RFC 8618</a> |
+------------+------------------------+-----------+
Expert reviewers should take the following point into consideration:
Is the requested DNS transport described by a Standards Track RFC?
<span class="h3"><a class="selflink" id="section-12.2" href="#section-12.2">12.2</a>. Data Storage Flags</span>
IANA has created a registry "C-DNS Storage Flags" of C-DNS data
storage flags. The primary purpose of this registry is to provide
indicators giving hints on processing of the data stored.
The following note is included in this registry: "In version 1.0 of
C-DNS [<a href="./rfc8618">RFC8618</a>], there is a field describing attributes of the data
recorded. The field is a CBOR [<a href="./rfc7049" title=""Concise Binary Object Representation (CBOR)"">RFC7049</a>] unsigned integer holding bit
flags."
The initial contents of the registry are as follows. See
<a href="#section-7.3.1.1.1">Section 7.3.1.1.1</a> of this document:
+------+------------------+-----------------------------+-----------+
| Bit | Name | Description | Reference |
+------+------------------+-----------------------------+-----------+
| 0 | anonymized-data | The data has been | <a href="./rfc8618">RFC 8618</a> |
| | | anonymized. | |
| | | | |
| 1 | sampled-data | The data is sampled data. | <a href="./rfc8618">RFC 8618</a> |
| | | | |
| 2 | normalized-names | Names in the data have been | <a href="./rfc8618">RFC 8618</a> |
| | | normalized. | |
| | | | |
| 3-63 | Unassigned | | |
+------+------------------+-----------------------------+-----------+
<span class="grey">Dickinson, et al. Standards Track [Page 50]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="section-12.3" href="#section-12.3">12.3</a>. Response-Processing Flags</span>
IANA has created a registry "C-DNS Response Flags" of C-DNS response-
processing flags. The primary purpose of this registry is to provide
indicators giving hints on the generation of a particular Response.
The following note is included in this registry: "In version 1.0 of
C-DNS [<a href="./rfc8618">RFC8618</a>], there is a field describing attributes of the
Responses recorded. The field is a CBOR [<a href="./rfc7049" title=""Concise Binary Object Representation (CBOR)"">RFC7049</a>] unsigned integer
holding bit flags."
The initial contents of the registry are as follows. See
<a href="#section-7.3.2.4.1">Section 7.3.2.4.1</a> of this document:
+------+------------+-------------------------------+-----------+
| Bit | Name | Description | Reference |
+------+------------+-------------------------------+-----------+
| 0 | from-cache | The Response came from cache. | <a href="./rfc8618">RFC 8618</a> |
| 1-63 | Unassigned | | |
+------+------------+-------------------------------+-----------+
<span class="h3"><a class="selflink" id="section-12.4" href="#section-12.4">12.4</a>. AddressEvent Types</span>
IANA has created a registry "C-DNS Address Event Types" of C-DNS
AddressEvent types. The primary purpose of this registry is to
provide unique identifiers of different types of C-DNS address events
and so specify the contents of the optional companion field "ae-code"
for each type.
The following note is included in this registry: "In version 1.0 of
C-DNS [<a href="./rfc8618">RFC8618</a>], there is a field identifying types of the events
related to client addresses. This field is a CBOR [<a href="./rfc7049" title=""Concise Binary Object Representation (CBOR)"">RFC7049</a>] unsigned
integer. There is a related optional field "ae-code", which, if
present, holds an additional CBOR unsigned integer giving additional
information specific to the event type."
<span class="grey">Dickinson, et al. Standards Track [Page 51]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
The initial contents of the registry are as follows. See
<a href="#section-7.3.2.5">Section 7.3.2.5</a> of this document:
+------------------------+---------------+--------------+-----------+
| Identifier | Event Type | ae-code | Reference |
| | | Contents | |
+------------------------+---------------+--------------+-----------+
| 0 | TCP reset | None | <a href="./rfc8618">RFC 8618</a> |
| | | | |
| 1 | ICMP time | ICMP code | <a href="./rfc8618">RFC 8618</a> |
| | exceeded | [<a href="#ref-icmpcodes">icmpcodes</a>] | |
| | | | |
| 2 | ICMP | ICMP code | <a href="./rfc8618">RFC 8618</a> |
| | destination | [<a href="#ref-icmpcodes">icmpcodes</a>] | |
| | unreachable | | |
| | | | |
| 3 | ICMPv6 time | ICMPv6 code | <a href="./rfc8618">RFC 8618</a> |
| | exceeded | [<a href="#ref-icmp6codes">icmp6codes</a>] | |
| | | | |
| 4 | ICMPv6 | ICMPv6 code | <a href="./rfc8618">RFC 8618</a> |
| | destination | [<a href="#ref-icmp6codes">icmp6codes</a>] | |
| | unreachable | | |
| | | | |
| 5 | ICMPv6 packet | ICMPv6 code | <a href="./rfc8618">RFC 8618</a> |
| | too big | [<a href="#ref-icmp6codes">icmp6codes</a>] | |
| | | | |
| 6-18446744073709551615 | Unassigned | | |
+------------------------+---------------+--------------+-----------+
Expert reviewers should take the following point into consideration:
"ae-code" contents must be defined for a type or, if not appropriate,
specified as "None". A specification of "None" requires less storage
and is therefore preferred.
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. Security Considerations</span>
Any control interface MUST perform authentication and encryption.
Any data upload MUST be authenticated and encrypted.
<span class="h2"><a class="selflink" id="section-14" href="#section-14">14</a>. Privacy Considerations</span>
Storage of DNS traffic by operators in PCAP and other formats is a
long-standing and widespread practice. Section 2.5 of
[<a href="#ref-DNS-Priv-Cons">DNS-Priv-Cons</a>] provides an analysis of the risks to Internet users
regarding the storage of DNS traffic data in servers (recursive
resolvers, authoritative servers, and rogue servers).
<span class="grey">Dickinson, et al. Standards Track [Page 52]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
Section 5.2 of [<a href="#ref-DNS-Priv-Svc">DNS-Priv-Svc</a>] describes mitigations for those risks
for data stored on recursive resolvers (but that could by extension
apply to authoritative servers). These include data-handling
practices and methods for data minimization, IP address
pseudonymization, and anonymization. <a href="#appendix-C">Appendix C</a> of [<a href="#ref-DNS-Priv-Svc">DNS-Priv-Svc</a>]
presents an analysis of seven published anonymization processes. In
addition, the ICANN Root Server System Advisory Committee (RSSAC)
have recently published [<a href="#ref-RSSAC04" title=""Recommendations on Anonymization Processes for Source IP Addresses Submitted for Future Analysis"">RSSAC04</a>] ("Recommendations on Anonymization
Processes for Source IP Addresses Submitted for Future Analysis").
The above analyses consider full data capture (e.g., using PCAP) as a
baseline for privacy considerations; therefore, this format
specification introduces no new user privacy issues beyond those of
full data capture (which are quite severe). It does provide
mechanisms to selectively record only certain fields at the time of
data capture, to improve user privacy and to explicitly indicate that
data is sampled, anonymized, or both. It also provides flags to
indicate if data normalization has been performed; data normalization
increases user privacy by reducing the potential for fingerprinting
individuals. However, a trade-off is the potential reduction of the
capacity to identify attack traffic via Query name signatures.
Operators should carefully consider their operational requirements
and privacy policies and SHOULD capture at the source the minimum
user data required to meet their needs.
<span class="h2"><a class="selflink" id="section-15" href="#section-15">15</a>. References</span>
<span class="h3"><a class="selflink" id="section-15.1" href="#section-15.1">15.1</a>. Normative References</span>
[<a id="ref-pcap-filter">pcap-filter</a>]
tcpdump.org, "Manpage of PCAP-FILTER", November 2017,
<<a href="https://www.tcpdump.org/manpages/pcap-filter.7.html">https://www.tcpdump.org/manpages/pcap-filter.7.html</a>>.
[<a id="ref-pcap-options">pcap-options</a>]
tcpdump.org, "Manpage of PCAP", July 2018,
<<a href="https://www.tcpdump.org/manpages/pcap.3pcap.html">https://www.tcpdump.org/manpages/pcap.3pcap.html</a>>.
[<a id="ref-posix-time">posix-time</a>]
The Open Group, "IEEE Standard for Information
Technology--Portable Operating System Interface (POSIX(R))
Base Specifications, Issue 7", IEEE Standard 1003.1-2017,
<a href="#section-4.16">Section 4.16</a>, DOI 10.1109/IEEESTD.2018.8277153.
[<a id="ref-RFC792">RFC792</a>] Postel, J., "Internet Control Message Protocol", STD 5,
<a href="./rfc792">RFC 792</a>, DOI 10.17487/RFC0792, September 1981,
<<a href="https://www.rfc-editor.org/info/rfc792">https://www.rfc-editor.org/info/rfc792</a>>.
<span class="grey">Dickinson, et al. Standards Track [Page 53]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
[<a id="ref-RFC1035">RFC1035</a>] Mockapetris, P., "Domain names - implementation and
specification", STD 13, <a href="./rfc1035">RFC 1035</a>, DOI 10.17487/RFC1035,
November 1987, <<a href="https://www.rfc-editor.org/info/rfc1035">https://www.rfc-editor.org/info/rfc1035</a>>.
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC3986">RFC3986</a>] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66,
<a href="./rfc3986">RFC 3986</a>, DOI 10.17487/RFC3986, January 2005,
<<a href="https://www.rfc-editor.org/info/rfc3986">https://www.rfc-editor.org/info/rfc3986</a>>.
[<a id="ref-RFC4443">RFC4443</a>] Conta, A., Deering, S., and M. Gupta, Ed., "Internet
Control Message Protocol (ICMPv6) for the Internet
Protocol Version 6 (IPv6) Specification", STD 89,
<a href="./rfc4443">RFC 4443</a>, DOI 10.17487/RFC4443, March 2006,
<<a href="https://www.rfc-editor.org/info/rfc4443">https://www.rfc-editor.org/info/rfc4443</a>>.
[<a id="ref-RFC6891">RFC6891</a>] Damas, J., Graff, M., and P. Vixie, "Extension Mechanisms
for DNS (EDNS(0))", STD 75, <a href="./rfc6891">RFC 6891</a>,
DOI 10.17487/RFC6891, April 2013,
<<a href="https://www.rfc-editor.org/info/rfc6891">https://www.rfc-editor.org/info/rfc6891</a>>.
[<a id="ref-RFC7049">RFC7049</a>] Bormann, C. and P. Hoffman, "Concise Binary Object
Representation (CBOR)", <a href="./rfc7049">RFC 7049</a>, DOI 10.17487/RFC7049,
October 2013, <<a href="https://www.rfc-editor.org/info/rfc7049">https://www.rfc-editor.org/info/rfc7049</a>>.
[<a id="ref-RFC7858">RFC7858</a>] Hu, Z., Zhu, L., Heidemann, J., Mankin, A., Wessels, D.,
and P. Hoffman, "Specification for DNS over Transport
Layer Security (TLS)", <a href="./rfc7858">RFC 7858</a>, DOI 10.17487/RFC7858,
May 2016, <<a href="https://www.rfc-editor.org/info/rfc7858">https://www.rfc-editor.org/info/rfc7858</a>>.
[<a id="ref-RFC8094">RFC8094</a>] Reddy, T., Wing, D., and P. Patil, "DNS over Datagram
Transport Layer Security (DTLS)", <a href="./rfc8094">RFC 8094</a>,
DOI 10.17487/RFC8094, February 2017,
<<a href="https://www.rfc-editor.org/info/rfc8094">https://www.rfc-editor.org/info/rfc8094</a>>.
[<a id="ref-RFC8126">RFC8126</a>] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", <a href="https://www.rfc-editor.org/bcp/bcp26">BCP 26</a>,
<a href="./rfc8126">RFC 8126</a>, DOI 10.17487/RFC8126, June 2017,
<<a href="https://www.rfc-editor.org/info/rfc8126">https://www.rfc-editor.org/info/rfc8126</a>>.
[<a id="ref-RFC8174">RFC8174</a>] Leiba, B., "Ambiguity of Uppercase vs Lowercase in
<a href="./rfc2119">RFC 2119</a> Key Words", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc8174">RFC 8174</a>,
DOI 10.17487/RFC8174, May 2017,
<<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>>.
<span class="grey">Dickinson, et al. Standards Track [Page 54]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
[<a id="ref-RFC8484">RFC8484</a>] Hoffman, P. and P. McManus, "DNS Queries over HTTPS
(DoH)", <a href="./rfc8484">RFC 8484</a>, DOI 10.17487/RFC8484, October 2018,
<<a href="https://www.rfc-editor.org/info/rfc8484">https://www.rfc-editor.org/info/rfc8484</a>>.
[<a id="ref-RFC8610">RFC8610</a>] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data
Definition Language (CDDL): A Notational Convention to
Express Concise Binary Object Representation (CBOR) and
JSON Data Structures", <a href="./rfc8610">RFC 8610</a>, DOI 10.17487/RFC8610,
June 2019, <<a href="https://www.rfc-editor.org/info/rfc8610">https://www.rfc-editor.org/info/rfc8610</a>>.
<span class="h3"><a class="selflink" id="section-15.2" href="#section-15.2">15.2</a>. Informative References</span>
[<a id="ref-Avro">Avro</a>] The Apache Software Foundation, "Apache Avro(TM)", 2019,
<<a href="https://avro.apache.org/">https://avro.apache.org/</a>>.
[<a id="ref-ditl">ditl</a>] DNS-OARC, "DITL", 2018,
<<a href="https://www.dns-oarc.net/oarc/data/ditl">https://www.dns-oarc.net/oarc/data/ditl</a>>.
[<a id="ref-DNS-Priv-Cons">DNS-Priv-Cons</a>]
Bortzmeyer, S. and S. Dickinson, "DNS Privacy
Considerations", Work in Progress,
<a href="./draft-ietf-dprive-rfc7626-bis-00">draft-ietf-dprive-rfc7626-bis-00</a>, July 2019.
[<a id="ref-DNS-Priv-Svc">DNS-Priv-Svc</a>]
Dickinson, S., Overeinder, B., van Rijswijk-Deij, R., and
A. Mankin, "Recommendations for DNS Privacy Service
Operators", Work in Progress, <a href="./draft-ietf-dprive-bcp-op-03">draft-ietf-dprive-bcp-op-03</a>,
July 2019.
[<a id="ref-dnscap">dnscap</a>] DNS-OARC, "DNSCAP", 2018,
<<a href="https://www.dns-oarc.net/tools/dnscap">https://www.dns-oarc.net/tools/dnscap</a>>.
[<a id="ref-dnstap">dnstap</a>] "dnstap", 2016, <<a href="https://dnstap.info/">https://dnstap.info/</a>>.
[<a id="ref-dnstap-schema">dnstap-schema</a>]
"dnstap schema", commit d860ec1, November 2016,
<<a href="https://github.com/dnstap/dnstap.pb/blob/master/dnstap.proto">https://github.com/dnstap/dnstap.pb/blob/master/</a>
<a href="https://github.com/dnstap/dnstap.pb/blob/master/dnstap.proto">dnstap.proto</a>>.
[<a id="ref-dnsxml">dnsxml</a>] Daley, J., Ed., Morris, S., and J. Dickinson, "dnsxml - A
standard XML representation of DNS data", Work in
Progress, <a href="./draft-daley-dnsxml-00">draft-daley-dnsxml-00</a>, July 2013.
[<a id="ref-dsc">dsc</a>] Wessels, D. and J. Lundstrom, "DSC", 2016,
<<a href="https://www.dns-oarc.net/tools/dsc">https://www.dns-oarc.net/tools/dsc</a>>.
[<a id="ref-gzip">gzip</a>] "gzip", <<a href="https://www.gzip.org/">https://www.gzip.org/</a>>.
<span class="grey">Dickinson, et al. Standards Track [Page 55]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-56" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
[<a id="ref-icmp6codes">icmp6codes</a>]
IANA, "ICMPv6 "Code" Fields",
<<a href="https://www.iana.org/assignments/icmpv6-parameters/">https://www.iana.org/assignments/icmpv6-parameters/</a>>.
[<a id="ref-icmpcodes">icmpcodes</a>]
IANA, "Code Fields",
<<a href="https://www.iana.org/assignments/icmp-parameters/">https://www.iana.org/assignments/icmp-parameters/</a>>.
[<a id="ref-IEEE802.1Q">IEEE802.1Q</a>]
IEEE, "IEEE Standard for Local and Metropolitan Area
Networks--Bridges and Bridged Networks", IEEE
Standard 802.1Q.
[<a id="ref-Knot">Knot</a>] "Knot DNS", <<a href="https://www.knot-dns.cz/">https://www.knot-dns.cz/</a>>.
[<a id="ref-lz4">lz4</a>] "LZ4", <<a href="https://lz4.github.io/lz4/">https://lz4.github.io/lz4/</a>>.
[<a id="ref-mmark">mmark</a>] Gieben, M., "mmark", commit de69698, May 2019,
<<a href="https://github.com/mmarkdown/mmark">https://github.com/mmarkdown/mmark</a>>.
[<a id="ref-NSD">NSD</a>] NLnet Labs, "NSD", 2019,
<<a href="https://www.nlnetlabs.nl/projects/nsd/about/">https://www.nlnetlabs.nl/projects/nsd/about/</a>>.
[<a id="ref-opcodes">opcodes</a>] IANA, "DNS OpCodes",
<<a href="https://www.iana.org/assignments/dns-parameters/">https://www.iana.org/assignments/dns-parameters/</a>>.
[<a id="ref-packetq">packetq</a>] .SE - The Internet Infrastructure Foundation, "PacketQ",
commit c9b2e89, February 2019,
<<a href="https://github.com/DNS-OARC/PacketQ">https://github.com/DNS-OARC/PacketQ</a>>.
[<a id="ref-pcap">pcap</a>] "PCAP", 2019, <<a href="https://www.tcpdump.org/">https://www.tcpdump.org/</a>>.
[<a id="ref-pcapng">pcapng</a>] "pcapng: PCAP next generation file format specification",
commit 3c35b6a, March 2019,
<<a href="https://github.com/pcapng/pcapng">https://github.com/pcapng/pcapng</a>>.
[<a id="ref-Protocol-Buffers">Protocol-Buffers</a>]
Google LLC, "Protocol Buffers",
<<a href="https://developers.google.com/protocol-buffers/">https://developers.google.com/protocol-buffers/</a>>.
[<a id="ref-rcodes">rcodes</a>] IANA, "DNS RCODEs",
<<a href="https://www.iana.org/assignments/dns-parameters/">https://www.iana.org/assignments/dns-parameters/</a>>.
[<a id="ref-RFC5077">RFC5077</a>] Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig,
"Transport Layer Security (TLS) Session Resumption without
Server-Side State", <a href="./rfc5077">RFC 5077</a>, DOI 10.17487/RFC5077,
January 2008, <<a href="https://www.rfc-editor.org/info/rfc5077">https://www.rfc-editor.org/info/rfc5077</a>>.
<span class="grey">Dickinson, et al. Standards Track [Page 56]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-57" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
[<a id="ref-RFC7413">RFC7413</a>] Cheng, Y., Chu, J., Radhakrishnan, S., and A. Jain, "TCP
Fast Open", <a href="./rfc7413">RFC 7413</a>, DOI 10.17487/RFC7413, December 2014,
<<a href="https://www.rfc-editor.org/info/rfc7413">https://www.rfc-editor.org/info/rfc7413</a>>.
[<a id="ref-RFC8259">RFC8259</a>] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", STD 90, <a href="./rfc8259">RFC 8259</a>,
DOI 10.17487/RFC8259, December 2017,
<<a href="https://www.rfc-editor.org/info/rfc8259">https://www.rfc-editor.org/info/rfc8259</a>>.
[<a id="ref-RFC8427">RFC8427</a>] Hoffman, P., "Representing DNS Messages in JSON",
<a href="./rfc8427">RFC 8427</a>, DOI 10.17487/RFC8427, July 2018,
<<a href="https://www.rfc-editor.org/info/rfc8427">https://www.rfc-editor.org/info/rfc8427</a>>.
[<a id="ref-rrclasses">rrclasses</a>]
IANA, "DNS CLASSes",
<<a href="https://www.iana.org/assignments/dns-parameters/">https://www.iana.org/assignments/dns-parameters/</a>>.
[<a id="ref-rrtypes">rrtypes</a>] IANA, "Resource Record (RR) TYPEs",
<<a href="https://www.iana.org/assignments/dns-parameters/">https://www.iana.org/assignments/dns-parameters/</a>>.
[<a id="ref-RSSAC04">RSSAC04</a>] ICANN, "Recommendations on Anonymization Processes for
Source IP Addresses Submitted for Future Analysis",
August 2018, <<a href="https://www.icann.org/en/system/files/files/rssac-040-07aug18-en.pdf">https://www.icann.org/en/system/files/files/</a>
<a href="https://www.icann.org/en/system/files/files/rssac-040-07aug18-en.pdf">rssac-040-07aug18-en.pdf</a>>.
[<a id="ref-snappy">snappy</a>] "snappy", <<a href="https://google.github.io/snappy/">https://google.github.io/snappy/</a>>.
[<a id="ref-snzip">snzip</a>] "Snzip, a compression/decompression tool based on snappy",
commit 809c6f2, October 2018,
<<a href="https://github.com/kubo/snzip">https://github.com/kubo/snzip</a>>.
[<a id="ref-xz">xz</a>] "XZ Utils", <<a href="https://tukaani.org/xz/">https://tukaani.org/xz/</a>>.
[<a id="ref-zstd">zstd</a>] "Zstandard - Real-time data compression algorithm",
<<a href="https://facebook.github.io/zstd/">https://facebook.github.io/zstd/</a>>.
<span class="grey">Dickinson, et al. Standards Track [Page 57]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-58" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. CDDL</span>
This appendix gives a CDDL [<a href="./rfc8610" title=""Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures"">RFC8610</a>] specification for C-DNS.
CDDL does not permit a range of allowed values to be specified for a
bitfield. Where necessary, those values are given as a CDDL group,
but the group definition is commented out to prevent CDDL tooling
from warning that the group is unused.
; CDDL specification of the file format for C-DNS,
; which describes a collection of DNS messages and
; traffic metadata.
;
; The overall structure of a file.
;
File = [
file-type-id : "C-DNS",
file-preamble : FilePreamble,
file-blocks : [* Block],
]
;
; The File Preamble.
;
FilePreamble = {
major-format-version => 1,
minor-format-version => 0,
? private-version => uint,
block-parameters => [+ BlockParameters],
}
major-format-version = 0
minor-format-version = 1
private-version = 2
block-parameters = 3
BlockParameters = {
storage-parameters => StorageParameters,
? collection-parameters => CollectionParameters,
}
storage-parameters = 0
collection-parameters = 1
IPv6PrefixLength = 1..128
IPv4PrefixLength = 1..32
OpcodeRange = 0..15
RRTypeRange = 0..65535
<span class="grey">Dickinson, et al. Standards Track [Page 58]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-59" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
StorageParameters = {
ticks-per-second => uint,
max-block-items => uint,
storage-hints => StorageHints,
opcodes => [+ OpcodeRange],
rr-types => [+ RRTypeRange],
? storage-flags => StorageFlags,
? client-address-prefix-ipv4 => IPv4PrefixLength,
? client-address-prefix-ipv6 => IPv6PrefixLength,
? server-address-prefix-ipv4 => IPv4PrefixLength,
? server-address-prefix-ipv6 => IPv6PrefixLength,
? sampling-method => tstr,
? anonymization-method => tstr,
}
ticks-per-second = 0
max-block-items = 1
storage-hints = 2
opcodes = 3
rr-types = 4
storage-flags = 5
client-address-prefix-ipv4 = 6
client-address-prefix-ipv6 = 7
server-address-prefix-ipv4 = 8
server-address-prefix-ipv6 = 9
sampling-method = 10
anonymization-method = 11
; A hint indicates whether the collection method will always omit
; the item from the file.
StorageHints = {
query-response-hints => QueryResponseHints,
query-response-signature-hints =>
QueryResponseSignatureHints,
rr-hints => RRHints,
other-data-hints => OtherDataHints,
}
query-response-hints = 0
query-response-signature-hints = 1
rr-hints = 2
other-data-hints = 3
QueryResponseHintValues = &(
time-offset : 0,
client-address-index : 1,
client-port : 2,
transaction-id : 3,
qr-signature-index : 4,
client-hoplimit : 5,
<span class="grey">Dickinson, et al. Standards Track [Page 59]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-60" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
response-delay : 6,
query-name-index : 7,
query-size : 8,
response-size : 9,
response-processing-data : 10,
query-question-sections : 11, ; Second & subsequent
; Questions
query-answer-sections : 12,
query-authority-sections : 13,
query-additional-sections : 14,
response-answer-sections : 15,
response-authority-sections : 16,
response-additional-sections : 17,
)
QueryResponseHints = uint .bits QueryResponseHintValues
QueryResponseSignatureHintValues = &(
server-address-index : 0,
server-port : 1,
qr-transport-flags : 2,
qr-type : 3,
qr-sig-flags : 4,
query-opcode : 5,
qr-dns-flags : 6,
query-rcode : 7,
query-classtype-index : 8,
query-qdcount : 9,
query-ancount : 10,
query-nscount : 11,
query-arcount : 12,
query-edns-version : 13,
query-udp-size : 14,
query-opt-rdata-index : 15,
response-rcode : 16,
)
QueryResponseSignatureHints =
uint .bits QueryResponseSignatureHintValues
RRHintValues = &(
ttl : 0,
rdata-index : 1,
)
RRHints = uint .bits RRHintValues
OtherDataHintValues = &(
malformed-messages : 0,
address-event-counts : 1,
)
<span class="grey">Dickinson, et al. Standards Track [Page 60]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-61" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
OtherDataHints = uint .bits OtherDataHintValues
StorageFlagValues = &(
anonymized-data : 0,
sampled-data : 1,
normalized-names : 2,
)
StorageFlags = uint .bits StorageFlagValues
; Metadata about data collection
VLANIdRange = 1..4094
CollectionParameters = {
? query-timeout => uint, ; Milliseconds
? skew-timeout => uint, ; Microseconds
? snaplen => uint,
? promisc => bool,
? interfaces => [+ tstr],
? server-addresses => [+ IPAddress],
? vlan-ids => [+ VLANIdRange],
? filter => tstr,
? generator-id => tstr,
? host-id => tstr,
}
query-timeout = 0
skew-timeout = 1
snaplen = 2
promisc = 3
interfaces = 4
server-addresses = 5
vlan-ids = 6
filter = 7
generator-id = 8
host-id = 9
;
; Data in the file is stored in Blocks.
;
Block = {
block-preamble => BlockPreamble,
? block-statistics => BlockStatistics, ; Much of this
; could be derived
? block-tables => BlockTables,
? query-responses => [+ QueryResponse],
? address-event-counts => [+ AddressEventCount],
? malformed-messages => [+ MalformedMessage],
}
<span class="grey">Dickinson, et al. Standards Track [Page 61]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-62" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
block-preamble = 0
block-statistics = 1
block-tables = 2
query-responses = 3
address-event-counts = 4
malformed-messages = 5
;
; The (mandatory) preamble to a Block.
;
BlockPreamble = {
? earliest-time => Timestamp,
? block-parameters-index => uint .default 0,
}
earliest-time = 0
block-parameters-index = 1
; Ticks are sub-second intervals. The number of ticks in a second is
; file/block metadata. Signed and unsigned tick types are defined.
ticks = int
uticks = uint
Timestamp = [
timestamp-secs : uint, ; POSIX time
timestamp-ticks : uticks,
]
;
; Statistics about the Block contents.
;
BlockStatistics = {
? processed-messages => uint,
? qr-data-items => uint,
? unmatched-queries => uint,
? unmatched-responses => uint,
? discarded-opcode => uint,
? malformed-items => uint,
}
processed-messages = 0
qr-data-items = 1
unmatched-queries = 2
unmatched-responses = 3
discarded-opcode = 4
malformed-items = 5
<span class="grey">Dickinson, et al. Standards Track [Page 62]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-63" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
;
; Tables of common data referenced from records in a Block.
;
BlockTables = {
? ip-address => [+ IPAddress],
? classtype => [+ ClassType],
? name-rdata => [+ bstr], ; Holds both names
; and RDATA
? qr-sig => [+ QueryResponseSignature],
? QuestionTables,
? RRTables,
? malformed-message-data => [+ MalformedMessageData],
}
ip-address = 0
classtype = 1
name-rdata = 2
qr-sig = 3
qlist = 4
qrr = 5
rrlist = 6
rr = 7
malformed-message-data = 8
IPv4Address = bstr .size (0..4)
IPv6Address = bstr .size (0..16)
IPAddress = IPv4Address / IPv6Address
ClassType = {
type => uint,
class => uint,
}
type = 0
class = 1
QueryResponseSignature = {
? server-address-index => uint,
? server-port => uint,
? qr-transport-flags => QueryResponseTransportFlags,
? qr-type => QueryResponseType,
? qr-sig-flags => QueryResponseFlags,
? query-opcode => uint,
? qr-dns-flags => DNSFlags,
? query-rcode => uint,
? query-classtype-index => uint,
? query-qdcount => uint,
? query-ancount => uint,
? query-nscount => uint,
? query-arcount => uint,
<span class="grey">Dickinson, et al. Standards Track [Page 63]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-64" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
? query-edns-version => uint,
? query-udp-size => uint,
? query-opt-rdata-index => uint,
? response-rcode => uint,
}
server-address-index = 0
server-port = 1
qr-transport-flags = 2
qr-type = 3
qr-sig-flags = 4
query-opcode = 5
qr-dns-flags = 6
query-rcode = 7
query-classtype-index = 8
query-qdcount = 9
query-ancount = 10
query-nscount = 11
query-arcount = 12
query-edns-version = 13
query-udp-size = 14
query-opt-rdata-index = 15
response-rcode = 16
; Transport gives the values that may appear in bits 1..4 of
; TransportFlags. There is currently no way to express this in
; CDDL, so Transport is unused. To avoid confusion when used
; with CDDL tools, it is commented out.
;
; Transport = &(
; udp : 0,
; tcp : 1,
; tls : 2,
; dtls : 3,
; https : 4,
; non-standard : 15,
; )
TransportFlagValues = &(
ip-version : 0, ; 0=IPv4, 1=IPv6
) / (1..4)
TransportFlags = uint .bits TransportFlagValues
QueryResponseTransportFlagValues = &(
query-trailingdata : 5,
) / TransportFlagValues
QueryResponseTransportFlags =
uint .bits QueryResponseTransportFlagValues
<span class="grey">Dickinson, et al. Standards Track [Page 64]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-65" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
QueryResponseType = &(
stub : 0,
client : 1,
resolver : 2,
auth : 3,
forwarder : 4,
tool : 5,
)
QueryResponseFlagValues = &(
has-query : 0,
has-response : 1,
query-has-opt : 2,
response-has-opt : 3,
query-has-no-question : 4,
response-has-no-question: 5,
)
QueryResponseFlags = uint .bits QueryResponseFlagValues
DNSFlagValues = &(
query-cd : 0,
query-ad : 1,
query-z : 2,
query-ra : 3,
query-rd : 4,
query-tc : 5,
query-aa : 6,
query-do : 7,
response-cd: 8,
response-ad: 9,
response-z : 10,
response-ra: 11,
response-rd: 12,
response-tc: 13,
response-aa: 14,
)
DNSFlags = uint .bits DNSFlagValues
<span class="grey">Dickinson, et al. Standards Track [Page 65]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-66" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
QuestionTables = (
qlist => [+ QuestionList],
qrr => [+ Question]
)
QuestionList = [+ uint] ; Index of Question
Question = { ; Second and subsequent Questions
name-index => uint, ; Index to a name in the
; name-rdata table
classtype-index => uint,
}
name-index = 0
classtype-index = 1
RRTables = (
rrlist => [+ RRList],
rr => [+ RR]
)
RRList = [+ uint] ; Index of RR
RR = {
name-index => uint, ; Index to a name in the
; name-rdata table
classtype-index => uint,
? ttl => uint,
? rdata-index => uint, ; Index to RDATA in the
; name-rdata table
}
; Other map key values already defined above.
ttl = 2
rdata-index = 3
MalformedMessageData = {
? server-address-index => uint,
? server-port => uint,
? mm-transport-flags => TransportFlags,
? mm-payload => bstr,
}
; Other map key values already defined above.
mm-transport-flags = 2
mm-payload = 3
<span class="grey">Dickinson, et al. Standards Track [Page 66]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-67" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
;
; A single Query/Response data item.
;
QueryResponse = {
? time-offset => uticks, ; Time offset from
; start of Block
? client-address-index => uint,
? client-port => uint,
? transaction-id => uint,
? qr-signature-index => uint,
? client-hoplimit => uint,
? response-delay => ticks,
? query-name-index => uint,
? query-size => uint, ; DNS size of Query
? response-size => uint, ; DNS size of Response
? response-processing-data => ResponseProcessingData,
? query-extended => QueryResponseExtended,
? response-extended => QueryResponseExtended,
}
time-offset = 0
client-address-index = 1
client-port = 2
transaction-id = 3
qr-signature-index = 4
client-hoplimit = 5
response-delay = 6
query-name-index = 7
query-size = 8
response-size = 9
response-processing-data = 10
query-extended = 11
response-extended = 12
ResponseProcessingData = {
? bailiwick-index => uint,
? processing-flags => ResponseProcessingFlags,
}
bailiwick-index = 0
processing-flags = 1
ResponseProcessingFlagValues = &(
from-cache : 0,
)
ResponseProcessingFlags = uint .bits ResponseProcessingFlagValues
<span class="grey">Dickinson, et al. Standards Track [Page 67]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-68" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
QueryResponseExtended = {
? question-index => uint, ; Index of QuestionList
? answer-index => uint, ; Index of RRList
? authority-index => uint,
? additional-index => uint,
}
question-index = 0
answer-index = 1
authority-index = 2
additional-index = 3
;
; Address event data.
;
AddressEventCount = {
ae-type => &AddressEventType,
? ae-code => uint,
ae-address-index => uint,
? ae-transport-flags => TransportFlags,
ae-count => uint,
}
ae-type = 0
ae-code = 1
ae-address-index = 2
ae-transport-flags = 3
ae-count = 4
AddressEventType = (
tcp-reset : 0,
icmp-time-exceeded : 1,
icmp-dest-unreachable : 2,
icmpv6-time-exceeded : 3,
icmpv6-dest-unreachable: 4,
icmpv6-packet-too-big : 5,
)
;
; Malformed messages.
;
MalformedMessage = {
? time-offset => uticks, ; Time offset from
; start of Block
? client-address-index => uint,
? client-port => uint,
? message-data-index => uint,
}
; Other map key values already defined above.
message-data-index = 3
<span class="grey">Dickinson, et al. Standards Track [Page 68]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-69" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. DNS Name Compression Example</span>
The basic algorithm, which follows the guidance in [<a href="./rfc1035" title=""Domain names - implementation and specification"">RFC1035</a>], is
simply to collect each name, and the offset in the packet at which it
starts, during packet construction. As each name is added, it is
offered to each of the collected names in order of collection,
starting from the first name. If (1) labels at the end of the name
can be replaced with a reference back to part (or all) of the earlier
name and (2) the uncompressed part of the name is shorter than any
compression already found, the earlier name is noted as the
compression target for the name.
The following tables illustrate the step-by-step process of adding
names and performing name compression. In an example packet, the
first name added is foo.example, which cannot be compressed.
+---+-------------+--------------+--------------------+
| N | Name | Uncompressed | Compression Target |
+---+-------------+--------------+--------------------+
| 1 | foo.example | foo.example | None |
+---+-------------+--------------+--------------------+
The next name added is bar.example. This is matched against
foo.example. The example part of this can be used as a compression
target, with the remaining uncompressed part of the name being bar.
+---+-------------+--------------+-----------------------+
| N | Name | Uncompressed | Compression Target |
+---+-------------+--------------+-----------------------+
| 1 | foo.example | foo.example | None |
| 2 | bar.example | bar | 1 + offset to example |
+---+-------------+--------------+-----------------------+
The third name added is www.bar.example. This is first matched
against foo.example, and as before this is recorded as a compression
target, with the remaining uncompressed part of the name being
www.bar. It is then matched against the second name, which again can
be a compression target. Because the remaining uncompressed part of
the name is www, this is an improved compression, and so it is
adopted.
+---+-----------------+--------------+-----------------------+
| N | Name | Uncompressed | Compression Target |
+---+-----------------+--------------+-----------------------+
| 1 | foo.example | foo.example | None |
| 2 | bar.example | bar | 1 + offset to example |
| 3 | www.bar.example | www | 2 |
+---+-----------------+--------------+-----------------------+
<span class="grey">Dickinson, et al. Standards Track [Page 69]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-70" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
As an optimization, if a name is already perfectly compressed (in
other words, the uncompressed part of the name is empty), then no
further names will be considered for compression.
<span class="h3"><a class="selflink" id="appendix-B.1" href="#appendix-B.1">B.1</a>. NSD Compression Algorithm</span>
Using the above basic algorithm, the packet lengths of Responses
generated by the Name Server Daemon (NSD) [<a href="#ref-NSD" title=""NSD"">NSD</a>] can be matched almost
exactly. At the time of writing, a tiny number (<.01%) of the
reconstructed packets had incorrect lengths.
<span class="h3"><a class="selflink" id="appendix-B.2" href="#appendix-B.2">B.2</a>. Knot Authoritative Compression Algorithm</span>
The Knot Authoritative name server [<a href="#ref-Knot" title=""Knot DNS"">Knot</a>] uses different compression
behavior, which is the result of internal optimization designed to
balance runtime speed with compression size gains. In brief, and
omitting complications, Knot Authoritative will only consider the
QNAME and names in the immediately preceding RR section in an RRSET
as compression targets.
A set of smart heuristics as described below can be implemented to
mimic this, and while not perfect, it produces output nearly, but not
quite, as good a match as with NSD. The heuristics are as follows:
1. A match is only perfect if the name is completely compressed AND
the TYPE of the section in which the name occurs matches the TYPE
of the name used as the compression target.
2. If the name occurs in RDATA:
* If the compression target name is in a Query, then only the
first RR in an RRSET can use that name as a compression
target.
* The compression target name MUST be in RDATA.
* The name section TYPE must match the compression target name
section TYPE.
* The compression target name MUST be in the immediately
preceding RR in the RRSET.
Using this algorithm, less than 0.1% of the reconstructed packets had
incorrect lengths.
<span class="grey">Dickinson, et al. Standards Track [Page 70]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-71" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="appendix-B.3" href="#appendix-B.3">B.3</a>. Observed Differences</span>
In sample traffic collected on a root name server, around 2-4% of
Responses generated by Knot had different packet lengths than those
produced by NSD.
<span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Comparison of Binary Formats</span>
Several binary serialization formats were considered. For
completeness, they were also compared to JSON.
o Apache Avro [<a href="#ref-Avro" title=""Apache Avro(TM)"">Avro</a>]. Data is stored according to a predefined
schema. The schema itself is always included in the data file.
Data can therefore be stored untagged, for a smaller serialization
size, and be written and read by an Avro library.
* At the time of writing, Avro libraries are available for C,
C++, C#, Java, Python, Ruby, and PHP. Optionally, tools are
available for C++, Java, and C# to generate code for encoding
and decoding.
o Google Protocol Buffers [<a href="#ref-Protocol-Buffers">Protocol-Buffers</a>]. Data is stored
according to a predefined schema. The schema is used by a
generator to generate code for encoding and decoding the data.
Data can therefore be stored untagged, for a smaller serialization
size. The schema is not stored with the data, so unlike Avro, it
cannot be read with a generic library.
* Code must be generated for a particular data schema to read and
write data using that schema. At the time of writing, the
Google code generator can currently generate code for encoding
and decoding a schema for C++, Go, Java, Python, Ruby, C#,
Objective-C, JavaScript, and PHP.
o CBOR [<a href="./rfc7049" title=""Concise Binary Object Representation (CBOR)"">RFC7049</a>]. This serialization format is comparable to JSON
but with a binary representation. It does not use a predefined
schema, so data is always stored tagged. However, CBOR data
schemas can be described using CDDL [<a href="./rfc8610" title=""Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures"">RFC8610</a>], and tools exist to
verify that data files conform to the schema.
* CBOR is a simple format and is simple to implement. At the
time of writing, the CBOR website lists implementations for 16
languages.
<span class="grey">Dickinson, et al. Standards Track [Page 71]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-72" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
Avro and Protocol Buffers both allow storage of untagged data, but
because they rely on the data schema for this, their implementation
is considerably more complex than CBOR. Using Avro or Protocol
Buffers in an unsupported environment would require notably greater
development effort compared to CBOR.
A test program was written that reads input from a PCAP file and
writes output using one of two basic structures: either a simple
structure, where each Query/Response pair is represented in a single
record entry, or the C-DNS block structure.
The resulting output files were then compressed using a variety of
common general-purpose lossless compression tools to explore the
compressibility of the formats. The compression tools employed were:
o snzip [<a href="#ref-snzip" title=""Snzip, a compression/decompression tool based on snappy"">snzip</a>]. A command-line compression tool based on the
Google Snappy library [<a href="#ref-snappy" title=""snappy"">snappy</a>].
o lz4 [<a href="#ref-lz4" title=""LZ4"">lz4</a>]. The command-line compression tool from the reference C
LZ4 implementation.
o gzip [<a href="#ref-gzip" title=""gzip"">gzip</a>]. The ubiquitous GNU zip tool.
o zstd [<a href="#ref-zstd" title=""Zstandard - Real-time data compression algorithm"">zstd</a>]. Compression using the Zstandard algorithm.
o xz [<a href="#ref-xz" title=""XZ Utils"">xz</a>]. A popular compression tool noted for high compression.
In all cases, the compression tools were run using their default
settings.
Note that this document does not mandate the use of compression, nor
any particular compression scheme, but it anticipates that in
practice output data will be subject to general-purpose compression,
and so this should be taken into consideration.
"test.pcap", a 662 MB capture of sample data from a root instance,
was used for the comparison. The following table shows the formatted
size and size after compression (abbreviated to Comp. in the table
headers), together with the task Resident Set Size (RSS) and the user
time taken by the compression. File sizes are in MB, RSS is in kB,
and user time is in seconds.
<span class="grey">Dickinson, et al. Standards Track [Page 72]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-73" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
+-------------+-----------+-------+------------+-------+-----------+
| Format | File Size | Comp. | Comp. Size | RSS | User Time |
+-------------+-----------+-------+------------+-------+-----------+
| PCAP | 661.87 | snzip | 212.48 | 2696 | 1.26 |
| | | lz4 | 181.58 | 6336 | 1.35 |
| | | gzip | 153.46 | 1428 | 18.20 |
| | | zstd | 87.07 | 3544 | 4.27 |
| | | xz | 49.09 | 97416 | 160.79 |
| | | | | | |
| JSON simple | 4113.92 | snzip | 603.78 | 2656 | 5.72 |
| | | lz4 | 386.42 | 5636 | 5.25 |
| | | gzip | 271.11 | 1492 | 73.00 |
| | | zstd | 133.43 | 3284 | 8.68 |
| | | xz | 51.98 | 97412 | 600.74 |
| | | | | | |
| Avro simple | 640.45 | snzip | 148.98 | 2656 | 0.90 |
| | | lz4 | 111.92 | 5828 | 0.99 |
| | | gzip | 103.07 | 1540 | 11.52 |
| | | zstd | 49.08 | 3524 | 2.50 |
| | | xz | 22.87 | 97308 | 90.34 |
| | | | | | |
| CBOR simple | 764.82 | snzip | 164.57 | 2664 | 1.11 |
| | | lz4 | 120.98 | 5892 | 1.13 |
| | | gzip | 110.61 | 1428 | 12.88 |
| | | zstd | 54.14 | 3224 | 2.77 |
| | | xz | 23.43 | 97276 | 111.48 |
| | | | | | |
| PBuf simple | 749.51 | snzip | 167.16 | 2660 | 1.08 |
| | | lz4 | 123.09 | 5824 | 1.14 |
| | | gzip | 112.05 | 1424 | 12.75 |
| | | zstd | 53.39 | 3388 | 2.76 |
| | | xz | 23.99 | 97348 | 106.47 |
| | | | | | |
| JSON block | 519.77 | snzip | 106.12 | 2812 | 0.93 |
| | | lz4 | 104.34 | 6080 | 0.97 |
| | | gzip | 57.97 | 1604 | 12.70 |
| | | zstd | 61.51 | 3396 | 3.45 |
| | | xz | 27.67 | 97524 | 169.10 |
| | | | | | |
| Avro block | 60.45 | snzip | 48.38 | 2688 | 0.20 |
| | | lz4 | 48.78 | 8540 | 0.22 |
| | | gzip | 39.62 | 1576 | 2.92 |
| | | zstd | 29.63 | 3612 | 1.25 |
| | | xz | 18.28 | 97564 | 25.81 |
| | | | | | |
<span class="grey">Dickinson, et al. Standards Track [Page 73]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-74" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
| CBOR block | 75.25 | snzip | 53.27 | 2684 | 0.24 |
| | | lz4 | 51.88 | 8008 | 0.28 |
| | | gzip | 41.17 | 1548 | 4.36 |
| | | zstd | 30.61 | 3476 | 1.48 |
| | | xz | 18.15 | 97556 | 38.78 |
| | | | | | |
| PBuf block | 67.98 | snzip | 51.10 | 2636 | 0.24 |
| | | lz4 | 52.39 | 8304 | 0.24 |
| | | gzip | 40.19 | 1520 | 3.63 |
| | | zstd | 31.61 | 3576 | 1.40 |
| | | xz | 17.94 | 97440 | 33.99 |
+-------------+-----------+-------+------------+-------+-----------+
The above results are discussed in the following sections.
<span class="h3"><a class="selflink" id="appendix-C.1" href="#appendix-C.1">C.1</a>. Comparison with Full PCAP Files</span>
An important first consideration is whether moving away from PCAP
offers significant benefits.
The simple binary formats are typically larger than PCAP, even though
they omit some information such as Ethernet Media Access Control
(MAC) addresses. But not only do they require less CPU to compress
than PCAP, the resulting compressed files are smaller than compressed
PCAP.
<span class="h3"><a class="selflink" id="appendix-C.2" href="#appendix-C.2">C.2</a>. Simple versus Block Coding</span>
The intention of the block coding is to perform data deduplication on
Query/Response records within the block. The simple and block
formats shown above store exactly the same information for each
Query/Response record. This information is parsed from the DNS
traffic in the input PCAP file, and in all cases each field has an
identifier and the field data is typed.
The data deduplication on the block formats show an order-of-
magnitude reduction in the size of the format file size against the
simple formats. As would be expected, the compression tools are able
to find and exploit a lot of this duplication, but as the
deduplication process uses knowledge of DNS traffic, it is able to
retain a size advantage. This advantage reduces as stronger
compression is applied, as again would be expected, but even with the
strongest compression applied the block-formatted data remains around
75% of the size of the simple format and its compression requires
roughly a third of the CPU time.
<span class="grey">Dickinson, et al. Standards Track [Page 74]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-75" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="appendix-C.3" href="#appendix-C.3">C.3</a>. Binary versus Text Formats</span>
Text data formats offer many advantages over binary formats,
particularly in the areas of ad hoc data inspection and extraction.
It was therefore felt worthwhile to carry out a direct comparison,
implementing JSON versions of the simple and block formats.
Concentrating on JSON block format, the format files produced are a
significant fraction of an order of magnitude larger than binary
formats. The impact on file size after compression is as might be
expected from that starting point; the stronger compression produces
files that are 150% of the size of similarly compressed binary format
and require over 4x more CPU to compress.
<span class="h3"><a class="selflink" id="appendix-C.4" href="#appendix-C.4">C.4</a>. Performance</span>
Concentrating again on the block formats, all three produce format
files that are close to an order of magnitude smaller than the
original "test.pcap" file. CBOR produces the largest files and Avro
the smallest, 20% smaller than CBOR.
However, once compression is taken into account, the size difference
narrows. At medium compression (with gzip), the size difference is
4%. Using strong compression (with xz), the difference reduces to
2%, with Avro the largest and Protocol Buffers the smallest, although
CBOR and Protocol Buffers require slightly more compression CPU.
The measurements presented above do not include data on the CPU
required to generate the format files. Measurements indicate that
writing Avro requires 10% more CPU than CBOR or Protocol Buffers. It
appears, therefore, that Avro's advantage in compression CPU usage is
probably offset by a larger CPU requirement in writing Avro.
<span class="h3"><a class="selflink" id="appendix-C.5" href="#appendix-C.5">C.5</a>. Conclusions</span>
The above assessments lead us to the choice of a binary format file
using blocking.
As noted previously, this document anticipates that output data will
be subject to compression. There is no compelling case for one
particular binary serialization format in terms of either final file
size or machine resources consumed, so the choice must be largely
based on other factors. CBOR was therefore chosen as the binary
serialization format for the reasons listed in <a href="#section-5">Section 5</a>.
<span class="grey">Dickinson, et al. Standards Track [Page 75]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-76" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
<span class="h3"><a class="selflink" id="appendix-C.6" href="#appendix-C.6">C.6</a>. Block Size Choice</span>
Given the choice of a CBOR format using blocking, the question arises
of what an appropriate default value for the maximum number of
Query/Response pairs in a block should be. This has two components:
1. What is the impact on performance of using different block sizes
in the format file?
2. What is the impact on the size of the format file before and
after compression?
The following table addresses the performance question, showing the
impact on the performance of a C++ program converting "test.pcap"
to C-DNS. File sizes are in MB, RSS is in kB, and user time is
in seconds.
+------------+-----------+--------+-----------+
| Block Size | File Size | RSS | User Time |
+------------+-----------+--------+-----------+
| 1,000 | 133.46 | 612.27 | 15.25 |
| 5,000 | 89.85 | 676.82 | 14.99 |
| 10,000 | 76.87 | 752.40 | 14.53 |
| 20,000 | 67.86 | 750.75 | 14.49 |
| 40,000 | 61.88 | 736.30 | 14.29 |
| 80,000 | 58.08 | 694.16 | 14.28 |
| 160,000 | 55.94 | 733.84 | 14.44 |
| 320,000 | 54.41 | 799.20 | 13.97 |
+------------+-----------+--------+-----------+
Therefore, increasing block size tends to increase maximum RSS a
little, with no significant effect (if anything, a small reduction)
on CPU consumption.
<span class="grey">Dickinson, et al. Standards Track [Page 76]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-77" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
The following table demonstrates the effect of increasing block size
on output file size for different compressions.
+------------+--------+-------+-------+-------+-------+-------+
| Block Size | None | snzip | lz4 | gzip | zstd | xz |
+------------+--------+-------+-------+-------+-------+-------+
| 1,000 | 133.46 | 90.52 | 90.03 | 74.65 | 44.78 | 25.63 |
| 5,000 | 89.85 | 59.69 | 59.43 | 46.99 | 37.33 | 22.34 |
| 10,000 | 76.87 | 50.39 | 50.28 | 38.94 | 33.62 | 21.09 |
| 20,000 | 67.86 | 43.91 | 43.90 | 33.24 | 32.62 | 20.16 |
| 40,000 | 61.88 | 39.63 | 39.69 | 29.44 | 28.72 | 19.52 |
| 80,000 | 58.08 | 36.93 | 37.01 | 27.05 | 26.25 | 19.00 |
| 160,000 | 55.94 | 35.10 | 35.06 | 25.44 | 24.56 | 19.63 |
| 320,000 | 54.41 | 33.87 | 33.74 | 24.36 | 23.44 | 18.66 |
+------------+--------+-------+-------+-------+-------+-------+
There is obviously scope for tuning the default block size to the
compression being employed, traffic characteristics, frequency of
output file rollover, etc. Using a strong compression scheme, block
sizes over 10,000 Query/Response pairs would seem to offer limited
improvements.
<span class="h2"><a class="selflink" id="appendix-D" href="#appendix-D">Appendix D</a>. Data Fields for Traffic Regeneration</span>
<span class="h3"><a class="selflink" id="appendix-D.1" href="#appendix-D.1">D.1</a>. Recommended Fields for Traffic Regeneration</span>
This section specifies the data fields that would need to be captured
in order to perform the fullest PCAP traffic reconstruction for
well-formed DNS messages that is possible with C-DNS.
o All data fields in the QueryResponse type except response-
processing-data.
o All data fields in the QueryResponseSignature type except qr-type.
o All data fields in the RR TYPE.
<span class="h3"><a class="selflink" id="appendix-D.2" href="#appendix-D.2">D.2</a>. Issues with Small Data Captures</span>
At the other extreme, an interesting corner case arises when opting
to perform captures with a smaller data set than that recommended
above. The following list specifies a subset of the above data
fields; if only these data fields are captured, then even a minimal
traffic reconstruction is problematic because there is not enough
information to determine if the Query/Response data item contained
just a Query, just a Response, or a Query/Response pair.
<span class="grey">Dickinson, et al. Standards Track [Page 77]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-78" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
o The following data fields from the QueryResponse type:
* time-offset
* client-address-index
* client-port
* transaction-id
* query-name-index
o The following data fields from the QueryResponseSignature type:
* server-address-index
* server-port
* qr-transport-flags
* query-classtype-index
In this case, simply also capturing the qr-sig-flags will provide
enough information to perform a minimal traffic reconstruction
(assuming that suitable defaults for the remaining fields are
provided). Additionally, capturing response-delay, query-opcode, and
response-rcode will avoid having to rely on potentially misleading
defaults for these values and should result in a PCAP that represents
the basics of the real traffic flow.
Acknowledgements
The authors wish to thank CZ.NIC -- in particular, Tomas Gavenciak --
for many useful discussions on binary formats, compression, and
packet matching. Thanks also to Jan Vcelak and Wouter Wijngaards for
discussions on name compression, and Paul Hoffman for a detailed
review of this document and the C-DNS CDDL.
Thanks also to Robert Edmonds, Jerry Lundstrom, Richard Gibson,
Stephane Bortzmeyer, and many other members of DNSOP for review.
Also, thanks to Miek Gieben for [<a href="#ref-mmark" title=""mmark"">mmark</a>].
<span class="grey">Dickinson, et al. Standards Track [Page 78]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-79" ></span>
<span class="grey"><a href="./rfc8618">RFC 8618</a> C-DNS: A Format for DNS Packet Capture September 2019</span>
Authors' Addresses
John Dickinson
Sinodun IT
Magdalen Centre
Oxford Science Park
Oxford OX4 4GA
United Kingdom
Email: jad@sinodun.com
Jim Hague
Sinodun IT
Magdalen Centre
Oxford Science Park
Oxford OX4 4GA
United Kingdom
Email: jim@sinodun.com
Sara Dickinson
Sinodun IT
Magdalen Centre
Oxford Science Park
Oxford OX4 4GA
United Kingdom
Email: sara@sinodun.com
Terry Manderson
ICANN
12025 Waterfront Drive
Suite 300
Los Angeles, CA 90094-2536
United States of America
Email: terry.manderson@icann.org
John Bond
Wikimedia Foundation, Inc.
1 Montgomery Street
Suite 1600
San Francisco, CA 94104
United States of America
Email: ietf-wikimedia@johnbond.org
Dickinson, et al. Standards Track [Page 79]
</pre>
|