diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2022-03-12 22:41:41 +0100 | 
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2022-03-12 22:57:17 +0100 | 
| commit | 516b97fe4d7ff3e57734c4086b785de127552372 (patch) | |
| tree | 4d5308fcd518ddfe7bd9dc63cfe4346bb84c1fb6 /pimd/pim_pim.c | |
| parent | e5764757235c24faa57ec286792c7c9f12c913cf (diff) | |
pimd: log interface name for send errors
Not very helpful to be told only the fd number.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_pim.c')
| -rw-r--r-- | pimd/pim_pim.c | 18 | 
1 files changed, 10 insertions, 8 deletions
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 5cc0d63e31..f6ec007baf 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -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;  }  | 
