add patch from Matthew Luckie (upstream) to handle nameserver lines with comments

This commit is contained in:
sthen 2021-10-28 12:09:25 +00:00
parent bcf7a7417c
commit bec3263932
2 changed files with 31 additions and 3 deletions

View File

@ -1,12 +1,11 @@
# $OpenBSD: Makefile,v 1.46 2021/10/27 09:22:47 sthen Exp $
# XXX needs a fix to cope with resolvd's comments on the "nameserver" line
# $OpenBSD: Makefile,v 1.47 2021/10/28 12:09:25 sthen Exp $
SHARED_LIBS += scamperfile 3.0 # 2.0
COMMENT = parallel internet measurement utility
V = 20211026
REVISION = 0
DISTNAME = scamper-cvs-$V
PKGNAME = scamper-$V

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-scamper_host_scamper_host_do_c,v 1.1 2021/10/28 12:09:25 sthen Exp $
Index: scamper/host/scamper_host_do.c
--- scamper/host/scamper_host_do.c.orig
+++ scamper/host/scamper_host_do.c
@@ -1419,7 +1419,7 @@ static void do_host_free(scamper_task_t *task)
static int etc_resolv_line(char *line, void *param)
{
scamper_addr_t *sa;
- int x = 0;
+ int x = 0, y;
if(line[0] == '\0' || line[0] == '#')
return 0;
@@ -1431,6 +1431,14 @@ static int etc_resolv_line(char *line, void *param)
x++;
if(x == 10 || line[x] == '\0')
return 0;
+
+ /* null terminate at spaces / comments */
+ y = x;
+ while(isspace(line[y]) == 0 && line[y] != '\0' && line[y] != '#' &&
+ line[y] != ';')
+ y++;
+ line[y] = '\0';
+
if(strcasecmp(line+x, "fe80::1") == 0)
return 0;