diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-09-15 20:01:00 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-09-15 20:01:00 -0700 |
commit | 2a147a610df53ab6d7623cfcb2b1adce24d24a64 (patch) | |
tree | d3cb950a560d08e7ae2242b43de5732952d2abac /src | |
parent | 55afc94e94948597b63c2d2f95b6978e73735612 (diff) |
core: Remove legacy parsing of OUI database
Diffstat (limited to 'src')
-rw-r--r-- | src/oui.c | 68 |
1 files changed, 1 insertions, 67 deletions
@@ -66,74 +66,8 @@ done: return comp; } #else -#include <stdio.h> -#include <errno.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/mman.h> - -/* http://standards.ieee.org/regauth/oui/oui.txt */ - -#ifndef OUIFILE -#define OUIFILE "/usr/share/hwdata/oui.txt" -#endif - -static char *ouitocomp(const char *oui) -{ - struct stat st; - char *str, *map, *off, *end; - int fd; - - fd = open(OUIFILE, O_RDONLY); - if (fd < 0) - return NULL; - - if (fstat(fd, &st) < 0) { - close(fd); - return NULL; - } - - str = malloc(128); - if (!str) { - close(fd); - return NULL; - } - - memset(str, 0, 128); - - map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (!map || map == MAP_FAILED) { - free(str); - close(fd); - return NULL; - } - - off = strstr(map, oui); - if (off) { - off += 18; - end = strpbrk(off, "\r\n"); - strncpy(str, off, end - off); - } else { - free(str); - str = NULL; - } - - munmap(map, st.st_size); - - close(fd); - - return str; -} - char *batocomp(const bdaddr_t *ba) { - char oui[9]; - - sprintf(oui, "%2.2X-%2.2X-%2.2X", ba->b[5], ba->b[4], ba->b[3]); - - return ouitocomp(oui); + return NULL; } #endif |