diff options
| author | Roy Marples <roy@marples.name> | 2017-03-11 12:28:25 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2017-03-11 12:28:25 +0000 |
| commit | 5c22c26610ff3202898c8de1d87a93fdb7856984 (patch) | |
| tree | 507939f97ea85c43d3ab742da305b870e739c18e | |
| parent | de29cb22d9f734bf26791e0edd68abaf6bd20e3a (diff) | |
| download | parpd-5c22c26610ff3202898c8de1d87a93fdb7856984.tar.xz | |
Rename raw functions to bpf so they are more descriptive.
| -rw-r--r-- | bpf.c | 6 | ||||
| -rw-r--r-- | lpf.c | 6 | ||||
| -rw-r--r-- | parpd.c | 8 | ||||
| -rw-r--r-- | parpd.h | 6 |
4 files changed, 13 insertions, 13 deletions
@@ -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; @@ -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; @@ -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; } @@ -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)) |
