mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-07 19:14:17 +00:00
fixed bug with interface specifications to allow - in dummynet paths.
This commit is contained in:
parent
fefe7d2e91
commit
5d3e9a21f7
@ -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<strlen(arg)) { free(r); return WHY("Extra junk at end of interface specification"); }
|
||||
@ -271,9 +271,14 @@ int overlay_interface_init(char *name,struct sockaddr_in src_addr,struct sockadd
|
||||
if (name[0]=='>') {
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user