diff options
author | Skylar Chang <chiaweic@codeaurora.org> | 2014-08-13 12:43:57 -0700 |
---|---|---|
committer | Skylar Chang <chiaweic@codeaurora.org> | 2014-08-13 12:43:57 -0700 |
commit | 49e65abef920eb377b79d5db4535084c950e0cf4 (patch) | |
tree | 2758c3ecf36e424d24e493d3b9d016e220206e81 /ipanat | |
parent | 6a1e1fc21072e87244c2a207e18d6d4e33252f9f (diff) | |
download | ipacfg-mgr-49e65abef920eb377b79d5db4535084c950e0cf4.tar.gz |
ipanat: move ipaNatTable device node creation
For running ipacm/ipanat as net_admin instead of
root on Android. The dev/ipaNatTable device node
creation should be done in bootup time instead of
dynamic allocate.
Change-Id: Ice77752fa31b5d72f0fe5df23734801783e92253
Diffstat (limited to 'ipanat')
-rw-r--r-- | ipanat/src/ipa_nat_drvi.c | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/ipanat/src/ipa_nat_drvi.c b/ipanat/src/ipa_nat_drvi.c index 75b38a8..74161a7 100644 --- a/ipanat/src/ipa_nat_drvi.c +++ b/ipanat/src/ipa_nat_drvi.c @@ -165,24 +165,7 @@ uint32_t Read32BitFieldValue(uint32_t param, */ int CreateNatDevice(struct ipa_ioc_nat_alloc_mem *mem) { -#define EVENT_SIZE (sizeof (struct inotify_event)) -#define FILE_NAME_LENGTH (sizeof(NAT_DEV_NAME)*2 + 1) -#define BUF_LEN (EVENT_SIZE + FILE_NAME_LENGTH) - - int length; - int wd; - char buffer[BUF_LEN]; - int ret, inotify_fd; - - inotify_fd = inotify_init(); - if (inotify_fd < 0) { - perror("inotify_init"); - return -EINVAL; - } - - IPADBG("Waiting for nofications in dir %s\n", NAT_DEV_DIR); - wd = inotify_add_watch(inotify_fd, - NAT_DEV_DIR, IN_CREATE); + int ret; ret = ioctl(ipv4_nat_cache.ipa_fd, IPA_IOC_ALLOC_NAT_MEM, mem); if (ret != 0) { @@ -192,27 +175,6 @@ int CreateNatDevice(struct ipa_ioc_nat_alloc_mem *mem) return -EINVAL; } IPADBG("posted IPA_IOC_ALLOC_NAT_MEM to kernel successfully\n"); - - length = read(inotify_fd, buffer, BUF_LEN); - - if (length < 0) { - perror("inotify read"); - return -EINVAL; - } - - struct inotify_event *event = (struct inotify_event *)buffer; - if (event->len) { - if (event->mask & IN_CREATE) { - if (event->mask & IN_ISDIR) { - IPADBG("The directory %s was created.\n", event->name); - } else { - IPADBG("The file %s was created.\n", event->name); - } - } - } - - (void) inotify_rm_watch(inotify_fd, wd); - (void) close(inotify_fd); return 0; } |