summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2012-02-16 04:31:08 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2015-02-04 06:07:55 +0100
commitf8cfeb25e62206aaf940b2aabf6a96c36ad4627d (patch)
treeb585e4ca1a60c132329eef7c7ff589ed2103ce68
parente269b968fdcd44d7a4043c4e67c3e008f85e7379 (diff)
downloadquagga-f8cfeb25e62206aaf940b2aabf6a96c36ad4627d.tar.bz2
quagga-f8cfeb25e62206aaf940b2aabf6a96c36ad4627d.tar.xz
pimd: fix worst char * <> uint8_t * intermingling
-rw-r--r--pimd/pim_assert.c6
-rw-r--r--pimd/pim_assert.h2
-rw-r--r--pimd/pim_cmd.c22
-rw-r--r--pimd/pim_hello.c14
-rw-r--r--pimd/pim_hello.h4
-rw-r--r--pimd/pim_igmp.c4
-rw-r--r--pimd/pim_join.c12
-rw-r--r--pimd/pim_join.h2
-rw-r--r--pimd/pim_msg.c20
-rw-r--r--pimd/pim_msg.h20
-rw-r--r--pimd/pim_pim.c10
-rw-r--r--pimd/pim_pim.h4
-rw-r--r--pimd/pim_sock.c2
-rw-r--r--pimd/pim_sock.h2
-rw-r--r--pimd/pim_ssmpingd.c4
-rw-r--r--pimd/pim_tlv.c90
-rw-r--r--pimd/pim_tlv.h48
17 files changed, 129 insertions, 137 deletions
diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c
index 52168d69..6b062b77 100644
--- a/pimd/pim_assert.c
+++ b/pimd/pim_assert.c
@@ -236,13 +236,13 @@ static int dispatch_assert(struct interface *ifp,
int pim_assert_recv(struct interface *ifp,
struct pim_neighbor *neigh,
struct in_addr src_addr,
- char *buf, int buf_size)
+ uint8_t *buf, int buf_size)
{
struct prefix msg_group_addr;
struct prefix msg_source_addr;
struct pim_assert_metric msg_metric;
int offset;
- char *curr;
+ uint8_t *curr;
int curr_size;
on_trace(__PRETTY_FUNCTION__, ifp, src_addr);
@@ -445,7 +445,7 @@ static int pim_assert_do(struct pim_ifchannel *ch,
{
struct interface *ifp;
struct pim_interface *pim_ifp;
- char pim_msg[1000];
+ uint8_t pim_msg[1000];
int pim_msg_size;
ifp = ch->interface;
diff --git a/pimd/pim_assert.h b/pimd/pim_assert.h
index feeb91df..bd3fb3e2 100644
--- a/pimd/pim_assert.h
+++ b/pimd/pim_assert.h
@@ -51,7 +51,7 @@ void pim_ifassert_winner_set(struct pim_ifchannel *ch,
int pim_assert_recv(struct interface *ifp,
struct pim_neighbor *neigh,
struct in_addr src_addr,
- char *buf, int buf_size);
+ uint8_t *buf, int buf_size);
int pim_assert_metric_better(const struct pim_assert_metric *m1,
const struct pim_assert_metric *m2);
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index dd06b070..f046801d 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3567,8 +3567,8 @@ DEFUN (test_pim_receive_dump,
"Neighbor address\n"
"Packet dump\n")
{
- char buf[1000];
- char *pim_msg;
+ uint8_t buf[1000];
+ uint8_t *pim_msg;
struct ip *ip_hdr;
size_t ip_hlen; /* ip header length in bytes */
int ip_msg_len;
@@ -3685,8 +3685,8 @@ DEFUN (test_pim_receive_hello,
"Neighbor LAN prune delay T-bit\n"
"Neighbor secondary addresses\n")
{
- char buf[1000];
- char *pim_msg;
+ uint8_t buf[1000];
+ uint8_t *pim_msg;
struct ip *ip_hdr;
size_t ip_hlen; /* ip header length in bytes */
int ip_msg_len;
@@ -3810,9 +3810,9 @@ DEFUN (test_pim_receive_assert,
"Assert route metric\n"
"Assert RPT bit flag\n")
{
- char buf[1000];
- char *buf_pastend = buf + sizeof(buf);
- char *pim_msg;
+ uint8_t buf[1000];
+ uint8_t *buf_pastend = buf + sizeof(buf);
+ uint8_t *pim_msg;
struct ip *ip_hdr;
size_t ip_hlen; /* ip header length in bytes */
int ip_msg_len;
@@ -3921,10 +3921,10 @@ static int recv_joinprune(struct vty *vty,
const char *argv[],
int src_is_join)
{
- char buf[1000];
- const char *buf_pastend = buf + sizeof(buf);
- char *pim_msg;
- char *pim_msg_curr;
+ uint8_t buf[1000];
+ const uint8_t *buf_pastend = buf + sizeof(buf);
+ uint8_t *pim_msg;
+ uint8_t *pim_msg_curr;
int pim_msg_size;
struct ip *ip_hdr;
size_t ip_hlen; /* ip header length in bytes */
diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c
index c942de4d..73c50d4f 100644
--- a/pimd/pim_hello.c
+++ b/pimd/pim_hello.c
@@ -146,12 +146,12 @@ static void tlv_trace_list(const char *label, const char *tlv_name,
int pim_hello_recv(struct interface *ifp,
struct in_addr src_addr,
- char *tlv_buf, int tlv_buf_size)
+ uint8_t *tlv_buf, int tlv_buf_size)
{
struct pim_interface *pim_ifp;
struct pim_neighbor *neigh;
- char *tlv_curr;
- char *tlv_pastend;
+ uint8_t *tlv_curr;
+ uint8_t *tlv_pastend;
pim_hello_options hello_options = 0; /* bit array recording options found */
uint16_t hello_option_holdtime = 0;
uint16_t hello_option_propagation_delay = 0;
@@ -422,7 +422,7 @@ int pim_hello_recv(struct interface *ifp,
}
int pim_hello_build_tlv(const char *ifname,
- char *tlv_buf, int tlv_buf_size,
+ uint8_t *tlv_buf, int tlv_buf_size,
uint16_t holdtime,
uint32_t dr_priority,
uint32_t generation_id,
@@ -431,9 +431,9 @@ int pim_hello_build_tlv(const char *ifname,
int can_disable_join_suppression,
struct list *ifconnected)
{
- char *curr = tlv_buf;
- char *pastend = tlv_buf + tlv_buf_size;
- char *tmp;
+ uint8_t *curr = tlv_buf;
+ uint8_t *pastend = tlv_buf + tlv_buf_size;
+ uint8_t *tmp;
/*
* Append options
diff --git a/pimd/pim_hello.h b/pimd/pim_hello.h
index 90a11ba6..b5e272d5 100644
--- a/pimd/pim_hello.h
+++ b/pimd/pim_hello.h
@@ -29,10 +29,10 @@
int pim_hello_recv(struct interface *ifp,
struct in_addr src_addr,
- char *tlv_buf, int tlv_buf_size);
+ uint8_t *tlv_buf, int tlv_buf_size);
int pim_hello_build_tlv(const char *ifname,
- char *tlv_buf, int tlv_buf_size,
+ uint8_t *tlv_buf, int tlv_buf_size,
uint16_t holdtime,
uint32_t dr_priority,
uint32_t generation_id,
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index dcb9a9ba..6ad521ca 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -930,7 +930,7 @@ static int pim_igmp_read(struct thread *t)
struct sockaddr_in to;
socklen_t fromlen = sizeof(from);
socklen_t tolen = sizeof(to);
- char buf[PIM_IGMP_BUFSIZE_READ];
+ uint8_t buf[PIM_IGMP_BUFSIZE_READ];
int len;
int ifindex = -1;
int result = -1; /* defaults to bad */
@@ -995,7 +995,7 @@ static int pim_igmp_read(struct thread *t)
}
#endif
- if (pim_igmp_packet(igmp, buf, len)) {
+ if (pim_igmp_packet(igmp, (char *)buf, len)) {
goto done;
}
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index aa3aa789..5230bb6c 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -107,14 +107,14 @@ static void recv_prune(struct interface *ifp,
int pim_joinprune_recv(struct interface *ifp,
struct pim_neighbor *neigh,
struct in_addr src_addr,
- char *tlv_buf, int tlv_buf_size)
+ uint8_t *tlv_buf, int tlv_buf_size)
{
struct prefix msg_upstream_addr;
uint8_t msg_num_groups;
uint16_t msg_holdtime;
int addr_offset;
- char *buf;
- char *pastend;
+ uint8_t *buf;
+ uint8_t *pastend;
int remain;
int group;
@@ -280,9 +280,9 @@ int pim_joinprune_send(struct interface *ifp,
int send_join)
{
struct pim_interface *pim_ifp;
- char pim_msg[1000];
- const char *pastend = pim_msg + sizeof(pim_msg);
- char *pim_msg_curr = pim_msg + PIM_MSG_HEADER_LEN; /* room for pim header */
+ uint8_t pim_msg[1000];
+ const uint8_t *pastend = pim_msg + sizeof(pim_msg);
+ uint8_t *pim_msg_curr = pim_msg + PIM_MSG_HEADER_LEN; /* room for pim header */
int pim_msg_size;
int remain;
diff --git a/pimd/pim_join.h b/pimd/pim_join.h
index 4d9407be..37ec0f45 100644
--- a/pimd/pim_join.h
+++ b/pimd/pim_join.h
@@ -32,7 +32,7 @@
int pim_joinprune_recv(struct interface *ifp,
struct pim_neighbor *neigh,
struct in_addr src_addr,
- char *tlv_buf, int tlv_buf_size);
+ uint8_t *tlv_buf, int tlv_buf_size);
int pim_joinprune_send(struct interface *ifp,
struct in_addr upstream_addr,
diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c
index 1105eaca..7eb63e85 100644
--- a/pimd/pim_msg.c
+++ b/pimd/pim_msg.c
@@ -27,7 +27,7 @@
#include "pim_msg.h"
#include "pim_util.h"
-void pim_msg_build_header(char *pim_msg, int pim_msg_size,
+void pim_msg_build_header(uint8_t *pim_msg, int pim_msg_size,
uint8_t pim_msg_type)
{
uint16_t checksum;
@@ -50,9 +50,9 @@ void pim_msg_build_header(char *pim_msg, int pim_msg_size,
*(uint16_t *) PIM_MSG_HDR_OFFSET_CHECKSUM(pim_msg) = checksum;
}
-char *pim_msg_addr_encode_ipv4_ucast(char *buf,
- int buf_size,
- struct in_addr addr)
+uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf,
+ int buf_size,
+ struct in_addr addr)
{
const int ENCODED_IPV4_UCAST_SIZE = 6;
@@ -67,9 +67,9 @@ char *pim_msg_addr_encode_ipv4_ucast(char *buf,
return buf + ENCODED_IPV4_UCAST_SIZE;
}
-char *pim_msg_addr_encode_ipv4_group(char *buf,
- int buf_size,
- struct in_addr addr)
+uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf,
+ int buf_size,
+ struct in_addr addr)
{
const int ENCODED_IPV4_GROUP_SIZE = 8;
@@ -86,9 +86,9 @@ char *pim_msg_addr_encode_ipv4_group(char *buf,
return buf + ENCODED_IPV4_GROUP_SIZE;
}
-char *pim_msg_addr_encode_ipv4_source(char *buf,
- int buf_size,
- struct in_addr addr)
+uint8_t *pim_msg_addr_encode_ipv4_source(uint8_t *buf,
+ int buf_size,
+ struct in_addr addr)
{
const int ENCODED_IPV4_SOURCE_SIZE = 8;
diff --git a/pimd/pim_msg.h b/pimd/pim_msg.h
index 228d6a85..a884fc84 100644
--- a/pimd/pim_msg.h
+++ b/pimd/pim_msg.h
@@ -37,16 +37,16 @@
*/
#define PIM_MSG_ADDRESS_FAMILY_IPV4 (1)
-void pim_msg_build_header(char *pim_msg, int pim_msg_size,
+void pim_msg_build_header(uint8_t *pim_msg, int pim_msg_size,
uint8_t pim_msg_type);
-char *pim_msg_addr_encode_ipv4_ucast(char *buf,
- int buf_size,
- struct in_addr addr);
-char *pim_msg_addr_encode_ipv4_group(char *buf,
- int buf_size,
- struct in_addr addr);
-char *pim_msg_addr_encode_ipv4_source(char *buf,
- int buf_size,
- struct in_addr addr);
+uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf,
+ int buf_size,
+ struct in_addr addr);
+uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf,
+ int buf_size,
+ struct in_addr addr);
+uint8_t *pim_msg_addr_encode_ipv4_source(uint8_t *buf,
+ int buf_size,
+ struct in_addr addr);
#endif /* PIM_MSG_H */
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index 156081ca..8dd71d66 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -111,13 +111,13 @@ void pim_sock_delete(struct interface *ifp, const char *delete_message)
sock_close(ifp);
}
-int pim_pim_packet(struct interface *ifp, char *buf, size_t len)
+int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
{
struct ip *ip_hdr;
size_t ip_hlen; /* ip header length in bytes */
char src_str[100];
char dst_str[100];
- char *pim_msg;
+ uint8_t *pim_msg;
int pim_msg_len;
uint8_t pim_version;
uint8_t pim_type;
@@ -253,7 +253,7 @@ static int pim_sock_read(struct thread *t)
struct sockaddr_in to;
socklen_t fromlen = sizeof(from);
socklen_t tolen = sizeof(to);
- char buf[PIM_PIM_BUFSIZE_READ];
+ uint8_t buf[PIM_PIM_BUFSIZE_READ];
int len;
int ifindex = -1;
int result = -1; /* defaults to bad */
@@ -437,7 +437,7 @@ void pim_sock_reset(struct interface *ifp)
int pim_msg_send(int fd,
struct in_addr dst,
- char *pim_msg,
+ uint8_t *pim_msg,
int pim_msg_size,
const char *ifname)
{
@@ -494,7 +494,7 @@ int pim_msg_send(int fd,
static int hello_send(struct interface *ifp,
uint16_t holdtime)
{
- char pim_msg[PIM_PIM_BUFSIZE_WRITE];
+ uint8_t pim_msg[PIM_PIM_BUFSIZE_WRITE];
struct pim_interface *pim_ifp;
int pim_tlv_size;
int pim_msg_size;
diff --git a/pimd/pim_pim.h b/pimd/pim_pim.h
index a2c8fa58..6be1a3e6 100644
--- a/pimd/pim_pim.h
+++ b/pimd/pim_pim.h
@@ -60,11 +60,11 @@ void pim_sock_delete(struct interface *ifp, const char *delete_message);
void pim_hello_restart_now(struct interface *ifp);
void pim_hello_restart_triggered(struct interface *ifp);
-int pim_pim_packet(struct interface *ifp, char *buf, size_t len);
+int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len);
int pim_msg_send(int fd,
struct in_addr dst,
- char *pim_msg,
+ uint8_t *pim_msg,
int pim_msg_size,
const char *ifname);
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index b80c0a22..4816c567 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -249,7 +249,7 @@ int pim_socket_join_source(int fd, int ifindex,
return 0;
}
-int pim_socket_recvfromto(int fd, char *buf, size_t len,
+int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
struct sockaddr_in *from, socklen_t *fromlen,
struct sockaddr_in *to, socklen_t *tolen,
int *ifindex)
diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h
index 29b5aeed..cfe39ad1 100644
--- a/pimd/pim_sock.h
+++ b/pimd/pim_sock.h
@@ -45,7 +45,7 @@ int pim_socket_join_source(int fd, int ifindex,
struct in_addr group_addr,
struct in_addr source_addr,
const char *ifname);
-int pim_socket_recvfromto(int fd, char *buf, size_t len,
+int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
struct sockaddr_in *from, socklen_t *fromlen,
struct sockaddr_in *to, socklen_t *tolen,
int *ifindex);
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index 652999d4..fd1eac06 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -215,7 +215,7 @@ static void ssmpingd_delete(struct ssmpingd_sock *ss)
}
static void ssmpingd_sendto(struct ssmpingd_sock *ss,
- const char *buf,
+ const uint8_t *buf,
int len,
struct sockaddr_in to)
{
@@ -250,7 +250,7 @@ static int ssmpingd_read_msg(struct ssmpingd_sock *ss)
socklen_t fromlen = sizeof(from);
socklen_t tolen = sizeof(to);
int ifindex = -1;
- char buf[1000];
+ uint8_t buf[1000];
int len;
++ss->requests;
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index cb6b6540..4ce9a3d2 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -31,10 +31,10 @@
#include "pim_str.h"
#include "pim_msg.h"
-char *pim_tlv_append_uint16(uint8_t *buf,
- const uint8_t *buf_pastend,
- uint16_t option_type,
- uint16_t option_value)
+uint8_t *pim_tlv_append_uint16(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ uint16_t option_type,
+ uint16_t option_value)
{
uint16_t option_len = 2;
@@ -55,11 +55,11 @@ char *pim_tlv_append_uint16(uint8_t *buf,
return buf;
}
-char *pim_tlv_append_2uint16(uint8_t *buf,
- const uint8_t *buf_pastend,
- uint16_t option_type,
- uint16_t option_value1,
- uint16_t option_value2)
+uint8_t *pim_tlv_append_2uint16(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ uint16_t option_type,
+ uint16_t option_value1,
+ uint16_t option_value2)
{
uint16_t option_len = 4;
@@ -82,10 +82,10 @@ char *pim_tlv_append_2uint16(uint8_t *buf,
return buf;
}
-char *pim_tlv_append_uint32(uint8_t *buf,
- const uint8_t *buf_pastend,
- uint16_t option_type,
- uint32_t option_value)
+uint8_t *pim_tlv_append_uint32(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ uint16_t option_type,
+ uint32_t option_value)
{
uint16_t option_len = 4;
@@ -108,9 +108,9 @@ char *pim_tlv_append_uint32(uint8_t *buf,
#define ucast_ipv4_encoding_len (2 + sizeof(struct in_addr))
-char *pim_tlv_append_addrlist_ucast(uint8_t *buf,
- const uint8_t *buf_pastend,
- struct list *ifconnected)
+uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ struct list *ifconnected)
{
struct listnode *node;
uint16_t option_len = 0;
@@ -243,7 +243,7 @@ int pim_tlv_parse_holdtime(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint16_t *hello_option_holdtime,
uint16_t option_len,
- const char *tlv_curr)
+ const uint8_t *tlv_curr)
{
const char *label = "holdtime";
@@ -271,7 +271,7 @@ int pim_tlv_parse_lan_prune_delay(const char *ifname, struct in_addr src_addr,
uint16_t *hello_option_propagation_delay,
uint16_t *hello_option_override_interval,
uint16_t option_len,
- const char *tlv_curr)
+ const uint8_t *tlv_curr)
{
if (check_tlv_length(__PRETTY_FUNCTION__, "lan_prune_delay",
ifname, src_addr,
@@ -305,7 +305,7 @@ int pim_tlv_parse_dr_priority(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint32_t *hello_option_dr_priority,
uint16_t option_len,
- const char *tlv_curr)
+ const uint8_t *tlv_curr)
{
const char *label = "dr_priority";
@@ -332,7 +332,7 @@ int pim_tlv_parse_generation_id(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint32_t *hello_option_generation_id,
uint16_t option_len,
- const char *tlv_curr)
+ const uint8_t *tlv_curr)
{
const char *label = "generation_id";
@@ -357,12 +357,12 @@ int pim_tlv_parse_generation_id(const char *ifname, struct in_addr src_addr,
int pim_parse_addr_ucast(const char *ifname, struct in_addr src_addr,
struct prefix *p,
- const char *buf,
+ const uint8_t *buf,
int buf_size)
{
const int ucast_encoding_min_len = 3; /* 1 family + 1 type + 1 addr */
- const char *addr;
- const char *pastend;
+ const uint8_t *addr;
+ const uint8_t *pastend;
int family;
int type;
@@ -379,10 +379,8 @@ int pim_parse_addr_ucast(const char *ifname, struct in_addr src_addr,
addr = buf;
pastend = buf + buf_size;
- family = *(const uint8_t *) addr;
- ++addr;
- type = *(const uint8_t *) addr;
- ++addr;
+ family = *addr++;
+ type = *addr++;
switch (family) {
case PIM_MSG_ADDRESS_FAMILY_IPV4:
@@ -426,12 +424,12 @@ int pim_parse_addr_ucast(const char *ifname, struct in_addr src_addr,
int pim_parse_addr_group(const char *ifname, struct in_addr src_addr,
struct prefix *p,
- const char *buf,
+ const uint8_t *buf,
int buf_size)
{
const int grp_encoding_min_len = 4; /* 1 family + 1 type + 1 reserved + 1 addr */
- const char *addr;
- const char *pastend;
+ const uint8_t *addr;
+ const uint8_t *pastend;
int family;
int type;
int mask_len;
@@ -449,13 +447,11 @@ int pim_parse_addr_group(const char *ifname, struct in_addr src_addr,
addr = buf;
pastend = buf + buf_size;
- family = *(const uint8_t *) addr;
- ++addr;
- type = *(const uint8_t *) addr;
+ family = *addr++;
+ type = *addr++;
++addr;
++addr; /* skip b_reserved_z fields */
- mask_len = *(const uint8_t *) addr;
- ++addr;
+ mask_len = *addr++;
switch (family) {
case PIM_MSG_ADDRESS_FAMILY_IPV4:
@@ -503,12 +499,12 @@ int pim_parse_addr_source(const char *ifname,
struct in_addr src_addr,
struct prefix *p,
uint8_t *flags,
- const char *buf,
+ const uint8_t *buf,
int buf_size)
{
const int src_encoding_min_len = 4; /* 1 family + 1 type + 1 reserved + 1 addr */
- const char *addr;
- const char *pastend;
+ const uint8_t *addr;
+ const uint8_t *pastend;
int family;
int type;
int mask_len;
@@ -526,14 +522,10 @@ int pim_parse_addr_source(const char *ifname,
addr = buf;
pastend = buf + buf_size;
- family = *(const uint8_t *) addr;
- ++addr;
- type = *(const uint8_t *) addr;
- ++addr;
- *flags = *(const uint8_t *) addr;
- ++addr;
- mask_len = *(const uint8_t *) addr;
- ++addr;
+ family = *addr++;
+ type = *addr++;
+ *flags = *addr++;
+ mask_len = *addr++;
switch (family) {
case PIM_MSG_ADDRESS_FAMILY_IPV4:
@@ -607,10 +599,10 @@ int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
struct list **hello_option_addr_list,
uint16_t option_len,
- const char *tlv_curr)
+ const uint8_t *tlv_curr)
{
- const char *addr;
- const char *pastend;
+ const uint8_t *addr;
+ const uint8_t *pastend;
zassert(hello_option_addr_list);
diff --git a/pimd/pim_tlv.h b/pimd/pim_tlv.h
index 5ec3dc43..b802cf89 100644
--- a/pimd/pim_tlv.h
+++ b/pimd/pim_tlv.h
@@ -71,63 +71,63 @@ typedef uint32_t pim_hello_options;
#define PIM_TLV_MIN_SIZE (PIM_TLV_TYPE_SIZE + PIM_TLV_LENGTH_SIZE)
#define PIM_TLV_OPTION_SIZE(option_len) (PIM_TLV_MIN_SIZE + (option_len))
-char *pim_tlv_append_uint16(uint8_t *buf,
- const uint8_t *buf_pastend,
- uint16_t option_type,
- uint16_t option_value);
-char *pim_tlv_append_2uint16(uint8_t *buf,
- const uint8_t *buf_pastend,
- uint16_t option_type,
- uint16_t option_value1,
- uint16_t option_value2);
-char *pim_tlv_append_uint32(uint8_t *buf,
- const uint8_t *buf_pastend,
- uint16_t option_type,
- uint32_t option_value);
-char *pim_tlv_append_addrlist_ucast(uint8_t *buf,
- const uint8_t *buf_pastend,
- struct list *ifconnected);
+uint8_t *pim_tlv_append_uint16(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ uint16_t option_type,
+ uint16_t option_value);
+uint8_t *pim_tlv_append_2uint16(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ uint16_t option_type,
+ uint16_t option_value1,
+ uint16_t option_value2);
+uint8_t *pim_tlv_append_uint32(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ uint16_t option_type,
+ uint32_t option_value);
+uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf,
+ const uint8_t *buf_pastend,
+ struct list *ifconnected);
int pim_tlv_parse_holdtime(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint16_t *hello_option_holdtime,
uint16_t option_len,
- const char *tlv_curr);
+ const uint8_t *tlv_curr);
int pim_tlv_parse_lan_prune_delay(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint16_t *hello_option_propagation_delay,
uint16_t *hello_option_override_interval,
uint16_t option_len,
- const char *tlv_curr);
+ const uint8_t *tlv_curr);
int pim_tlv_parse_dr_priority(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint32_t *hello_option_dr_priority,
uint16_t option_len,
- const char *tlv_curr);
+ const uint8_t *tlv_curr);
int pim_tlv_parse_generation_id(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
uint32_t *hello_option_generation_id,
uint16_t option_len,
- const char *tlv_curr);
+ const uint8_t *tlv_curr);
int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
pim_hello_options *hello_options,
struct list **hello_option_addr_list,
uint16_t option_len,
- const char *tlv_curr);
+ const uint8_t *tlv_curr);
int pim_parse_addr_ucast(const char *ifname, struct in_addr src_addr,
struct prefix *p,
- const char *buf,
+ const uint8_t *buf,
int buf_size);
int pim_parse_addr_group(const char *ifname, struct in_addr src_addr,
struct prefix *p,
- const char *buf,
+ const uint8_t *buf,
int buf_size);
int pim_parse_addr_source(const char *ifname,
struct in_addr src_addr,
struct prefix *p,
uint8_t *flags,
- const char *buf,
+ const uint8_t *buf,
int buf_size);
#endif /* PIM_TLV_H */