summaryrefslogtreecommitdiffstats
path: root/pimd/pim_sock.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_sock.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_sock.c')
-rw-r--r--pimd/pim_sock.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 70b18b14a..a4155549c 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -45,7 +45,8 @@
/* GLOBAL VARS */
extern struct zebra_privs_t pimd_privs;
-int pim_socket_raw(int protocol)
+int
+pim_socket_raw (int protocol)
{
int fd;
@@ -68,11 +69,31 @@ int pim_socket_raw(int protocol)
return fd;
}
+int
+pim_socket_ip_hdr (int fd)
+{
+ const int on = 1;
+ int ret;
+
+ if (pimd_privs.change (ZPRIVS_RAISE))
+ zlog_err ("%s: could not raise privs, %s",
+ __PRETTY_FUNCTION__, safe_strerror (errno));
+
+ ret = setsockopt (fd, IPPROTO_IP, IP_HDRINCL, &on, sizeof (on));
+
+ if (pimd_privs.change (ZPRIVS_LOWER))
+ zlog_err ("%s: could not lower privs, %s",
+ __PRETTY_FUNCTION__, safe_strerror (errno));
+
+ return ret;
+}
+
/*
* Given a socket and a interface,
* Bind that socket to that interface
*/
-int pim_socket_bind (int fd, struct interface *ifp)
+int
+pim_socket_bind (int fd, struct interface *ifp)
{
int ret;