summaryrefslogtreecommitdiffstats
path: root/bpf.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-31 10:23:59 +0000
committerRoy Marples <roy@marples.name>2008-03-31 10:23:59 +0000
commit211da073490c5decd1deb46034385437a54ca977 (patch)
treed3b10cacc4b36f14238f6ec89170114089f969bd /bpf.c
parent0a204e3b9886bd2a88084a5d5796a997ca610c84 (diff)
downloaddhcpcd-211da073490c5decd1deb46034385437a54ca977.tar.xz
read(2) works on ssize_t so we should use this rather than size_t for our buffers. A DHCP or ARP packet still easily fits into this.
Diffstat (limited to 'bpf.c')
-rw-r--r--bpf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bpf.c b/bpf.c
index 5e978ecd..0266b696 100644
--- a/bpf.c
+++ b/bpf.c
@@ -115,7 +115,7 @@ open_socket(struct interface *iface, int protocol)
ssize_t
send_packet(const struct interface *iface, int type,
- const unsigned char *data, size_t len)
+ const unsigned char *data, ssize_t len)
{
struct iovec iov[2];
struct ether_header hw;
@@ -135,7 +135,7 @@ send_packet(const struct interface *iface, int type,
* So we pass the buffer in the API so we can loop on >1 dhcp packet. */
ssize_t
get_packet(const struct interface *iface, unsigned char *data,
- unsigned char *buffer, size_t *buffer_len, size_t *buffer_pos)
+ unsigned char *buffer, ssize_t *buffer_len, ssize_t *buffer_pos)
{
union
{
@@ -153,7 +153,7 @@ get_packet(const struct interface *iface, unsigned char *data,
struct udp_dhcp_packet *packet;
} pay;
struct timespec ts;
- size_t len;
+ ssize_t len;
unsigned char *payload;
bool have_data;
@@ -204,7 +204,7 @@ get_packet(const struct interface *iface, unsigned char *data,
/* Update the buffer_pos pointer */
bpf.buffer += BPF_WORDALIGN(bpf.packet->bh_hdrlen +
bpf.packet->bh_caplen);
- if ((unsigned)(bpf.buffer - buffer) < *buffer_len)
+ if (bpf.buffer - buffer < *buffer_len)
*buffer_pos = bpf.buffer - buffer;
else
*buffer_pos = 0;