summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
AgeCommit message (Collapse)Author
2012-10-08Make carp_ourether() shorter and more generic. Only a mac addressCamiel Dobbelaar
is really needed, instead of an ethernet header and selector. ok mikeb henning mpf
2012-09-19Make rt_lookup return a pointer to an rtentry struct instead ofBret Lambert
to a radix_node struct. The radix tree pushdown continues. ok claudio@
2012-09-19inherit IFCAP_CSUM_* from the parent interfaceHenning Brauer
in my tree for a while and I forgot what exactly triggered it, but in one way or another this comes from the netbsd camp ok benno mpf
2012-04-11fix all the suser calls which pass an incorrect p_acflag argument;Mike Belopuhov
figured out by and ok guenther
2011-11-19Select a routing table according to the rdomain. Allows oneMike Belopuhov
to connect to the carp address when the carpdev interface has an ip address too in the non-default rdomain. ok claudio
2011-10-30In the advbase 0 case, we have to use three timesMarco Pfatschbacher
the advskew as the master down timeout. OK henning.
2011-10-24Lower carp demote count on interface detach, fixes a bug introduced by rev ↵Camiel Dobbelaar
1.175. ok henning mpf
2011-10-16Use m_pullup() instead of IP6_EXTHDR_GET() to get the carp headerMarco Pfatschbacher
in the v6 input path. IP6_EXTHDR_GET() internally uses m_pulldown(), which might return a pointer to a different mbuf in the chain. In this case, carp_cksum() will be called with the wrong mbuf. This fixes occasional checksum mismatches. Problem found and initial fix by stsp@ OK stsp@
2011-09-06Properly initialize struct carp_if (especially vhif_nvrs) with M_ZERO.Marco Pfatschbacher
This lets carp delete IFF_PROMISC on its carpdev upon destroy. Fix from Stefan Rinkes. OK sthen, bluhm, deraadt.
2011-07-08mark carp advertisements to be queued at priority 6. losing them is bad,Henning Brauer
mkay? ok ryan
2011-07-04Don't make copy multicast packets for carp interfacesMarco Pfatschbacher
that are not up. OK henning.
2011-07-04Allow advbase to be set to zero, which makes it possible to runMarco Pfatschbacher
with advertisement intervals of less than a second. This is needed in setups where takover times < 3s are needed. Don't use this unless you really need it. Running with too agressive timeouts might lead to false positive takeovers. OK mcbride, claudio.
2011-07-03avoid void * pointer arithmeticDavid Hill
OK claudio@
2011-07-03Do not use LINK_STATE_UNKNOWN for the INIT state. LINK_STATE_UNKNOWN hasClaudio Jeker
a special meaning and should only be set if the link state is not known because it is considered as being up. Use LINK_STATE_INVALID instead. OK mpf@ mcbride@ henning@
2011-05-04Collapse m_pullup and m_pullup2 into a single function, as they'reBret Lambert
essentially identical; the only difference being that m_pullup2 is capable of handling mbuf clusters, but called m_pullup for shorter lengths (!). testing dlg@ ok claudio@
2011-04-29The previous reconfiguration change broke IPv6 only setups.Marco Pfatschbacher
The address hook was only registered for v4 addresses. We now call hook_establish at interface creation time. The hook is now disestablished upon interface destroy, which plugs a tiny memleak. While there remove redundancy in carp_set_addr6 and sync it with carp_set_addr. Bug noticed by todd@. OK sthen, mikeb (on an earlier version) OK and some hints by camield@
2011-04-04install an additional bpf hook in the carp_input so that multicastMike Belopuhov
and broadcast packets will be caught too; also we need to increment the incoming packet counter as reminded by claudio. ok claudio mpf
2011-03-08Fix a subtle carp reconfiguration problem.Marco Pfatschbacher
Updating the HMAC from the carp_ioctl call does not see the newly set IP address in the if_addrlist. The only chance for carp to see the new address is via the address-hook callback. This change moves the detection of address changes entirely into carp_addr_updated. Furthermore, only call carp_hmac_prepare for the SIOCSVH case. This second bug was the reason why the first one went unnoticed for such a long time. Problem found and debugging help by camield@. OK camield@
2010-12-21Doh! Forgot to set the rdomain when sending out carp announcements.Claudio Jeker
With and OK phessler@
2010-11-26more useful logging level for demotion adjustmentsOtto Moerbeek
ok mcbide@ claudio@ henning@
2010-08-26Link local multicast requires a scope (either from the src or dst address)Claudio Jeker
be more explicit and force it in dst. OK deraadt@, mcbride@
2010-08-02Prevent illegal struct casting by moving AF_INET/AF_INET6 addressMatthew Dempsky
family checks before calling ifatoia/ifatoia6. ok deraadt@, dlg@, mcbride@
2010-07-20Switch some obvious network stack MAC comparisons from bcmp() toMatthew Dempsky
timingsafe_bcmp(). ok deraadt@; committed over WPA.
2010-04-25Properly adjust group demotion counters when groups are added orMarco Pfatschbacher
removed. Extend carp demote logging to also show the reason for the demote. Return EINVAL instead of ERANGE if a carpdemote request is out range. Requested from otto. OK mcbride, henning.
2010-01-13let's admit it's not 1992 any more. CIDR is around for a long time, evenHenning Brauer
that router vendor doesn't default to classful routing any more, and there really is no point in having a classful netmask and a subnetmask to split it. we still do classful guesses on the netmask if it isn't supplied by userland, but that's about it. i decided to keep ia_netmask and kill ia_subnetmask which makes this diff bigish, the classful ia_netmask wasn't really used all that much. the real changes are in in.c, the rest is mostly s/ia_subnetmask/ia_netmask. ok claudio dlg ryan
2010-01-12Remove the "bump the advskew to 240 in case of errors" hack.Marco Pfatschbacher
The demote counter can handle that. This lets carp hosts with an identical demote count still know which one is the designated master and prevents them from failing over asymmetrically. Since there is a demote handling bug in all releases prior to 4.6, symmetric failover will only work against 4.6 (and newer) from now on. OK henning@
2010-01-12Use M_ZERO in malloc instead of doing a bzeor right afterwards.Claudio Jeker
From Gleydson Soares, OK beck@
2009-06-17Correctly handle the carp demote counter in all input cases.Marco Pfatschbacher
E.g. give up the MASTER status if there's a host with a lower demote count, even if it has a higher advskew. At the moment this shouldn't cause any change, but this is a first step towards the removal of the "bump the advskew to 240 in case of errors" hack, without breaking backward compatibility. OK henning@
2009-06-05Initial support for routing domains. This allows to bind interfaces toClaudio Jeker
alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
2008-10-28Do not keep retrying to send advertisements if there isMarco Pfatschbacher
no carpdev configured. I don't see how we can run into this at all, but let's leave this test for a a little extra safety. OK henning@
2008-09-03Prevent a possible overflow when the sum of all demotion countersMarco Pfatschbacher
gets bigger than 255. OK henning@
2008-06-14add carppeer; an option to specify a different multicast address orReyk Floeter
even the unicast address of the remote carp peer. this especially helps when the multicast carp advertisements are causing problems in the network (some crappy switches don't do well with multicast), there are conflicts with VRRP, or the policy of the network does not allow multicast (most Internet eXchange points didn't allow carped OpenBGP routers because of the multicast advertisements). discussed with many ok mpf@
2008-06-13Do not log carp state transitions from or to INIT by default.Marco Pfatschbacher
Reduces the amount of dmesg noise. Tested and OK mcbride@
2008-06-09rename arc4random_bytes => arc4random_buf to match libc's nicer name;Damien Miller
ok deraadt@
2008-05-07Implement routing priorities. Every route inserted has a priority assignedClaudio Jeker
and the one route with the lowest number wins. This will be used by the routing daemons to resolve the synchronisations issue in case of conflicts. The nasty bits of this are in the multipath code. If no priority is specified the kernel will choose an appropriate priority. Looked at by a few people at n2k8 code is much older
2008-05-06Use the standard syslog levels on CARP logging messages instead ofRyan Thomas McBride
simple on/off, allowing more control over how verbose the logging is. This also allows you to do a further level of filtering in syslog.conf if you need to. Also add logging of state changes, inspired by diff provided by Brian A. Seklecki in PR 5513. These messages are logged by default. ok henning mpf deraadt
2008-02-20Add my copyright.Marco Pfatschbacher
OK mcbride@, mickey@
2008-02-05Move carp load balancing (ARP/IP) to a simpler configuration scheme.Marco Pfatschbacher
Instead of using the same IP on multiple interfaces, carp has to be configured with the new "carpnodes" and "balancing" options. # ifconfig carp0 carpnodes 1:0,2:100,3:100 balancing ip carpdev sis0 192.168.5.50 Please note, that this is a flag day for anyone using carp balancing. You'll need to adjust your configuration accordingly. Addititionally this diff adds IPv6 NDP balancing support. Tested and OK mcbride@, reyk@. Manpage help by jmc@.
2008-01-02return with ENOTTY instead of EINVAL for unknown ioctl requests.Brad Smith
ok claudio@ krw@ dlg@
2007-12-14add sysctl entry points into various network layers, in particular toTheo de Raadt
provide netstat(1) with data it needs; ok claudio reyk
2007-11-27Make carp(4) behave more like a ethernet interface by initalizing theClaudio Jeker
IPv4 interface address similar to arp_ifinit(). The main difference is that we do not send out a gracious arp as the carp(4) is not ready to send at that moment. This will make backup interface show up like the master ones. OK mpf@ earlier version OK henning@ mcbride@
2007-11-26MALLOC -> malloc and M_ZERO changeCharles Longeau
ok mpf@ henning@
2007-11-22pass the carp ifp to rt_missmsg() when generating the RTM_ADD messagesHenning Brauer
so the resulting messages have ifindex set and the routing daemons can correctly indentify that route as connected. ok mcbride
2007-11-22Factor out the virtual host portion of carp into a separate structMarco Pfatschbacher
that is kept in a list per carp interface. This is the huge first step necessary to make carp load balancing nice and easy. One carp interface can now contain up to 32 virtual host instances. This doesn't do anything useful yet, but here is how an ifconfig for multiple entries now looks like: # ifconfig carp2 carpnodes 5:0,6:100 192.168.5.88 carp2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:00:5e:00:01:05 carp: carpdev sis0 advbase 1 state MASTER vhid 5 advskew 0 state BACKUP vhid 6 advskew 100 groups: carp inet 192.168.5.88 netmask 0xffffff00 broadcast 192.168.5.255 OK mcbride@
2007-11-16use arc4random_bytes() instead of multiple arc4random() calls;Damien Miller
ok deraadt@ dlg@ henric@ mcbride@
2007-10-29MALLOC/FREE -> malloc/freeCharles Longeau
ok krw@
2007-10-27Replace the replay protection counter with a cookie.Marco Pfatschbacher
It is unlikely we will ever get a working replay protection, so better keep it simple and robust. The cookie allows us to detect our own advertisements, thus it is now easy to deal with network loops and non-simplex interfaces. Zero feedback by the people who wanted this fixed. OK henning@, markus@
2007-09-24Fix carp(4) after the switch to dynamic imo_membership allocation.Claudio Jeker
The multicast code is still a mess but will no longer crash the box. With input from pascoe@ who hit the same bug. OK markus@, henning@, mpf@ (on a previous version)
2007-09-18allow 4095 instead of 20 multicast group memberships per socket (you needMarkus Friedl
one entry for each multicast group and interface combination). this allows you to run OSPF with more than 10 interfaces. adapted from freebsd; ok claudio, henning, mpf
2007-09-18ARP balancing has been changed to use the source MAC addressMarco Pfatschbacher
quite a while ago. Manpage and comment update by Matthew Dempsky. OK jmc@