From 31c680fc88838cd7e0be8bf12165084d4cb03b52 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 27 Jul 2016 22:19:08 -0400 Subject: 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 --- pimd/pim_sock.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'pimd/pim_sock.c') 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; -- cgit v1.2.3