From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id BD24D2D9A9 for ; Mon, 9 Sep 2024 16:46:42 +0200 (CEST) Received: (qmail 22492 invoked by uid 550); 9 Sep 2024 14:46:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 22454 invoked from network); 9 Sep 2024 14:46:36 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G1vEVNY3UEK+fs9ymbIpYkRtSVXeot9lRSMADV4Qx+qeSCHu9xpPu0OXXZl3+zqA0gTzFUKx0ClDWXURZf0GhwqCN3rAbik82SD/WfUAjlsudFPcFKG5tdbwH+RiZTgo4OaEGZ+JSKBszaMrSg2oBzSetr/kujVPzBQuVpH6FrgW3qC+xYqVm+0wjkMaPebPBbL+WfsjaVg9dLAV4s6MTMlUcDXxXp1Qqz0uhTfCUCtM6Nt/O0V+pg1giZ818OZXzCVDVhHM0XTq8sIdN3lSbjGDh03t7xWs6pzhNxfNPpo5eMnyKnaw1OYsieCqjmd1tiSlUq1fYhbE8BTcTaqg/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lcHdFajZNnFlUjR9h2i+Rq9DBK+c03Ntqj7MQI84LtQ=; b=R0BBbDJEzMML4qKveNsd3ltsd3m+l44F12F/rN67trIYKi1KluxBg6AnH5wRPmI9ixH3X5q57SkkMj0uALXmMR/eheiGuipv1R2N8y7dJRRoH/ZaoOuKAqCmOdX0ttTWQiRu6ImY8OgjaLF6pIjMjc5j4xiO4uaR8O4qDGIa/qcjl9H2h2kw/KVnJvhWF4eGdX7HLsz2nei9bvvzRbFQldWw3Uv6mqERc/KoFPKi+ZRsSh/Uh3UE2RG/RmO+iKjKH09k8MDFYnNQT/hp6xI5FitCH9BpfLCVRDk/kmqP5jx6UXoIlbmA2VAgju4mqXY4gfzl5UXGlpwft2sqEl169A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=OUTLOOK.COM.AU; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lcHdFajZNnFlUjR9h2i+Rq9DBK+c03Ntqj7MQI84LtQ=; b=jHs4Uy4pYugGROLwbqsMVsGLUW0rXpKq+Myop4GLzRLSVy+X+ZhRiI964Yn9Y9ZvryXbz6W0nUWMNrwQUrB8vZGoP48bWJRIjawZoveu5nI1ZbbCxar38I3nUmrKs4MlrMKUjwvw5Z2QNYBDzBIowtauvSFpSIF5a7wBbHUm4t/g+z/R9aCO03H3dTKnCUTQEqKRyqkTlgn2fITNOoKN9gyrMu+a9ndWy2iD7CZTYwT1VJXumdgl+eKDjknqdZsiqX5wtWjLE49Uwl0Mgr5lr5PeYkg174MPpEkAl0yQylu0rvsyCdwr/iefIsfFRyGmDauI1vjF9izu67YKAqduVA== From: Ryan Ward To: Rich Felker CC: Szabolcs Nagy , "musl@lists.openwall.com" Thread-Topic: [musl] Adding dns/resolver tests to libc-test Thread-Index: AQHa8wUnHDz2XhAr1k2/YnOihK7GDbI7P81CgABr/ACAE/TzaQ== Date: Mon, 9 Sep 2024 14:46:22 +0000 Message-ID: References: <20240818093842.GD3766212@port70.net> <20240827213435.GG10433@brightrain.aerifal.cx> In-Reply-To: <20240827213435.GG10433@brightrain.aerifal.cx> Accept-Language: en-AU, en-US Content-Language: en-AU X-MS-Has-Attach: yes X-MS-TNEF-Correlator: msip_labels: x-tmn: [tUlU9xz/8p1ynV64EVPbUvuUeRP0prO9Ua4lMH2DdRc=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYSPR01MB6221:EE_|PUZPR01MB5142:EE_ x-ms-office365-filtering-correlation-id: 94b60eb3-b45f-486f-3fae-08dcd0de2c70 x-microsoft-antispam: BCL:0;ARA:14566002|8060799006|19110799003|461199028|6092099012|15030799003|15080799006|3430499032|3420499032|3412199025|440099028|102099032; x-microsoft-antispam-message-info: K+285PGFWhPiY3jNZE34YWQ0gkDlonmYQHzgfyPvMGSuUOlZQ3T6TLNH4ZRhQMmb3rhtuakY/CkywsvKhqQ0cZun5thd1f+ZQZUwftfrHDxllgaJlwdUPcaRCTyt2bBL1vwpM3uTFeXADZrCzMVDT6vqLGo+l2VM5w9cFCvUPGPhgWtIdpF8y0F9gDu3HeCKXFUl7ebNmJiyeqAqVhM/tI8ySWYsKUFkg45fVOOLiE3EdyWpEZUVv8iyL9jsPyqVCQMMRj1rvWS++WQlKIfbHHuOy7PJeXUk9R0KkUVgv/f9jTi3UOFtecLjVfs1d+PZbfyQetQD7iUP9aoI1P8UujIf50gX8RAWTH7fZu3yrPKG699Nt2P+qnEVTzCAD2R7CSaiu454te7tq5iHbv0VoFuVJMSJ7g9swHGNsxKFtOAkO26gfaNsTh7Rp9oOx070k0hB9xjDCKmWZcRxCMkfiMAdH7s3kGQ1kcbVy5mYDcffFj3SEHOuPLfXCv0Qqj808Z0Nl1rD5S65k7ytEZ46q430S8l1ZhKd7D9XhUmAY5dwBnLSN4toRdOXenJHUi9xZoNcsqWhfmugP9SI+Q4fRNKM9uh/nshQ6Z2Yo89Q09LqRPZAMta6ngPcbL+gmlcDFACBpKgX7CSizGbxmQBUt9scZJA3rb/39karDEKjVEgG2frGxuDQ0C9PHdypzITYc1Z750bUlwhW6Lr4FGOONxiNpF1FTIr1+X6zsKgooOg/a2LtQYWX+Ic2AJKS1YuS x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?C+BHDVw0Zxk0DdH1Z6H2+b5L+1HMC+SCE6YrM/BudJckI1cg9WrR81MgJM?= =?iso-8859-1?Q?qCYW1MitZnV5TdjJl8POdeMDN4+88GB3F1BVKGyRnkyXZH4YrxCDqWhFVL?= =?iso-8859-1?Q?iTFo5a5eolkTepKda4IU9Py2A5rqMG4SsH7YdIvXZXQBgoVYWf5G5TKR78?= =?iso-8859-1?Q?1xxVrfxtnazWJy7NGDOrMjjUbgKlTzETfhxEXbMXIIHxdCeVsxgr3aM0c2?= =?iso-8859-1?Q?TRecPiKREDpmNxUTwvGggHDH6gVs2GTwwg3vWoATkp8dL2TN9ICKah8Q1R?= =?iso-8859-1?Q?BUTrdAhYavWn3IPeqQpW3qRuJanrcqguKxauBgZLqDYqspoHIdfAU8DygX?= =?iso-8859-1?Q?iNfIG/wgMIQS5w1CdXvklafjNYAQw9a/LyWO+atnu4mcYf4wymc00nVn/2?= =?iso-8859-1?Q?C2WVCzjrZKv6PSVZoTrYJciM1HVH3tGHhHYfy+5iHCRsnXJLtgfPvh7GZD?= =?iso-8859-1?Q?1Fwf+WDT/VOpeM9/5o/naHZk68bUGXUIduE0RcM3NgIcEXPkEJ/VGw2mfq?= =?iso-8859-1?Q?S1kJaa7PH2NFnW6VEV9A/m7Cxio3fNJLKPs2efuDHqjeKnyMVLJBG0LrTe?= =?iso-8859-1?Q?8V/GjFFQD7oiejFYmCNWt07tjJiFPXBm9Pr3Ah2viqK8feP1ji5yhR0g3W?= =?iso-8859-1?Q?uoLfgxsx7P9rBqsXQwb6DA4G/8cK+OC56hWvUN486NyomZyUGTuuY2SJ9q?= =?iso-8859-1?Q?4VWQfscPDv9zO8yFus+z6Gky8yhqOwqyjYRmFkh+G4mBqcc0ZfRagmHrOD?= =?iso-8859-1?Q?1osxi6w6v/RhTDgyqMewS+FOr8Gsntq9Av7J45Eajd1SDEFxmbJRhubr1o?= =?iso-8859-1?Q?yzCmxljUqBn2D0BPqbjQ5sMYvkqxf3hJAaeJXgb9sQk/Q6zZ/hDiqbDCgV?= =?iso-8859-1?Q?WBm/dFYUSfRDJBLlsbmSfOoatm6hOVvzDFJnbAddIxrSyz+cPZASPQn2Wi?= =?iso-8859-1?Q?bfGYyjQjsdMIBCsJp21q0AO+pg+NBljE4JQqlDDXW5V2p96YG103nLvOol?= =?iso-8859-1?Q?8Plia4/XyvmihHOqw3joJltZaviG710z2daLpgjyrOFekJyvPkS3CIdXbc?= =?iso-8859-1?Q?sg3XMlS5fWgINMGqtMCF0SifGDYda0+Y6OTlFPZ0fzyUFc4YWTr62k8HRH?= =?iso-8859-1?Q?QcBWDeVfmFdz2yMk4a03rpw+v63Ult7nvH19ZvuGcnqkRHbNEHkulc48Ji?= =?iso-8859-1?Q?FDuNf5T1d/ea/JBQtvg5z1Alc46MvzymANJiYBwjYf5aymS+7BFDoOhXk/?= =?iso-8859-1?Q?z1kk9l+1qNqDUOmd+wEHFz/emHHN+5tpcDkSEI0FM=3D?= Content-Type: multipart/mixed; boundary="_002_TYSPR01MB62211EECB201FEFBB44EA565F0992TYSPR01MB6221apcp_" MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-b4c57.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYSPR01MB6221.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 94b60eb3-b45f-486f-3fae-08dcd0de2c70 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Sep 2024 14:46:22.6087 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR01MB5142 Subject: Re: [musl] Adding dns/resolver tests to libc-test --_002_TYSPR01MB62211EECB201FEFBB44EA565F0992TYSPR01MB6221apcp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > My intent was that you call enter_dns_test_ns from the test process=0A= > itself, not from a separate wrapper to exec it. This is so you don't=0A= > end up having a program in the tests dir that, when executed=0A= > independently as root, clobbers the host system's resolv.conf or hosts=0A= > file (which would be really really bad). By entering the namespace in=0A= > the same process and testing for error, you can bail out before doing=0A= > anything if the namespace setup failed. This also avoids the need to=0A= > add extra control machinery to run the tests.=0A= =0A= No problems, understood, I saw the exec call in the unshare-ns.c file =0A= and got confused. I have refactored the test attached, and added the =0A= unshare-ns.c file to the src/common/ directory in libc-test, and exposed=0A= the enter_dns_test_ns method in the test.h header file. Is this an =0A= appropriate solution?=0A= =0A= The attached res_query test tests for expected domain names, classes,=0A= types and response data from given requests. I'm yet to implement TCP=0A= or IPV6, and wanted to ask if v4/v6 should be in separate test files, =0A= as to ensure the test files aren't too long-winded. I've tried to structure= =0A= the test so it's as simple as specifying a domain name, and its expected RR= =0A= data. The test just then iterates through the domains to test, the server r= eturns=0A= the hardcoded packets, and checks are performed.=0A= =0A= Is this somewhat along the lines of what you are looking for?=0A= =0A= Thanks,=0A= rw=0A= --_002_TYSPR01MB62211EECB201FEFBB44EA565F0992TYSPR01MB6221apcp_ Content-Type: text/x-csrc; name="resolv_query.c" Content-Description: resolv_query.c Content-Disposition: attachment; filename="resolv_query.c"; size=9256; creation-date="Mon, 09 Sep 2024 14:44:02 G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CgkiXHhjMFx4YThceDExXHgwMyIKCiNk ZWZpbmUgVEVTVF9JUFY0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBcCglETlNfUEFDS0VUKCJleGFtcGxlLmNvbSIsIDB4MDEsIDB4MDEsIEVYQU1QTEVf QU5TV0VSX1JSLCAweDAxLCBcCgkgICAgICAgICAgIHNpemVvZihFWEFNUExFX0FOU1dFUl9SUikp CgojZGVmaW5lIFRFU1RfTE9OR19ET01BSU4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBcCglETlNfUEFDS0VUKCJmb28uYmFyLmV4YW1wbGUuY29tIiwg MHgwMSwgMHgwMSwgRVhBTVBMRV9BTlNXRVJfUlIsIDB4MDEsIFwKCSAgICAgICAgICAgc2l6ZW9m KEVYQU1QTEVfQU5TV0VSX1JSKSkKCiNkZWZpbmUgVEVTVF9FWFRFTkRFRF9SRVNQT05TRSAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCglETlNfUEFDS0VUKCJmaXp6LmJ1 enouY29tIiwgMHgwMSwgMHgwMSwgRVhURU5ERURfQU5TV0VSX1JSLCAweDAyLCBcCgkgICAgICAg ICAgIHNpemVvZihFWFRFTkRFRF9BTlNXRVJfUlIpKQoKc3RhdGljIHRlc3RfZG5zX3BhY2tldCBk bnNfdGVzdHNbXSA9IHtURVNUX0lQVjQsIFRFU1RfTE9OR19ET01BSU4sCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgVEVTVF9FWFRFTkRFRF9SRVNQT05TRX07CnN0YXRpYyBj b25zdCBzaXplX3QgZG5zX3Rlc3RfY291bnQgPSBzaXplb2YoZG5zX3Rlc3RzKSAvIHNpemVvZigq ZG5zX3Rlc3RzKTsKCi8vIFdhaXQgdW50aWwgc2VydmluZyB0aHJlYWQgaXMgcmVhZHkgdG8gcmVj ZWl2ZQpwdGhyZWFkX2JhcnJpZX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