summaryrefslogtreecommitdiff
path: root/lib/sockopt.c
AgeCommit message (Collapse)Author
2011-09-27lib: use "protocol-independed API" from RFC3678, if that is availableDmitrij Tejblum
(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
2011-09-27lib: futher simplification of setsockopt_ipv4_multicast()Dmitrij Tejblum
* sockopt.c (setsockopt_ipv4_multicast): check for wrong optname with assert(), rather than return an error.
2011-09-27lib: fix omission in the previous commit to lib/sockopt.cDmitrij Tejblum
* sockopt.c (setsockopt_ipv4_multicast_if): fix missed line in the previous commit.
2011-09-27lib: simplify interface of setsockopt_multicast_ipv4().Dmitrij Tejblum
* 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
2011-09-27lib: remove unused variableDenis Ovsienko
* sockopt.c (getsockopt_ifindex): "ifindex" was never used
2009-06-23Fixes to RFC2385/MD5 BGPChris Caputo
* 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.
2009-06-18[lib] sockopt_tcp_signature: sin6 requires HAVE_IPV6Stephen Hemminger
An external user was building on system without IPv6 and it wouldn't work.
2009-06-12[bgpd] Add support for the old Linux 2.4, TCP_MD5_AUTH RFC2385 patchPaul Jakma
* 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.
2008-08-22[lib] Fix mistake in tcp-md5sig commit which broke compile on BSDPaul Jakma
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.
2008-08-22[lib] mes_lookup string lookup table argument should be marked constStephen Hemminger
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>
2008-07-21[bgpd] TCP-MD5: password vty configuration and initial Linux supportPaul Jakma
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.
2007-08-21Bug #362 is fixed now.Denis Ovsienko
2007-07-06[lib] Add comments regarding setsockopt_multicast_ipv4 arguments.Andrew J. Schorr
2007-07-06 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * sockopt.{c,h}: (setsockopt_multicast_ipv4) Add some comments about the arguments.
2005-10-212005-10-20 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* 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-072005-05-07 Yar Tikhiy <yar@comp.chem.msu.su>paul
* 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-042005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* 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.
2004-12-30Add comment explaining about limit of 20 joined groups on a socket.gdt
2004-12-292004-12-29 Greg Troxel <gdt@poblano.ir.bbn.com>gdt
* sockopt.c (getsockopt_ipv4_ifindex): Document calling convention. Beef up comments. Handle the case where the cmsghdr has a zero controllen, or more specifically when the wanted option is not present. This is needed for Solaris 8, and in general for any platform for which configure finds a method and it can fail. Mark some changes with XXX to be cleaned up post 0.98.
2004-12-292004-12-29 Greg Troxel <gdt@poblano.ir.bbn.com>gdt
* sockopt.c (getsockopt_ipv4_ifindex): Return 0 when passed a NULL cmsghdr pointer. I believe this will avoid ospfd crashing on Solaris 8, which seems to define IP_RECVIF but not actually implement it.
2004-12-282004-12-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* sockopt.c: (setsockopt_ipv4_ifindex) Improve error message. When neither IP_PKTINFO nor IP_RECVIF is defined, make return value deterministic (-1).
2004-11-202004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration.
2004-11-19Fix previous change to use new function safe_strerror instead of strerror.ajs
2004-11-192004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* sockopt.c: (setsockopt_so_recvbuf) Stop error message from being printed every time.
2004-11-012004-11-01 Paul Jakma <paul@dishone.st>paul
* sockopt.c: (setsockopt_pktinfo) remove, its unused.
2004-10-222004-10-22 Paul Jakma <paul@dishone.st>paul
* sockopt.c: (setsockopt_pktinfo) unexported * sockopt.h: Cleanup SOCKOPT_CMSG defines a bit. Add a throwaway define for SOPT_SIZE_CMSG_IFINDEX_IPV4 for systems which have neither IP_RECVIF nor IP_PKTINFO (eg openbsd).
2004-10-222004-10-13 Paul Jakma <paul@dishone.st>paul
* sockopt.c: (getsockopt_ipv4_ifindex) no ifindex should be 0, not -1.
2004-10-102004-10-10 Paul Jakma <paul@dishone.st>paul
* version.h.in: (pid_output*) add const qualifier. * command.h: Change DEFUN func to take const char *[] rather than char **, to begin process of fixing compile warnings in lib/. Nearly all other changes in this commit follow from this change. * buffer.{c,h}: (buffer_write) pointer-arithmetic is gccism, take const void * and cast an automatic const char *p to it. (buffer_putstr) add const * command.c: (zencrypt) const qualifier (cmd_execute_command_real) ditto (cmd_execute_command_strict) ditto (config_log_file) ditto. Fix leak of getcwd() returned string. * memory.{c,h}: Add MTYPE_DISTRIBUTE_IFNAME for struct dist ifname. * distribute.{c,h}: Update with const qualifier. (distribute_free) use MTYPE_DISTRIBUTE_IFNAME (distribute_lookup) Cast to char *, note that it's ok. (distribute_hash_alloc) use MTYPE_DISTRIBUTE_IFNAME. (distribute_get) Cast to char *, note that it's ok. * filter.c: Update with const qualifier. * if.{c,h}: ditto. * if_rmap.{c,h}: ditto. (if_rmap_lookup) Cast to char *, note that it's ok. (if_rmap_get) ditto. * log.{c,h}: Update with const qualifier. * plist.{c,h}: ditto. * routemap.{c,h}: ditto. * smux.{c,h}: ditto. Fix some signed/unsigned comparisons. * sockopt.c: (getsockopt_cmsg_data) add return for error case. * vty.c: Update with const qualifier.
2004-10-052004-10-05 Paul Jakma <paul@dishone.st>paul
* sockopt.{c,h}: add sockopt_iphdrincl_swab_{htosys,systoh}, functions to change byte order between system IP_HDRINCL order and host order.
2004-09-26Compiler warnings fixes.hasso
2004-09-212004-09-17 Paul Jakma <paul@dishone.st>paul
* sockopt.c: Add missing bracket
2004-09-172004-09-17 Paul Jakma <paul@dishone.st>paul
* ripngd/ripngd.c: move setsockopt_so_recvbuf to lib. * lib/sockopt.{c,h}: Add setsockopt_so_recvbuf, for ripd and ripngd. * ripd/ripd.c: set receive buffer to a decent size, some systems have low defaults. Problem noted and fix suggested by Stephan Schweizer in [zebra 20967].
2004-08-192004-08-19 Paul Jakma <paul@dishone.st>paul
2004-08-19 Paul Jakma <paul@dishone.st> * sockopt.c: include sockopt.h rename some of the _pktinfo_ functions to _ifindex, where that is their purpose. (getsockopt_ipv6_pktinfo_ifindex) renamed to getsockopt_ipv6_ifindex. (setsockopt_ipv4_pktinfo) renamed to setsockopt_ipv4_ifindex (setsockopt_pktinfo) update with previous and add comment re AF_INET portability. (setsockopt_ifindex) generic ifindex function ala setsockopt_pktinfo. (getsockopt_ipv4_pktinfo_ifindex) renamed to getsockopt_ipv4_ifindex. (getsockopt_ipv4_ifindex) rejiggling to reduce repeated ifdef/elses. pktinfo case forgot to set ifindex. (getsockopt_pktinfo_ifindex) renamed to getsockopt_ifindex. update some calls to renamed functions. * sockopt.h: Update renamed exported functions Rename the CMSG_SIZE macros to IFINDEX. Guard IPv4 PKTINFO in a conditional define.
2004-07-232004-07-23 Greg Troxel <gdt@poblano.ir.bbn.com>gdt
* sockopt.c (getsockopt_ipv4_pktinfo_ifindex): Make this compile on NetBSD, and add comments to make it less confusing. Change the sense of the SUNOS_5 test to make parallel structure between the variables and the code.
2004-07-232004-07-23 Paul Jakma <paul@dishone.st>paul
* sockopt.h: Add SOPT_SIZE_CMSG_PKTINFO{_IPV{4,6}} define, for sizeof pktinfo as appropriate, to be used when allocating msg buffers. export setsockopt_pktinfo() and getsockopt_pktinfo_ifindex() * sockopt.c: (setsockopt_pktinfo_ifindex) new function to portably set received ifindex sock option. (getsockopt_pktinfo_ifindex) portably retrieve ifindex. (getsockopt_cmsg_data) retrieve indicated control info from message header. (getsockopt_ipv6_pktinfo_ifindex) ipv6 version of above. (setsockopt_ipv4_pktinfo) v4 version (setsockopt_pktinfo) the exported version (getsockopt_ipv4_pktinfo_ifindex) v4 specific version (getsockopt_pktinfo_ifindex) the exported version
2002-12-13Initial revisionpaul