diff options
Diffstat (limited to 'pimd/pim_tlv.c')
| -rw-r--r-- | pimd/pim_tlv.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c index 5a751ac929..633bb207bd 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -121,20 +121,19 @@ int pim_encode_addr_ucast(uint8_t *buf, struct prefix *p) { switch (p->family) { case AF_INET: - *(uint8_t *)buf = - PIM_MSG_ADDRESS_FAMILY_IPV4; /* notice: AF_INET != - PIM_MSG_ADDRESS_FAMILY_IPV4 - */ + *buf = PIM_MSG_ADDRESS_FAMILY_IPV4; /* notice: AF_INET != + PIM_MSG_ADDRESS_FAMILY_IPV4 + */ ++buf; - *(uint8_t *)buf = 0; /* ucast IPv4 native encoding type (RFC + *buf = 0; /* ucast IPv4 native encoding type (RFC 4601: 4.9.1) */ ++buf; memcpy(buf, &p->u.prefix4, sizeof(struct in_addr)); return ucast_ipv4_encoding_len; case AF_INET6: - *(uint8_t *)buf = PIM_MSG_ADDRESS_FAMILY_IPV6; + *buf = PIM_MSG_ADDRESS_FAMILY_IPV6; ++buf; - *(uint8_t *)buf = 0; + *buf = 0; ++buf; memcpy(buf, &p->u.prefix6, sizeof(struct in6_addr)); return ucast_ipv6_encoding_len; @@ -198,13 +197,13 @@ int pim_encode_addr_group(uint8_t *buf, afi_t afi, int bidir, int scope, switch (afi) { case AFI_IP: - *(uint8_t *)buf = PIM_MSG_ADDRESS_FAMILY_IPV4; + *buf = PIM_MSG_ADDRESS_FAMILY_IPV4; ++buf; - *(uint8_t *)buf = 0; + *buf = 0; ++buf; - *(uint8_t *)buf = flags; + *buf = flags; ++buf; - *(uint8_t *)buf = 32; + *buf = 32; ++buf; memcpy(buf, &group, sizeof(struct in_addr)); return group_ipv4_encoding_len; @@ -473,7 +472,7 @@ int pim_parse_addr_ucast(struct prefix *p, const uint8_t *buf, int buf_size) case PIM_MSG_ADDRESS_FAMILY_IPV4: if ((addr + sizeof(struct in_addr)) > pastend) { zlog_warn( - "%s: IPv4 unicast address overflow: left=%zd needed=%zu", + "%s: IPv4 unicast address overflow: left=%td needed=%zu", __func__, pastend - addr, sizeof(struct in_addr)); return -3; @@ -489,7 +488,7 @@ int pim_parse_addr_ucast(struct prefix *p, const uint8_t *buf, int buf_size) case PIM_MSG_ADDRESS_FAMILY_IPV6: if ((addr + sizeof(struct in6_addr)) > pastend) { zlog_warn( - "%s: IPv6 unicast address overflow: left=%zd needed %zu", + "%s: IPv6 unicast address overflow: left=%td needed %zu", __func__, pastend - addr, sizeof(struct in6_addr)); return -3; @@ -548,7 +547,7 @@ int pim_parse_addr_group(struct prefix_sg *sg, const uint8_t *buf, int buf_size) if ((addr + sizeof(struct in_addr)) > pastend) { zlog_warn( - "%s: IPv4 group address overflow: left=%zd needed=%zu from", + "%s: IPv4 group address overflow: left=%td needed=%zu from", __func__, pastend - addr, sizeof(struct in_addr)); return -3; @@ -607,7 +606,7 @@ int pim_parse_addr_source(struct prefix_sg *sg, uint8_t *flags, case PIM_MSG_ADDRESS_FAMILY_IPV4: if ((addr + sizeof(struct in_addr)) > pastend) { zlog_warn( - "%s: IPv4 source address overflow: left=%zd needed=%zu", + "%s: IPv4 source address overflow: left=%td needed=%zu", __func__, pastend - addr, sizeof(struct in_addr)); return -3; |
