From 5d3e9a21f7884470ed5a321f390dce03638c8b44 Mon Sep 17 00:00:00 2001 From: gardners Date: Thu, 21 Jun 2012 13:58:10 +0930 Subject: [PATCH] fixed bug with interface specifications to allow - in dummynet paths. --- overlay_interface.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/overlay_interface.c b/overlay_interface.c index 46a796ef..d9efdf56 100644 --- a/overlay_interface.c +++ b/overlay_interface.c @@ -114,7 +114,7 @@ int overlay_interface_arg(char *arg) if (!r) return WHY("calloc(struct interface rules),1) failed"); - if (sscanf(arg,"%[+-]%n%[^=+-]%n=%[^:]%n:%d%n:%[^:]%n", + if (sscanf(arg,"%[+-]%n%[^=:,]%n=%[^:]%n:%d%n:%[^:]%n", sign,&n,interface_name,&n,typestring,&n,&port,&n,speed,&n)>=1) { if (n') { I(fileP)=1; char dummyfile[1024]; - if (!FORM_SERVAL_INSTANCE_PATH(dummyfile, &name[1]) || (I(fd) = open(dummyfile,O_APPEND|O_RDWR)) < 1) { - return WHY("could not open dummy interface file for append"); - } + if (name[1]=='/') { + /* Absolute path */ + snprintf(dummyfile,1024,"%s",&name[1]); + } else + /* Relative to instance path */ + if (!FORM_SERVAL_INSTANCE_PATH(dummyfile, &name[1]) || (I(fd) = open(dummyfile,O_APPEND|O_RDWR)) < 1) { + return WHY("could not open dummy interface file for append"); + } /* Seek to end of file as initial reading point */ I(offset)=lseek(I(fd),0,SEEK_END); /* socket gets reused to hold file offset */ /* XXX later add pretend location information so that we can decide which "packets" to receive