summaryrefslogtreecommitdiffstats
path: root/pimd/pim_rp.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetwroks.com>2016-07-28 04:19:08 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-22 02:26:04 +0100
commit31c680fc88838cd7e0be8bf12165084d4cb03b52 (patch)
tree98922e8aa37a8ed960fb14b115f4cfc708e3fde6 /pimd/pim_rp.c
parentpimd: Create raw socket for register packets to be forwarded. (diff)
downloadfrr-31c680fc88838cd7e0be8bf12165084d4cb03b52.tar.xz
frr-31c680fc88838cd7e0be8bf12165084d4cb03b52.zip
pimd: Infrastructure to forward packet down (*,G) tree
When a register is received, forward the packet as appropriate. This is the infrastructure to make this happen. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_rp.c')
-rw-r--r--pimd/pim_rp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index e7c03792c..929211cdd 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -39,10 +39,29 @@ static int i_am_rp = 0;
*/
static int fd_rp = -1;
+void
+pim_rp_forward_packet (struct ip *ip_hdr)
+{
+ struct sockaddr_in sin;
+
+ sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = ip_hdr->ip_dst.s_addr;
+
+ zlog_debug ("Sending Packet");
+ if (sendto (fd_rp, ip_hdr, ntohs (ip_hdr->ip_len), 0, (struct sockaddr *)&sin, sizeof (struct sockaddr)) < 0)
+ {
+ zlog_debug ("Failure to send packet: %s", safe_strerror (errno));
+ }
+}
+
static void
pim_rp_create_socket (void)
{
fd_rp = pim_socket_raw (IPPROTO_RAW);
+
+ if (pim_socket_ip_hdr (fd_rp) != 0)
+ zlog_debug ("Unable to setup socket for ip hdr inclusion");
+
if (pim_socket_bind (fd_rp, qpim_rp.source_nexthop.interface) != 0)
zlog_debug ("Unable to Bind to a particular socket");
}