summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_carp.c
Commit message (Collapse)AuthorAgeFilesLines
* When doing ARP load balancing source IP is taken in network byte order,glebius2005-07-011-1/+1
| | | | | | | | so residue of division for all hosts on net is the same, and thus only one VHID answers. Change source IP in host byte order. Reviewed by: mlaier Approved by: re (scottl)
* Fix some long standing bugs in writing to the BPF device attached todwmalone2005-06-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | a DLT_NULL interface. In particular: 1) Consistently use type u_int32_t for the header of a DLT_NULL device - it continues to represent the address family as always. 2) In the DLT_NULL case get bpf_movein to store the u_int32_t in a sockaddr rather than in the mbuf, to be consistent with all the DLT types. 3) Consequently fix a bug in bpf_movein/bpfwrite which only permitted packets up to 4 bytes less than the MTU to be written. 4) Fix all DLT_NULL devices to have the code required to allow writing to their bpf devices. 5) Move the code to allow writing to if_lo from if_simloop to looutput, because it only applies to DLT_NULL devices but was being applied to other devices that use if_simloop possibly incorrectly. PR: 82157 Submitted by: Matthew Luckie <mjl@luckie.org.nz> Approved by: re (scottl)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-94/+99
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* - When carp interface is destroyed, and it affects global preemptionglebius2005-05-151-1/+12
| | | | | | | | | suppresion counter, decrease the latter. [1] - Add sysctl to monitor preemption suppression. PR: kern/80972 [1] Submitted by: Frank Volf [1] MFC after: 1 week
* Remove anti-LOR bandaid, it is not needed now.glebius2005-04-201-21/+0
| | | | Sponsored by: Rambler
* When several carp interfaces are attached to Ethernet interface,glebius2005-03-301-27/+37
| | | | | | | | | | | | carp_carpdev_state_locked() is called every time carp interface is attached. The first call backs up flags of the first interface, and the second call backs up them again, erasing correct values. To solve this, a carp_sc_state_locked() function is introduced. It is called when interface is attached to parent, instead of calling carp_carpdev_state_locked. carp_carpdev_state_locked() calls carp_sc_state_locked() for each sc in chain. Reported by: Yuriy N. Shkandybin, sem
* If vhid exists return more informative EEXIST instead of EINVAL. While hereglebius2005-03-181-3/+2
| | | | remove redundant brackets.
* Fix a potential crash that could occur when CARP_LOG is being used.glebius2005-03-181-2/+1
| | | | Obtained from: OpenBSD (pat)
* Fix typo. Unbreak build. Take pointy hat.glebius2005-03-021-1/+1
|
* Add more locking when reading/writing to carp softc. When carp softc isglebius2005-03-011-31/+140
| | | | | | | | | | | | | | attached to a parent interface we use its mutex to lock the softc. This means that in several places like carp_ioctl() we lock softc conditionaly. This should be redesigned. To avoid LORs when MII announces us a link state change, we schedule a quick callout and call carp_carpdev_state_locked() from it. Initialize callouts using NET_CALLOUT_MPSAFE. Sponsored by: Rambler Reviewed by: mlaier
* - Add carp_mtx. Use it to protect list of all carp interfaces.glebius2005-03-011-18/+20
| | | | | | | | - In carp_send_ad_all() walk through list of all carp interfaces instead of walking through list of all interfaces. Sponsored by: Rambler Reviewed by: mlaier
* Revert change to struct ifnet. Use ifnet pointer in softc. Embeddingglebius2005-03-011-1/+1
| | | | | | ifnet into smth will soon be removed. Requested by: brooks
* Remove debugging printf.glebius2005-03-011-1/+0
| | | | Reviewed by: mlaier
* Support running carp(4) over a vlan(4) parent interface.yar2005-02-281-1/+2
| | | | Encouraged by: glebius
* Remove unused field from carp softc.glebius2005-02-281-3/+0
| | | | OK'ed by: mcbride@OpenBSD
* Fix tcpdump(8) on carp(4) interface:glebius2005-02-281-16/+5
| | | | | | | | | | | | - Use our loop DLT type, not OpenBSD. [1] - The fields that are converted to network byte order are not 32-bit fields but 16-bit fields, so htons should be used in htonl. [1] - Secondly, ip_input changes ip->ip_len into its value without the ip-header length. So, restore the length to make bpf happy. [1] - Use bpf_mtap2(), use temporary af1, since bpf_mtap2 doesn't understand uint8_t af identifier. Submitted by: Frank Volf [1]
* Unbreak the build. carp_iamatch6 and carp_macmatch6 are not supposed to bemlaier2005-02-271-2/+2
| | | | static as they are used elsewhere.
* Remove carp_softc.sc_ifp member in favor of union pointers in struct ifnet.glebius2005-02-261-21/+21
| | | | Obtained from: OpenBSD
* Staticize local functions.glebius2005-02-261-53/+53
|
* New lines when logging.glebius2005-02-251-17/+18
|
* Embrace macros with do {} while (0)glebius2005-02-251-2/+4
| | | | Submitted by: maxim
* Call carp_carpdev_state() from carp_set_addr6(). See log for rev 1.4.glebius2005-02-251-1/+1
| | | | Sponsored by: Rambler
* Improve logging:glebius2005-02-251-38/+52
| | | | | | | | | | | | - Simplify CARP_LOG() and making it working (we don't have addlog in FreeBSD). - Introduce CARP_DEBUG() which logs with LOG_DEBUG severity when net.inet.carp.log > 1 - Use CARP_DEBUG to log state changes of carp interfaces. After CARP_LOG() cleanup it appeared that carp_input_c() does not need sc argument. Remove it. Sponsored by: Rambler
* Fix problem when master comes up with one interface down, and preemptsglebius2005-02-241-2/+2
| | | | | | | | | | | | mastering on all other interfaces: - call carp_carpdev_state() on initialize instead of just setting to INIT - in carp_carpdev_state() check that interface is UP, instead of checking that it is not DOWN, because a rebooted machine may have interface in UNKNOWN state. Sponsored by: Rambler Obtained from: OpenBSD (partially)
* Unbreak CARP build on 64-bit architectures.mux2005-02-231-1/+1
| | | | Tested on: sparc64
* Remove promisc counter from parent interface in carp_clone_destroy(),glebius2005-02-221-0/+1
| | | | | | | | | | | | so that parent interface is not left in promiscous mode after carp interface is destroyed. This is not perfect, since promisc counter is added when carp interface is assigned an IP address. However, when address is removed parent interface is still in promiscuous mode. Only removal of carp interface removes promisc from parent. Same way in OpenBSD. Sponsored by: Rambler
* Add CARP (Common Address Redundancy Protocol), which allows multipleglebius2005-02-221-0/+2032
hosts to share an IP address, providing high availability and load balancing. Original work on CARP done by Michael Shalayeff, with many additions by Marco Pfatschbacher and Ryan McBride. FreeBSD port done solely by Max Laier. Patch by: mlaier Obtained from: OpenBSD (mickey, mcbride)
OpenPOWER on IntegriCloud