diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-09-16 20:17:57 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-09-16 20:17:57 +0200 |
commit | 85bdc5b94c8a1730d3077f361297028cfd8b9b78 (patch) | |
tree | a6835c355fde8ce9f36c808dbb9b50809d3c77f4 /package/ramips/applications/hwnat/src/acl_api.c | |
parent | 6e0004f572f23810c21d5fb4477d8b9347dffdbb (diff) | |
download | mtk-20170518-85bdc5b94c8a1730d3077f361297028cfd8b9b78.zip mtk-20170518-85bdc5b94c8a1730d3077f361297028cfd8b9b78.tar.gz mtk-20170518-85bdc5b94c8a1730d3077f361297028cfd8b9b78.tar.bz2 |
MTK mt76 hwnat implementationHEADmtk-20170518
Diffstat (limited to 'package/ramips/applications/hwnat/src/acl_api.c')
-rwxr-xr-x | package/ramips/applications/hwnat/src/acl_api.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/package/ramips/applications/hwnat/src/acl_api.c b/package/ramips/applications/hwnat/src/acl_api.c new file mode 100755 index 0000000..13d97b0 --- /dev/null +++ b/package/ramips/applications/hwnat/src/acl_api.c @@ -0,0 +1,52 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <getopt.h> +#include "acl_ioctl.h" + +int SetAclEntry(struct acl_args *opt, unsigned int cmd) +{ + int fd; + + fd = open("/dev/"ACL_DEVNAME, O_RDONLY); + if (fd < 0) + { + printf("Open %s pseudo device failed\n","/dev/"ACL_DEVNAME); + return ACL_FAIL; + } + + if(ioctl(fd, cmd, opt)<0) + { + printf("ACL_API: ioctl error\n"); + close(fd); + return ACL_FAIL; + } + + close(fd); + return ACL_SUCCESS; +} +int AclGetAllEntries(struct acl_list_args *opt) +{ + int fd=0; + + fd = open("/dev/"ACL_DEVNAME, O_RDONLY); + if (fd < 0) + { + printf("Open %s pseudo device failed\n","/dev/"ACL_DEVNAME); + return ACL_FAIL; + } + + if(ioctl(fd, ACL_GET_ALL_ENTRIES, opt)<0) + { + printf("ACL_API: ioctl error\n"); + close(fd); + return ACL_FAIL; + } + + close(fd); + + return ACL_SUCCESS; + +} |