diff options
author | Donald Sharp <sharpd@cumulusnetwroks.com> | 2016-07-28 04:19:08 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-22 02:26:04 +0100 |
commit | 31c680fc88838cd7e0be8bf12165084d4cb03b52 (patch) | |
tree | 98922e8aa37a8ed960fb14b115f4cfc708e3fde6 /pimd/pim_sock.c | |
parent | pimd: Create raw socket for register packets to be forwarded. (diff) | |
download | frr-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.c | 25 |
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; |