]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: log interface name for send errors
authorDavid Lamparter <equinox@opensourcerouting.org>
Sat, 12 Mar 2022 21:41:41 +0000 (22:41 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 12 Mar 2022 21:57:17 +0000 (22:57 +0100)
Not very helpful to be told only the fd number.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
pimd/pim_pim.c

index 5cc0d63e317d75cf2673b6071d077217dd22fda7..f6ec007bafa9c69202feeae507f0b0e62b444eae 100644 (file)
@@ -521,7 +521,8 @@ static uint16_t ip_id = 0;
 
 
 static int pim_msg_send_frame(int fd, char *buf, size_t len,
-                             struct sockaddr *dst, size_t salen)
+                             struct sockaddr *dst, size_t salen,
+                             const char *ifname)
 {
        struct ip *ip = (struct ip *)buf;
 
@@ -537,8 +538,8 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len,
 
                        ip->ip_len = htons(sendlen);
                        ip->ip_off = htons(offset | IP_MF);
-                       if (pim_msg_send_frame(fd, buf, sendlen, dst, salen)
-                           == 0) {
+                       if (pim_msg_send_frame(fd, buf, sendlen, dst, salen,
+                                              ifname) == 0) {
                                struct ip *ip2 = (struct ip *)(buf + newlen1);
                                size_t newlen2 = len - sendlen;
                                sendlen = newlen2 + hdrsize;
@@ -547,7 +548,8 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len,
                                ip2->ip_len = htons(sendlen);
                                ip2->ip_off = htons(offset + (newlen1 >> 3));
                                return pim_msg_send_frame(fd, (char *)ip2,
-                                                         sendlen, dst, salen);
+                                                         sendlen, dst, salen,
+                                                         ifname);
                        }
                }
 
@@ -557,9 +559,9 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len,
                                pim_inet4_dump("<dst?>", ip->ip_dst, dst_str,
                                               sizeof(dst_str));
                                zlog_warn(
-                                       "%s: sendto() failure to %s: fd=%d msg_size=%zd: errno=%d: %s",
-                                       __func__, dst_str, fd, len, errno,
-                                       safe_strerror(errno));
+                                       "%s: sendto() failure to %s: iface=%s fd=%d msg_size=%zd: errno=%d: %s",
+                                       __func__, dst_str, ifname, fd, len,
+                                       errno, safe_strerror(errno));
                        }
                        return -1;
                }
@@ -641,7 +643,7 @@ int pim_msg_send(int fd, pim_addr src, pim_addr dst, uint8_t *pim_msg,
        }
 
        pim_msg_send_frame(fd, (char *)buffer, sendlen, (struct sockaddr *)&to,
-                          tolen);
+                          tolen, ifname);
        return 0;
 }