rename vtable field arp->mac

This commit is contained in:
Pablo S. Torralba 2014-10-29 11:29:04 -07:00 committed by Teddy Reed
parent 4f524abbea
commit c7fc2cee22
3 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ QueryData genArp() {
int ret;
char ip[32];
char arp[64];
char mac[64];
char iface[32];
// We are already calling 'popen', let's give it some more work with sed to clean.
@ -28,10 +28,10 @@ QueryData genArp() {
ret = getline(&line, &length, arp_cmd_output);
while (ret > 0) {
sscanf(line, "%s %s %s", ip, arp, iface);
sscanf(line, "%s %s %s", ip, mac, iface);
r["ip"] = ip;
r["arp"] = arp;
r["mac"] = mac;
r["iface"] = iface;
results.push_back(r);

View File

@ -17,9 +17,9 @@ QueryData genArp() {
int ret;
char ip[32];
char arp[64];
char mac[64];
char iface[32];
char foo[128];
char ignore_field[128];
// We are already calling 'popen', let's give it some more work with sed to clean.
proc_arp_fd = fopen("/proc/net/arp" , "r");
@ -31,10 +31,10 @@ QueryData genArp() {
ret = getline(&line, &length, proc_arp_fd);
while (ret > 0) {
// IP address HW type Flags HW address Mask Device
sscanf(line, "%s %s %s %s %s %s", ip, foo, foo, arp, foo, iface);
sscanf(line, "%s %s %s %s %s %s", ip, ignore_field, ignore_field, mac, ignore_field, iface);
r["ip"] = ip;
r["arp"] = arp;
r["mac"] = mac;
r["iface"] = iface;
results.push_back(r);

View File

@ -1,7 +1,7 @@
table_name("arp")
schema([
Column(name="ip", type="std::string"),
Column(name="arp", type="std::string"),
Column(name="mac", type="std::string"),
Column(name="iface", type="std::string"),
])
implementation("arp@genArp")