diff options
author | Amol Lad <amol.lad@4rf.com> | 2021-02-17 01:47:32 +0100 |
---|---|---|
committer | Reuben Dowle <reuben.dowle@4rf.com> | 2021-04-05 23:22:59 +0200 |
commit | fa31fcf2ea1157d3d14968d704878cc8fe058c91 (patch) | |
tree | 22e31544342b63579aab8865d229562152b96173 /nhrpd/linux.c | |
parent | Merge pull request #8348 from chiragshah6/mdev (diff) | |
download | frr-fa31fcf2ea1157d3d14968d704878cc8fe058c91.tar.xz frr-fa31fcf2ea1157d3d14968d704878cc8fe058c91.zip |
nhrpd: Add support for forwarding multicast packets
Forwarding multicast is a pre-requisite for allowing multicast based routing
protocols such as OSPF to work with DMVPN
This code relies on externally adding iptables rule. For example:
iptables -A OUTPUT -d 224.0.0.0/24 -o gre1 -j NFLOG --nflog-group 224
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
Diffstat (limited to 'nhrpd/linux.c')
-rw-r--r-- | nhrpd/linux.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/nhrpd/linux.c b/nhrpd/linux.c index 59c82b1c5..20825149b 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -15,6 +15,7 @@ #include <stdio.h> #include <unistd.h> #include <string.h> +#include <errno.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/types.h> @@ -42,7 +43,7 @@ int os_socket(void) } int os_sendmsg(const uint8_t *buf, size_t len, int ifindex, const uint8_t *addr, - size_t addrlen) + size_t addrlen, uint16_t protocol) { struct sockaddr_ll lladdr; struct iovec iov = { @@ -61,16 +62,16 @@ int os_sendmsg(const uint8_t *buf, size_t len, int ifindex, const uint8_t *addr, memset(&lladdr, 0, sizeof(lladdr)); lladdr.sll_family = AF_PACKET; - lladdr.sll_protocol = htons(ETH_P_NHRP); + lladdr.sll_protocol = htons(protocol); lladdr.sll_ifindex = ifindex; lladdr.sll_halen = addrlen; memcpy(lladdr.sll_addr, addr, addrlen); - status = sendmsg(nhrp_socket_fd, &msg, 0); + status = sendmsg(os_socket(), &msg, 0); if (status < 0) - return -1; + return -errno; - return 0; + return status; } int os_recvmsg(uint8_t *buf, size_t *len, int *ifindex, uint8_t *addr, |