summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-03-11 12:28:25 +0000
committerRoy Marples <roy@marples.name>2017-03-11 12:28:25 +0000
commit5c22c26610ff3202898c8de1d87a93fdb7856984 (patch)
tree507939f97ea85c43d3ab742da305b870e739c18e
parentde29cb22d9f734bf26791e0edd68abaf6bd20e3a (diff)
downloadparpd-5c22c26610ff3202898c8de1d87a93fdb7856984.tar.xz
Rename raw functions to bpf so they are more descriptive.
-rw-r--r--bpf.c6
-rw-r--r--lpf.c6
-rw-r--r--parpd.c8
-rw-r--r--parpd.h6
4 files changed, 13 insertions, 13 deletions
diff --git a/bpf.c b/bpf.c
index 8703d00..f0e3cf0 100644
--- a/bpf.c
+++ b/bpf.c
@@ -49,7 +49,7 @@
#include "bpf-filter.h"
int
-open_arp(struct interface *ifp)
+bpf_open_arp(struct interface *ifp)
{
int fd = -1;
struct ifreq ifr;
@@ -123,7 +123,7 @@ eexit:
}
ssize_t
-send_raw_packet(const struct interface *ifp,
+bpf_write(const struct interface *ifp,
const uint8_t *hwaddr, size_t hwlen,
const void *data, size_t len)
{
@@ -149,7 +149,7 @@ send_raw_packet(const struct interface *ifp,
/* BPF requires that we read the entire buffer.
* So we pass the buffer in the API so we can loop on >1 packet. */
ssize_t
-get_raw_packet(struct interface *ifp, void *data, size_t len)
+bpf_read(struct interface *ifp, void *data, size_t len)
{
struct bpf_hdr packet;
ssize_t bytes;
diff --git a/lpf.c b/lpf.c
index 0a49c8e..88e2c1d 100644
--- a/lpf.c
+++ b/lpf.c
@@ -54,7 +54,7 @@
#include "parpd.h"
int
-open_arp(struct interface *ifp)
+bpf_open_arp(struct interface *ifp)
{
int s, flags;
union sockunion {
@@ -103,7 +103,7 @@ eexit:
}
ssize_t
-send_raw_packet(const struct interface *ifp,
+bpf_write(const struct interface *ifp,
const uint8_t *hwaddr, size_t hwlen,
const void *data, size_t len)
{
@@ -127,7 +127,7 @@ send_raw_packet(const struct interface *ifp,
}
ssize_t
-get_raw_packet(struct interface *ifp, void *data, size_t len)
+bpf_read(struct interface *ifp, void *data, size_t len)
{
ssize_t bytes;
diff --git a/parpd.c b/parpd.c
index 2f9af85..0bfcc71 100644
--- a/parpd.c
+++ b/parpd.c
@@ -381,7 +381,7 @@ send_arp(const struct interface *ifp, int op, size_t hlen,
memcpy(p, &tip, sizeof(tip));
p += sizeof(tip);
len = (size_t)(p - arp_buffer);
- return send_raw_packet(ifp, tha, hlen, arp_buffer, len);
+ return bpf_write(ifp, tha, hlen, arp_buffer, len);
}
/* Checks an incoming ARP message to see if we should proxy for it. */
@@ -399,7 +399,7 @@ handle_arp(void *arg)
int action;
for(;;) {
- bytes = get_raw_packet(ifp, arp_buffer, sizeof(arp_buffer));
+ bytes = bpf_read(ifp, arp_buffer, sizeof(arp_buffer));
if (bytes == 0 || bytes == -1)
return;
/* We must have a full ARP header */
@@ -542,8 +542,8 @@ discover_interfaces(struct eloop *eloop, int argc, char * const *argv)
/* Open the ARP socket before adding to the hashtable
* because we can't remove it from the hashtable if
* there is an error. */
- if ((ifp->fd = open_arp(ifp)) == -1) {
- syslog(LOG_ERR, "%s: open_arp: %m", ifa->ifa_name);
+ if ((ifp->fd = bpf_open_arp(ifp)) == -1) {
+ syslog(LOG_ERR, "%s: bpf_open_arp: %m", ifa->ifa_name);
free(ifp);
continue;
}
diff --git a/parpd.h b/parpd.h
index c9da379..73e2e98 100644
--- a/parpd.h
+++ b/parpd.h
@@ -64,10 +64,10 @@ struct interface
struct pent *pents;
};
-int open_arp(struct interface *);
-ssize_t send_raw_packet(const struct interface *,
+int bpf_open_arp(struct interface *);
+ssize_t bpf_write(const struct interface *,
const uint8_t *, size_t, const void *, size_t);
-ssize_t get_raw_packet(struct interface *, void *, size_t);
+ssize_t bpf_read(struct interface *, void *, size_t);
#define UNCONST(a) ((void *)(unsigned long)(const void *)(a))