Browse Source

pimd: fix worst char * <> uint8_t * intermingling

David Lamparter 7 years ago
parent
commit
f8cfeb25e6
17 changed files with 129 additions and 137 deletions
  1. 3 3
      pimd/pim_assert.c
  2. 1 1
      pimd/pim_assert.h
  3. 11 11
      pimd/pim_cmd.c
  4. 7 7
      pimd/pim_hello.c
  5. 2 2
      pimd/pim_hello.h
  6. 2 2
      pimd/pim_igmp.c
  7. 6 6
      pimd/pim_join.c
  8. 1 1
      pimd/pim_join.h
  9. 10 10
      pimd/pim_msg.c
  10. 10 10
      pimd/pim_msg.h
  11. 5 5
      pimd/pim_pim.c
  12. 2 2
      pimd/pim_pim.h
  13. 1 1
      pimd/pim_sock.c
  14. 1 1
      pimd/pim_sock.h
  15. 2 2
      pimd/pim_ssmpingd.c
  16. 41 49
      pimd/pim_tlv.c
  17. 24 24
      pimd/pim_tlv.h

+ 3 - 3
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;

+ 1 - 1
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);

+ 11 - 11
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 */

+ 7 - 7
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

+ 2 - 2
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,

+ 2 - 2
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;
   }
 

+ 6 - 6
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;
 

+ 1 - 1
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,

+ 10 - 10
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;
 

+ 10 - 10
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 */

+ 5 - 5
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;

+ 2 - 2
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);
 

+ 1 - 1
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)

+ 1 - 1
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);

+ 2 - 2
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;

+ 41 - 49
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);
 

+ 24 - 24
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 */