mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
pimd: Allow ssmpingd command to work for pim
Commit: 1c56018f66
broke the ssmpingd implementation in pim. This
is because it just completely botched the bind
to the correct port and address.
Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
This commit is contained in:
parent
827e1d69b9
commit
23fcf31358
|
@ -155,10 +155,13 @@ static inline int ssmpingd_setsockopt(int fd, pim_addr addr, int mttl)
|
||||||
|
|
||||||
static int ssmpingd_socket(pim_addr addr, int port, int mttl)
|
static int ssmpingd_socket(pim_addr addr, int port, int mttl)
|
||||||
{
|
{
|
||||||
struct sockaddr_storage sockaddr;
|
#if PIM_IPV == 4
|
||||||
|
struct sockaddr_in sockaddr;
|
||||||
|
#else
|
||||||
|
struct sockaddr_in6 sockaddr;
|
||||||
|
#endif
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
socklen_t len = sizeof(sockaddr);
|
|
||||||
|
|
||||||
fd = socket(PIM_AF, SOCK_DGRAM, IPPROTO_UDP);
|
fd = socket(PIM_AF, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
@ -167,8 +170,15 @@ static int ssmpingd_socket(pim_addr addr, int port, int mttl)
|
||||||
__func__, errno, safe_strerror(errno));
|
__func__, errno, safe_strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#if PIM_IPV == 4
|
||||||
pim_socket_getsockname(fd, (struct sockaddr *)&sockaddr, &len);
|
sockaddr.sin_addr = addr;
|
||||||
|
sockaddr.sin_port = htons(port);
|
||||||
|
sockaddr.sin_family = PIM_AF;
|
||||||
|
#else
|
||||||
|
sockaddr.sin6_addr = addr;
|
||||||
|
sockaddr.sin6_port = htons(port);
|
||||||
|
sockaddr.sin6_family = PIM_AF;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
|
if (bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
|
|
Loading…
Reference in a new issue