summaryrefslogtreecommitdiffstats
path: root/lib/sockopt.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* lib: random unused bits cleanupDavid Lamparter2019-12-141-15/+0
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: Add getsockopt_so_recvbufDonald Sharp2019-10-161-0/+15
| | | | | | | Add a new function getsockopt_so_recvbuf which tells you the operating systems receive buffer size. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: On some platforms function did not return anythingDonald Sharp2019-06-071-0/+6
| | | | | | | | On some compiler platforms the md5 setup function was not returning anything. Place failure case on the bottom to properly handle this situation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add support for extended TCP MD5 authQuentin Young2019-04-161-5/+45
| | | | | | | | | | | MD5 auth on TCP is supported for prefixes in recent versions of Linux; add complementary support for FRR. This is a reworked version of Donald's commit to keep library compatibility and obviate the need for changes in daemons that don't need to support this themselves. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: style for EC replacementsQuentin Young2018-09-131-4/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-19/+19
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Convert sockopt.c to flog_errDonald Sharp2018-09-061-25/+36
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: remove Linux 2.4 TCP-MD5 supportDavid Lamparter2018-08-251-25/+1
| | | | | | | Linux 2.6.0 was released in December of 2003... I'm pretty sure we don't need this Linux 2.4 support anymore. Signed-off-by: David Lamparter <equinox@diac24.net>
* Merge pull request #2448 from qlyoung/error-reference-cardsDavid Lamparter2018-08-161-4/+8
|\ | | | | Error Reference Cards
| * *: rename ferr_zlog -> flog_err_sysQuentin Young2018-08-141-6/+7
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * *: rename zlog_fer -> flog_errQuentin Young2018-08-141-2/+2
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * lib: Add LIB_ERR_SYSTEM_CALL and convert VRF_SOCKET to SOCKETDonald Sharp2018-08-141-4/+7
| | | | | | | | | | | | | | | | Add a new error code LIB_ERR_SYSTEM_CALL to the ferr subsystem. Additionally convert LIB_ERR_VRF_SOCKET to a more generic LIB_ERR_SOCKET. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | lib, ripngd, zebra: Remove pre-solaris 9 special cased codeDonald Sharp2018-08-151-1/+1
|/ | | | | | | | | The CMSG_FIRSTHDR was broken on solaris pre version 9. Version 9 was released in May of 2002 and EOL'ed in 2014. Version 8 EOL'ed in 2012. Remove special case code for a little used platform that has not seen the light of day in a very long time. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: fix getsockopt_cmsg_data retrievalRafael Zalamena2018-08-011-1/+1
| | | | | | | | The `type` parameter was not being compared with `cmsg_type`, so the result of this function was always a pointer to the first header matching the level. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bgpd isisd ldpd lib ospfd pimd: redundancy (infer)paco2018-06-201-3/+6
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-6/+4
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindent pt. 2whitespace / reindent2017-07-171-4/+6
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-456/+452
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_init() infrastructureDavid Lamparter2017-03-071-23/+0
| | | | | | | | | Start centralising startup & option parsing into the library. FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g. for killing the ZLOG_* enum, and having the daemon name available) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'origin/stable/2.0'Donald Sharp2017-02-021-0/+23
|\
| * *: fix warning fallout from set_socket_pathDavid Lamparter2017-02-011-2/+2
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * lib: Add set_socket_path() to sockopt.c to override the path element of a ↵Martin Winter2017-01-251-0/+23
| | | | | | | | | | | | (vty) socket (but keep filename) Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
* | frr: Remove HAVE_IPV6 from code baseDonald Sharp2017-01-131-8/+0
|/ | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: always set SO_SNDBUF and SO_RCVBUF using a best effort approachRenato Westphal2016-12-081-16/+16
| | | | | | | | | | | If we fail to set any socket's buffer size, try again with a smaller value and keep going until it succeeds. This is better than just giving up or, even worse, abort the creation of a socket (ospf6d and ripd). Fix broken ospf6d on FreeBSD. Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: create a helper function to set the IP_MULTICAST_LOOP sockoptionRenato Westphal2016-11-251-1/+14
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: update Solaris multicast API (BZ#725)Christian Franke2016-09-231-0/+34
| | | | | | | | | | | | | | | | | | On OpenIndiana/Solaris the build fails with "unsupported multicast API". It's only in the IPv4 part where setsockopt IP_MULTICAST_IF needs a local address and not the index (IPv6 wants the index). The following code walks the list of interfaces until it finds the matching index and uses the interface's local address for the setsockopt call. I don't know if it works on Solaris < 10 (I guess yes, but I don't have any machine to verify it). [NB: this breaks unnumbered setups that use the same IPv4 address on multiple interfaces. -- equinox@opensourcerouting.org] Reported-by: Brian Utterback <brian.utterback@oracle.com> Signed-off-by: Christian Franke <chris@opensourcerouting.org> Patchwork #762
* *: use an ifindex_t type, defined in lib/if.h, for ifindex valuesPaul Jakma2016-08-181-8/+8
| | | | (cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
* lib: fix setting of IPv4 multicast sockopts on OpenBSDRenato Westphal2016-08-081-6/+13
| | | | | | | | | | | | OpenBSD doesn't support the "ifindex hack" derived from RFC 1724 which allows an ifindex to be encoded in the imr_interface field (in_addr) of the ip_mreq structure. OpenBSD also doesn't support the RFC3678 Protocol-Independent socket API extensions, which allows an interface to be specified by its ifindex. With that said, in OpenBSD we still need to specify an interface by its IP address. This patch adds an exception in the multicast sockopt functions to handle this case. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* sockopt: add support for querying tcp round-trip-timeTimo Teräs2016-05-261-0/+16
| | | | | | Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 6b2672f3c9493aef3495192e113f95a7db4b65bc)
* lib: compile even without IPV6_TCLASSDenis Ovsienko2011-10-171-1/+3
|
* IPv6 transport class suppportStephen Hemminger2011-10-171-1/+12
| | | | | | | | | | | | | | | | | | | | | IPv6 supports the same concept of differentiated service for routing protocols as IPv4, but like too many things, the standards committee decided that having two names for the same thing wasn't good enough and introduced a third more generic term transport class. The socket option to set transport class works the same as IPv4, but the arguments are different. * lib/sockopt.[ch] * setsockopt_ipv6_tclass(): new function * bgpd/bgp_network.c * bgp_connect(): set socket option * bgp_listener(): set socket option * ospf6d/ospf6_network.c * ospf6_set_transport_class(): new function * ospf6_serv_sock(): set socket option * ripngd/ripngd.c * ripng_make_socket(): set socket option
* lib: use "protocol-independed API" from RFC3678, if that is availableDmitrij Tejblum2011-09-271-4/+22
| | | | | | | | (This commit is based on the patch from BZ#420, and should fix that bug.) * configure.ac: detect availability of that API * sockopt.c (setsockopt_ipv4_multicast): use it for join/leave IPv4 multicast groups
* lib: futher simplification of setsockopt_ipv4_multicast()Dmitrij Tejblum2011-09-271-64/+44
| | | | | * sockopt.c (setsockopt_ipv4_multicast): check for wrong optname with assert(), rather than return an error.
* lib: fix omission in the previous commit to lib/sockopt.cDmitrij Tejblum2011-09-271-0/+1
| | | | | * sockopt.c (setsockopt_ipv4_multicast_if): fix missed line in the previous commit.
* lib: simplify interface of setsockopt_multicast_ipv4().Dmitrij Tejblum2011-09-271-32/+45
| | | | | | | | | | | | * sockopt.[ch] (setsockopt_ipv4_multicast): ifindex is now mandatory (all non-ancient OSes can use it anyway), and if_addr parameter (the address of the interface) is now gone. (setsockopt_ipv4_multicast_if): IP_MULTICAST_IF processing moved to this new function * ospf_network.c (ospf_if_add_allspfrouters, ospf_if_drop_allspfrouters, ospf_if_add_alldrouters, ospf_if_drop_alldrouters, ospf_if_ipmulticast), rip_interface.c (ipv4_multicast_join, ipv4_multicast_leave, rip_interface_new): adapt to the new interface
* lib: remove unused variableDenis Ovsienko2011-09-271-3/+1
| | | | * sockopt.c (getsockopt_ifindex): "ifindex" was never used
* Fixes to RFC2385/MD5 BGPChris Caputo2009-06-231-3/+12
| | | | | | | | | * bgpd/bgp_network.c: Fix MD5 listen in IPv4 version of bgp_socket() by adding listen socket to listen_sockets list so that MD5 passwords can get set. * lib/sockopt.c: (sockopt_tcp_signature) Fix bogus "% Error while applying TCP-Sig to session(s)" / "can't set TCP_MD5SIG option" startup error messages by not returning error when there isn't one.
* [lib] sockopt_tcp_signature: sin6 requires HAVE_IPV6Stephen Hemminger2009-06-181-0/+2
| | | | | An external user was building on system without IPv6 and it wouldn't work.
* [bgpd] Add support for the old Linux 2.4, TCP_MD5_AUTH RFC2385 patchPaul Jakma2009-06-121-2/+25
| | | | | | | | | * configure.ac: Add a --enable-linux24-tcp-md5 argument, to compile in support for the old TCP-MD5 patch for Linux 2.4 systems. This overrides auto-detection of TCP-MD5 supported by the target system. * lib/sockopt.c: (sockopt_tcp_signature) add in a variant for the old Linux 2.4, TCP_MD5_AUTH variant of TCP-MD5 support, conditional on the previous configure arg.
* [lib] Fix mistake in tcp-md5sig commit which broke compile on BSDPaul Jakma2008-08-221-2/+2
| | | | | | | | 2008-08-15 Paul Jakma <paul.jakma@sun.com> * lib/sockopt.c: (sockopt_tcp_signature) ifdef'ing hid variable declaration for HAVE_DECL_TCP_MD5SIG && !GNU_LINUX, breaking compile - fix.
* [lib] mes_lookup string lookup table argument should be marked constStephen Hemminger2008-08-221-0/+13
| | | | | | | | | 2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com> * lib/log.{c,h}: struct message argument should point to const * */*.c: adjust to suit, Signed-off-by: Paul Jakma <paul@quagga.net>
* [bgpd] TCP-MD5: password vty configuration and initial Linux supportPaul Jakma2008-07-211-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-07-21 Paul Jakma <paul.jakma@sun.com> * bgp_packet.c: (bgp_open_receive) fix warning in a zlog call * bgp_vty.c: (bgp_vty_return) add return code * bgpd.c: (bgp_master_init) setup the socket list. * bgp_network.c: Remove the dual IPv4/6 socket thing for now, which was implemented by Michael, until such time as its clear its required for Linux (see sockopt comments). IPv6 support, including IPv4 sessions on AF_INET6 sockets, therefore is broken, and the '-l 0.0.0.0' arguments would need to be given to bgpd to make things work here. 2008-07-21 Michael H. Warfield <mhw@wittsend.com> YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Tomohiko Kusuda <kusuda@inetcore.com> Leigh Brown <leigh@solinno.co.uk> * bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5 sockopt and bgpd. (bgp_md5_set_socket) Helper for bgp_connect (bgp_md5_set) setup TCP-MD5SIG for the given peer. (bgp_connect) call out to bgp_md5_set_socket for the outgoing connect socket. (bgp_socket) save references to the listen sockets, needed if TCP-MD5SIG is applied later or changed. * bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password' commands. * bgpd.c: (peer_{new,delete) manage TCP-MD5 password (peer_group2peer_config_copy) inherit TCP-MD5 password (peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5 passwords: applying checks, stopping peers, and trying to return errors to UI, etc. (bgp_config_write_peer) save password. Fix missing newline in writeout of neighbor ... port. 2008-07-21 Paul Jakma <paul.jakma@sun.com> * sockunion.c: ifdef out various places that converted v4mapped sockets to pure v4. Doesn't seem necessary at all, presumably a workaround for now historical inet_ntop bugs (?) 2008-07-21 Michael H. Warfield <mhw@wittsend.com> YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> * sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
* Bug #362 is fixed now.Denis Ovsienko2007-08-211-0/+29
|
* [lib] Add comments regarding setsockopt_multicast_ipv4 arguments.Andrew J. Schorr2007-07-061-2/+3
| | | | | | | 2007-07-06 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * sockopt.{c,h}: (setsockopt_multicast_ipv4) Add some comments about the arguments.
* 2005-10-20 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-10-211-6/+47
| | | | | | * sockopt.c: (setsockopt_multicast_ipv4) If IP_ADD_MEMBERSHIP fails with errno equal to EADDRINUSE, then issue an info message and try IP_DROP_MEMBERSHIP followed by IP_ADD_MEMBERSHIP.
* 2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>paul2005-05-071-5/+9
| | | | | | | | * configure.ac: Check for OSes which support passing ifindex in struct ip_mreq. * lib/sockopt.c: Add support for BSD style ifindex in ip_mreq. * ospfd/ospf_network.c: Log ifindex on multicast membership leave/join events.
* 2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-01-041-1/+1
| | | | | | | | | | | | | | | | * configure.ac: Added test for broken CMSG_FIRSTHDR macro (relevant for Solaris 8 and unpatched Solaris 9, don't know whether other platforms are affected). * zebra.h: Define ZCMSG_FIRSTHDR appropriately based on whether config.h indicates HAVE_BROKEN_CMSG_FIRSTHDR (as determined by the configure test program). * sockopt.c: (getsockopt_cmsg_data) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR. * rtadv.c: (rtadv_recv_packet,rtadv_send_packet) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR. * ripd.c: (rip_recvmsg) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR. * ripngd.c: (ripng_recv_packet) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR.
* Add comment explaining about limit of 20 joined groups on a socket.gdt2004-12-301-5/+12
|