libpfct: Return errno from pfctl_add_eth_rule()
If the pfctl_add_eth_rule() ioctl fails return the errno, not the error returned by ioctl(). That will give us slightly more insight into what went wrong, because ioctl() would always return -1. Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
9bb06778f8
commit
514039bb90
@ -786,7 +786,7 @@ pfctl_add_eth_rule(int dev, const struct pfctl_eth_rule *r, const char *anchor,
|
||||
struct pfioc_nv nv;
|
||||
nvlist_t *nvl, *addr;
|
||||
void *packed;
|
||||
int error;
|
||||
int error = 0;
|
||||
size_t size;
|
||||
|
||||
nvl = nvlist_create(0);
|
||||
@ -838,7 +838,8 @@ pfctl_add_eth_rule(int dev, const struct pfctl_eth_rule *r, const char *anchor,
|
||||
nv.size = size;
|
||||
nv.data = packed;
|
||||
|
||||
error = ioctl(dev, DIOCADDETHRULE, &nv);
|
||||
if (ioctl(dev, DIOCADDETHRULE, &nv) != 0)
|
||||
error = errno;
|
||||
|
||||
free(packed);
|
||||
nvlist_destroy(nvl);
|
||||
|
Loading…
Reference in New Issue
Block a user