]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_pim.c
Merge pull request #5767 from ton31337/fix/replace_s_addr_0_to_INADDR_ANY
[mirror_frr.git] / pimd / pim_pim.c
index 12b28ed9af68015f44d2b858929b4842967e7648..342c0a74e049fd3554ffbff5eb424d4a8a8dda56 100644 (file)
@@ -190,6 +190,12 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len)
        no_fwd = header->Nbit;
 
        if (header->type == PIM_MSG_TYPE_REGISTER) {
+               if (pim_msg_len < PIM_MSG_REGISTER_LEN) {
+                       if (PIM_DEBUG_PIM_PACKETS)
+                               zlog_debug("PIM Register Message size=%d shorther than min length %d",
+                                          pim_msg_len, PIM_MSG_REGISTER_LEN);
+                       return -1;
+               }
                /* First 8 byte header checksum */
                checksum = in_cksum(pim_msg, PIM_MSG_REGISTER_LEN);
                if (checksum != pim_checksum) {
@@ -574,6 +580,7 @@ int pim_msg_send(int fd, struct in_addr src, struct in_addr dst,
        ip->ip_id = htons(++ip_id);
        ip->ip_hl = 5;
        ip->ip_v = 4;
+       ip->ip_tos = IPTOS_PREC_INTERNETCONTROL;
        ip->ip_p = PIM_IP_PROTO_PIM;
        ip->ip_src = src;
        ip->ip_dst = dst;