OpenBSD CVS

CVS log for src/sys/netinet/ip_carp.c


[BACK] Up to [local] / src / sys / netinet

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.361 / (download) - annotate - [select for diffs], Tue Feb 13 12:22:09 2024 UTC (3 months, 3 weeks ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.360: +2 -1 lines
Diff to previous 1.360 (colored)

Merge struct route and struct route_in6.

Use a common struct route for both inet and inet6.  Unfortunately
struct sockaddr is shorter than sockaddr_in6, so netinet/in.h has
to be exposed from net/route.h.  Struct route has to be bsd visible
for userland as netstat kvm code inspects inp_route.  Internet PCB
and TCP SYN cache can use a plain struct route now.  All specific
sockaddr types for inet and inet6 are embeded there.

OK claudio@

Revision 1.360 / (download) - annotate - [select for diffs], Sat Dec 23 10:52:54 2023 UTC (5 months, 2 weeks ago) by bluhm
Branch: MAIN
Changes since 1.359: +2 -1 lines
Diff to previous 1.359 (colored)

Backout always allocate per-CPU statistics counters for network
interface descriptor.  It panics during attach of em(4) device at
boot.

Revision 1.359 / (download) - annotate - [select for diffs], Fri Dec 22 23:01:50 2023 UTC (5 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.358: +1 -2 lines
Diff to previous 1.358 (colored)

Always allocate per-CPU statistics counters for network interface
descriptor.

We have the mess in network interface statistics. Only pseudo drivers
do per-CPU counters allocation, all other network devices use the old
`if_data'. The network stack partially uses per-CPU counters and
partially use `if_data', but the protection is inconsistent: some times
counters accessed with exclusive netlock, some times with shared
netlock, some times with kernel lock, but without netlock, some times
with another locks.

To make network interfaces statistics more consistent, always allocate
per-CPU counters at interface attachment time and use it instead of
`if_data'. At this step only move counters allocation to the if_attach()
internals. The `if_data' removal will be performed with the following
diffs to make review and tests easier.

ok bluhm

Revision 1.358 / (download) - annotate - [select for diffs], Sat Sep 16 09:33:27 2023 UTC (8 months, 3 weeks ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.357: +3 -2 lines
Diff to previous 1.357 (colored)

Allow counters_read(9) to take an optional scratch buffer.

Using a scratch buffer makes it possible to take a consistent snapshot of
per-CPU counters without having to allocate memory.

Makes ddb(4) show uvmexp command work in OOM situations.

ok kn@, mvs@, cheloha@

Revision 1.357 / (download) - annotate - [select for diffs], Tue May 16 14:32:54 2023 UTC (12 months, 3 weeks ago) by jan
Branch: MAIN
Changes since 1.356: +2 -2 lines
Diff to previous 1.356 (colored)

Use separate IFCAPs for LRO and TSO.

This diff introduces separate capabilities for TCP offloading.  We split this
into LRO (large receive offloading) and TSO (TCP segmentation offloading).
LRO can be turned on/off via tcprecvoffload option of ifconfig and is not
inherited to sub interfaces.

TSO is inherited by sub interfaces to signal this hardware offloading capability
to the network stack.

With tweaks from bluhm, claudio and dlg

ok bluhm, claudio

Revision 1.356 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:09 2023 UTC (15 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.355: +1 -2 lines
Diff to previous 1.355 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.355 / (download) - annotate - [select for diffs], Thu Sep 8 10:22:06 2022 UTC (21 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.354: +2 -2 lines
Diff to previous 1.354 (colored)

Rename global ifnet TAILQ

Naming the list like the struct itself makes for awful grepping.
Call the global variable "ifnetlist" from now on.

There used to be kvm(3) consumers in base picking up this symbol, but those
have long been converted to other interfaces.

A few potential ports users remain, same deal as sys/net/if_var.h r1.116
"Remove struct ifnet's unused if_switchport member":  they get bumped.

Previous users pointed out by deraadt
OK bluhm

Revision 1.354 / (download) - annotate - [select for diffs], Wed Mar 10 10:21:48 2021 UTC (3 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.353: +2 -2 lines
Diff to previous 1.353 (colored)

spelling

ok gnezdo@ semarie@ mpi@

Revision 1.353 / (download) - annotate - [select for diffs], Sun Mar 7 06:02:32 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.352: +12 -13 lines
Diff to previous 1.352 (colored)

use uint64_t ethernet addresses for compares in carp.

pass the uint64_t that ether_input has already converted from a
real ethernet address into carp_input so it can use it without
having to do its own conversion.

tested by hrvoje popovski
tested by me on amd64 and sparc64
ok patrick@ jmatthew@

Revision 1.352 / (download) - annotate - [select for diffs], Mon Feb 8 12:30:10 2021 UTC (3 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.351: +2 -5 lines
Diff to previous 1.351 (colored)

Start refcounting interface groups with 1.  if_creategroup() returns
a new object that is already refcounted, so carp attach does not
reach into internal structures.  Add kasserts to detect counter
overflow or underflow.
OK mvs@

Revision 1.351 / (download) - annotate - [select for diffs], Thu Jan 21 13:18:07 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.350: +6 -3 lines
Diff to previous 1.350 (colored)

carp(4): convert ifunit() to if_unit(9)

ok dlg@ bluhm@

Revision 1.349.4.1 / (download) - annotate - [select for diffs], Wed Jan 13 17:40:05 2021 UTC (3 years, 4 months ago) by benno
Branch: OPENBSD_6_8
Changes since 1.349: +3 -5 lines
Diff to previous 1.349 (colored) next main 1.350 (colored)

this is errata 6.8/012_carp.patch

revision 1.350 date: 2021/01/04 15:02:34; author: sashan; state: Exp; lines: +3 -5; commitid: gGsb9REM1jFCiFpN;
- fix use after free, when packet gets dropped.

patch submitted by Ralf Horstmann from ackstorm.de

OK dlg@

Revision 1.350 / (download) - annotate - [select for diffs], Mon Jan 4 15:02:34 2021 UTC (3 years, 5 months ago) by sashan
Branch: MAIN
Changes since 1.349: +3 -5 lines
Diff to previous 1.349 (colored)

- fix use after free, when packet gets dropped.

patch submitted by Ralf Horstmann from ackstorm.de

OK dlg@

Revision 1.349 / (download) - annotate - [select for diffs], Tue Jul 28 16:44:34 2020 UTC (3 years, 10 months ago) by yasuoka
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE
Branch point for: OPENBSD_6_8
Changes since 1.348: +4 -2 lines
Diff to previous 1.348 (colored)

Don't treat an error if carppeer is an unicast and the peer is down.

ok kn

Revision 1.348 / (download) - annotate - [select for diffs], Tue Jul 28 09:22:37 2020 UTC (3 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.347: +3 -3 lines
Diff to previous 1.347 (colored)

After the previous commit, src/regress/sys/netinet/carp triggered
an uvm fault.  Check that ifp0 is not NULL.
OK sashan@ mvs@

Revision 1.347 / (download) - annotate - [select for diffs], Fri Jul 24 18:17:15 2020 UTC (3 years, 10 months ago) by mvs
Branch: MAIN
Changes since 1.346: +90 -54 lines
Diff to previous 1.346 (colored)

Use interface index instead of pointer to `ifnet' in carp(4).

ok sashan@

Revision 1.346 / (download) - annotate - [select for diffs], Wed Jul 22 01:50:39 2020 UTC (3 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.345: +6 -22 lines
Diff to previous 1.345 (colored)

move carp_input into ether_input, instead of via an input handler.

carp_input is only tried after vlan and bridge handling is done,
and after the ethernet packet doesnt match the parent interfaces
mac address.

this has been in snaps as part of a larger diff for over a week.

Revision 1.345 / (download) - annotate - [select for diffs], Thu May 21 05:24:59 2020 UTC (4 years ago) by dlg
Branch: MAIN
Changes since 1.344: +1 -7 lines
Diff to previous 1.344 (colored)

don't count packets in the carp protocol handling against an interface.

these packets have generally already been counted on the interface
because that's where they were sent or received from. the protocol
handling side of things already counts things like packets, which
you see with netstat -sp carp.

Revision 1.344 / (download) - annotate - [select for diffs], Thu May 21 03:33:44 2020 UTC (4 years ago) by dlg
Branch: MAIN
Changes since 1.343: +65 -41 lines
Diff to previous 1.343 (colored)

implement a carp_transmit that bypasses the ifq on output.

this is modelled on vlan_transmit, and basically enqueues the packet
directly on the parent interface.

even though carp is generally not used to transmit packets, we run
dhcp relays on it at work and hit a situation where we unecessarily
dropped packets because it's ifq maxlen was 1. i've been running
this for a month in production.

ok jmatthew@

Revision 1.343 / (download) - annotate - [select for diffs], Wed Apr 29 07:04:32 2020 UTC (4 years, 1 month ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.342: +5 -5 lines
Diff to previous 1.342 (colored)

remove some trailing whitespace. no functional change.

Revision 1.342 / (download) - annotate - [select for diffs], Fri Nov 8 07:51:41 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.341: +6 -8 lines
Diff to previous 1.341 (colored)

void being too clever about setting/clearing ifpromisc on the parent.

ifpromisc() already refcounts, so carp doesn't have to do it
implicitly with the carpdev list. there's no functional change, the
code just gets a bit simpler.

Revision 1.341 / (download) - annotate - [select for diffs], Fri Nov 8 07:16:29 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.340: +6 -6 lines
Diff to previous 1.340 (colored)

convert interface address change hooks to tasks and a task_list.

this follows what's been done for detach and link state hooks, and
makes handling of hooks generally more robust.

address hooks are a bit different to detach/link state hooks in
that there's only a few things that register hooks (carp, pf, vxlan),
but a lot of places to run the hooks (lots of ipv4 and ipv6 address
configuration).

an address hook cookie was in struct pfi_kif, which is part of the
pf abi. rather than break pfctl -sI, this maintains the void * used
for the cookie and uses it to store a task, which is then used as
intended with the new api.

Revision 1.340 / (download) - annotate - [select for diffs], Thu Nov 7 07:36:32 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.339: +27 -47 lines
Diff to previous 1.339 (colored)

turn the linkstate hooks into a task list, like the detach hooks.

this is largely mechanical, except for carp. this moves the addition
of the carp link state hook after we're committed to using the new
interface as a carpdev. because the add can't fail, we avoid a
complicated unwind dance. also, this tweaks the carp linkstate hook
so it only updates the relevant carp interface, not all of the
carpdevs on the parent.

hrvoje popovski has tested an early version of this diff and it's
generally ok, but there's some splasserts that this diff fires that
i'll fix in an upcoming diff.

ok claudio@

Revision 1.339 / (download) - annotate - [select for diffs], Wed Nov 6 03:51:26 2019 UTC (4 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.338: +8 -14 lines
Diff to previous 1.338 (colored)

replace the hooks used with if_detachhooks with a task list.

the main semantic change is that things registering detach hooks
have to allocate and set a task structure that then gets added to
the list. this means if the task is allocated up front (eg, as part
of carps softc or bridges port structure), it avoids the possibility
that adding a hook can fail. a lot of drivers weren't checking for
failure, and unwinding state in the event of failure in other parts
was error prone.

while doing this i discovered that the list operations have to be
in a particular order, but drivers weren't doing that consistently
either. this diff wraps the list ops up so you have to seriously
go out of your way to screw them up.

ive also sprinkled some NET_ASSERT_LOCKED around the list operations
so we can make sure there's no potential for the list to be corrupted,
especially while it's being run.

hrvoje popovski has tested this a bit, and some issues he discovered
have been fixed.

ok sashan@

Revision 1.338 / (download) - annotate - [select for diffs], Mon Jun 10 16:32:51 2019 UTC (5 years ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.337: +5 -5 lines
Diff to previous 1.337 (colored)

Use mallocarray(9) & put some free(9) sizes for M_IPMOPTS allocations.

ok semarie@, visa@

Revision 1.337 / (download) - annotate - [select for diffs], Tue Apr 23 10:53:45 2019 UTC (5 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.336: +4 -8 lines
Diff to previous 1.336 (colored)

a first cut at converting some virtual ethernet interfaces to if_vinput

this let's input processing bypass ifiqs. there's a performance
benefit from this, and it will let me tweak the backpressure detection
mechanism that ifiqs use without impacting on a stack of virtual
interfaces.

ive tested all of these except mpw, which i will end up testing
soon anyway.

Revision 1.336 / (download) - annotate - [select for diffs], Mon Dec 17 09:17:30 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.335: +7 -7 lines
Diff to previous 1.335 (colored)

Switch from timeout_add with tvtohz to just timeout_add_tv. Now this change
will reduce the sleep time by one tick which doesn't matter in the common
case. The code never passes a true 0 timeval to timeout_add_tv so the code
will always sleep for at least 1 tick which is good enough.
OK kn@, florian@, visa@, cheloha@

Revision 1.335 / (download) - annotate - [select for diffs], Tue Dec 4 12:39:54 2018 UTC (5 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.334: +6 -8 lines
Diff to previous 1.334 (colored)

Use m_align() and while there reorder the pkthdr initalisation a bit.
This also makes the IPv4 and IPv6 code more similar.
OK phessler@

Revision 1.334 / (download) - annotate - [select for diffs], Mon Sep 24 12:25:52 2018 UTC (5 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.333: +15 -16 lines
Diff to previous 1.333 (colored)

Turn carp_ourether() mp-safe, this is a requirement for taking bridge(4)
out of the KERNEL_LOCK().

ok visa@, bluhm@

Revision 1.333 / (download) - annotate - [select for diffs], Tue Jul 10 11:22:54 2018 UTC (5 years, 11 months ago) by friehm
Branch: MAIN
Changes since 1.332: +1 -3 lines
Diff to previous 1.332 (colored)

Remove DELAY(1000) from carp_send_arp() / carp_send_na() since it is not clear
why it was necessary.

OK bluhm@
'ok but watch for fallouts' mpi@

Revision 1.332 / (download) - annotate - [select for diffs], Mon May 21 15:52:22 2018 UTC (6 years ago) by bluhm
Branch: MAIN
Changes since 1.331: +10 -17 lines
Diff to previous 1.331 (colored)

All places that call carp_lsdrop() use the interface pointer already.
It does not make sense to call if_get() again, just pass ifp as
parameter.  Move the IFT_CARP check into the function instead of
doing it everywhere.  Replace the inverted match variable logic
with simple returns.
OK mpi@ friehm@

Revision 1.331 / (download) - annotate - [select for diffs], Wed Mar 21 15:01:10 2018 UTC (6 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.330: +5 -9 lines
Diff to previous 1.330 (colored)

The function carp_prepare_ad() never fails.  The error handling in
the caller would leak a mbuf.  Convert carp_prepare_ad() to a void
function and remove the error check.
reported by Maxime Villard; OK mpi@

Revision 1.330 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:53 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.329: +3 -3 lines
Diff to previous 1.329 (colored)

Remove almost unused `flags' argument of suser().

The account flag `ASU' will no longer be set but that makes suser()
mpsafe since it no longer mess with a per-process field.

No objection from millert@, ok tedu@, bluhm@

Revision 1.329 / (download) - annotate - [select for diffs], Wed Feb 7 11:30:01 2018 UTC (6 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.328: +6 -3 lines
Diff to previous 1.328 (colored)

Unbreak carp(4) MAC check in bridge_process().

Introduce bridge_ourether() and move carp(4)-specific SRPL code inside
carp_ourether().

ok bluhm@

Revision 1.328 / (download) - annotate - [select for diffs], Thu Jan 25 14:47:35 2018 UTC (6 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.327: +13 -4 lines
Diff to previous 1.327 (colored)

Use a workaround for detached parent in carp_proto_input_c().

A NULL dereference can happen since processing protocol layer is
deffered to a second task.  In other words the NET_LOCK() is released
then regrabbed between ip_input() and carp_proto_input().

The same workaround is already in use in carp_output() due to deffered
processing in case of IPsec.

The real fix is to make carp(4) MP-safe and use if_get(9) there, any
taker?

Found & fix tested by Hrvoje Popovski.

Revision 1.327 / (download) - annotate - [select for diffs], Fri Jan 12 23:47:24 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.326: +31 -24 lines
Diff to previous 1.326 (colored)

have carp use standard detach hooks instead of getting special handling

if_deactivate looked for carp parent interfaces and called carp_ifdetach
to have children interfaces unplug themselves. this diff has the
carp interfaces register detach hooks on the parent instead. the
effect is the same, but using the standard every other interface
uses.

while im here i shuffle the order the hooks carp_set_ifp are
estabilshed so it will fail if they arent allocated.

ok visa@ mpi@

Revision 1.326 / (download) - annotate - [select for diffs], Fri Jan 12 23:29:37 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.325: +9 -2 lines
Diff to previous 1.325 (colored)

unbreak configurations using carppeers

ip_carp.c r1.322 removed the ability to receive carp protocol packets
on !IFT_CARP interfaces. however, carppeers cause the carp protocol
packets to be directed to a unicast address on another interface,
which definitely is not mapped back to a carp interface.

this brings back the ability to get carp packets on parent interfaces.
it is a bit different to a backout because it only allows carp
parents to be ethernet interfaces.

mpi@ told me carp regress tests were failing.

Revision 1.325 / (download) - annotate - [select for diffs], Fri Jan 12 00:36:13 2018 UTC (6 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.324: +5 -5 lines
Diff to previous 1.324 (colored)

restrict carp to configuring ethernet interfaces as carpdevs.

previously the driver only cared that a carp interface wasnt configured
as a carpdev. because the code only really works on ethernet, it makes
sense to restrict it.

ok visa@ mpi@

Revision 1.324 / (download) - annotate - [select for diffs], Thu Jan 11 00:14:15 2018 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.323: +2 -2 lines
Diff to previous 1.323 (colored)

carp_ourether gets passed the parent interface, not the carp interface.

Revision 1.323 / (download) - annotate - [select for diffs], Wed Jan 10 23:50:39 2018 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.322: +54 -71 lines
Diff to previous 1.322 (colored)

get rid of struct carp_if by moving the srpl into struct ifnet if_carp.

currently carp uses a struct carp_if to hold an srp list head, which
is accessed by both if_carp in struct ifnet, and via the if input
handlers list.

this gets rid of some indirection by making if_carp itself the list
head, rather than a pointer to the list head via a struct carp_if.
it also makes accessing the list consistent by only using if_carp
to get to it.

ok mpi@

Revision 1.322 / (download) - annotate - [select for diffs], Wed Jan 10 10:25:52 2018 UTC (6 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.321: +2 -3 lines
Diff to previous 1.321 (colored)

simplify the input interface type check in carp_proto_input_if.

carp6_proto_input_if only handles packets "received" on real carp
interfaces, which the ethernet stack goes to a lot of trouble to
provide. since carp assumes ethernet, carp_proto_input_if can assume
the packets will come in right too.

ok mpi@

Revision 1.321 / (download) - annotate - [select for diffs], Tue Jan 9 15:24:24 2018 UTC (6 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.320: +2 -5 lines
Diff to previous 1.320 (colored)

Creating a cloned interface could return ENOMEM due to temporary
memory shortage.  As it is invoked from a system call, it should
not fail and wait instead.
OK visa@ mpi@

Revision 1.320 / (download) - annotate - [select for diffs], Thu Nov 23 13:32:25 2017 UTC (6 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.319: +1 -17 lines
Diff to previous 1.319 (colored)

Replace non mp-safe carp_iamatch6() with mp-safe carp_iamatch().

They have the same functionnality since friehm@ cleaned up
balancing code.

ok florian@, visa@, patrick@, bluhm@, jmatthew@

Revision 1.319 / (download) - annotate - [select for diffs], Tue Nov 21 09:08:55 2017 UTC (6 years, 6 months ago) by patrick
Branch: MAIN
Changes since 1.318: +3 -4 lines
Diff to previous 1.318 (colored)

Move the addrhook disestablish from carpdetach() to carp_clone_destroy()
to make it symmetric to the addrhook establish which is being done in
carp_clone_create().  This fixes the issue that carp does not recognize
address changes on the carp after an interface has detached, which could
cause issues like carp not recovering or even panics.  Unfortunately
there are more bugs lurking in carp.

ok bluhm@

Revision 1.318 / (download) - annotate - [select for diffs], Mon Nov 20 10:35:24 2017 UTC (6 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.317: +6 -2 lines
Diff to previous 1.317 (colored)

Sprinkle some NET_ASSERT_LOCKED(), const and co to prepare running
pr_input handlers without KERNEL_LOCK().

ok visa@

Revision 1.317 / (download) - annotate - [select for diffs], Mon Oct 16 13:20:20 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.316: +9 -2 lines
Diff to previous 1.316 (colored)

Handle the case where the parent of a carp(4) is being destroyed
while packets where being passed to IPsec tasks.

Found the hardway by Hrvoje Popovski.

ok phessler@, claudio@

Revision 1.316 / (download) - annotate - [select for diffs], Mon Oct 9 08:35:38 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.315: +7 -2 lines
Diff to previous 1.315 (colored)

Reduces the scope of the NET_LOCK() in sysctl(2) path.

Exposes per-CPU counters to real parrallelism.

ok visa@, bluhm@, jca@

Revision 1.315 / (download) - annotate - [select for diffs], Fri Aug 11 21:24:19 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.314: +7 -12 lines
Diff to previous 1.314 (colored)

Remove NET_LOCK()'s argument.

Tested by Hrvoje Popovski, ok bluhm@

Revision 1.314 / (download) - annotate - [select for diffs], Thu Jun 22 11:34:51 2017 UTC (6 years, 11 months ago) by tom
Branch: MAIN
Changes since 1.313: +2 -2 lines
Diff to previous 1.313 (colored)

Fix the remaining ';;'s in sys/

Revision 1.313 / (download) - annotate - [select for diffs], Mon Jun 19 17:58:49 2017 UTC (6 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.312: +3 -3 lines
Diff to previous 1.312 (colored)

When dealing with mbuf pointers passed down as function parameters,
bugs could easily result in use-after-free or double free.  Introduce
m_freemp() which automatically resets the pointer before freeing
it.  So we have less dangling pointers in the kernel.
OK krw@ mpi@ claudio@

Revision 1.312 / (download) - annotate - [select for diffs], Tue May 30 12:09:27 2017 UTC (7 years ago) by friehm
Branch: MAIN
Changes since 1.311: +42 -10 lines
Diff to previous 1.311 (colored)

Carp balancing ip does not work since there is a mac filter in
ether_input(). Now we use mbuf tags instead of modifying the MAC
address.

ok mpi@

Revision 1.311 / (download) - annotate - [select for diffs], Sun May 28 12:47:24 2017 UTC (7 years ago) by mpi
Branch: MAIN
Changes since 1.310: +5 -1 lines
Diff to previous 1.310 (colored)

Leaving IP multicast group requires the NET_LOCK().

Grab the lock before calling carpdetach().

ok bluhm@

Revision 1.310 / (download) - annotate - [select for diffs], Sat May 27 21:55:52 2017 UTC (7 years ago) by bluhm
Branch: MAIN
Changes since 1.309: +15 -14 lines
Diff to previous 1.309 (colored)

Fix the carp mode 'balancing ip-stealth'.  Set the link state UP
if at least one vhid is in state MASTER.
from Florian Riehm; OK florian@

Revision 1.309 / (download) - annotate - [select for diffs], Thu May 4 17:58:46 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.308: +3 -3 lines
Diff to previous 1.308 (colored)

If m is not a continuous mbuf cluster, m_pullup() in pr_input may
change the pointer.  Then *mp keeps the invalid pointer and it might
be used.  Fix the potential use after free and also reset *mp in
other places to have less dangling pointers to freed mbufs.
OK mpi@ mikeb@

Revision 1.308 / (download) - annotate - [select for diffs], Fri Apr 14 20:46:31 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.307: +3 -3 lines
Diff to previous 1.307 (colored)

Pass down the address family through the pr_input calls.  This
allows to simplify code used for both IPv4 and IPv6.
OK mikeb@ deraadt@

Revision 1.307 / (download) - annotate - [select for diffs], Tue Apr 11 14:43:49 2017 UTC (7 years, 2 months ago) by dhill
Branch: MAIN
Changes since 1.306: +3 -3 lines
Diff to previous 1.306 (colored)

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray.  Reminded by tedu@

ok deraadt@

Revision 1.306 / (download) - annotate - [select for diffs], Sun Apr 9 17:57:58 2017 UTC (7 years, 2 months ago) by dhill
Branch: MAIN
Changes since 1.305: +3 -3 lines
Diff to previous 1.305 (colored)

Use mallocarray to allocate multicast group memberships.

ok deraadt@

Revision 1.305 / (download) - annotate - [select for diffs], Wed Apr 5 13:35:18 2017 UTC (7 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.304: +2 -1 lines
Diff to previous 1.304 (colored)

When building counter memory in preparation to copy to userland, always
zero the buffers first.  All the current objects appear to be safe,
however future changes might introduce structure pads.
Discussed with guenther, ok bluhm

Revision 1.304 / (download) - annotate - [select for diffs], Thu Mar 23 14:12:46 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.303: +2 -5 lines
Diff to previous 1.303 (colored)

Replace manual loop with SRPL_FOREACH_SAFE_LOCKED macro.
OK mpi@

Revision 1.303 / (download) - annotate - [select for diffs], Fri Mar 17 17:06:25 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.302: +1 -7 lines
Diff to previous 1.302 (colored)

carp(4) code is always executed in the 'softnet' thread, so remove
unneeded splnet()/splx() dance.

ok mikeb@, bluhm@

Revision 1.302 / (download) - annotate - [select for diffs], Mon Feb 20 06:29:42 2017 UTC (7 years, 3 months ago) by jca
Branch: MAIN
Changes since 1.301: +37 -28 lines
Diff to previous 1.301 (colored)

carp(4) percpu counters

ok florian@

Revision 1.301 / (download) - annotate - [select for diffs], Sun Jan 29 19:58:47 2017 UTC (7 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.300: +35 -33 lines
Diff to previous 1.300 (colored)

Change the IPv4 pr_input function to the way IPv6 is implemented,
to get rid of struct ip6protosw and some wrapper functions.  It is
more consistent to have less different structures.  The divert_input
functions cannot be called anyway, so remove them.
OK visa@ mpi@

Revision 1.300 / (download) - annotate - [select for diffs], Wed Jan 25 17:34:31 2017 UTC (7 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.299: +2 -8 lines
Diff to previous 1.299 (colored)

Since raw_input() and route_input() are gone from pr_input, we can
make the variable parameters of the protocol input functions fixed.
Also add the proto to make it similar to IPv6.
OK mpi@ guenther@ millert@

Revision 1.299 / (download) - annotate - [select for diffs], Mon Jan 23 11:37:29 2017 UTC (7 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.298: +2 -1 lines
Diff to previous 1.298 (colored)

Flag pseudo-interfaces as such in order to call add_net_randomness()
only once per packet.

Fix a regression introduced when if_input() started to be called by
every pseudo-driver.

ok claudio@, dlg@

Revision 1.298 / (download) - annotate - [select for diffs], Tue Dec 20 14:30:52 2016 UTC (7 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.297: +35 -19 lines
Diff to previous 1.297 (colored)

Prevent grabing the NET_LOCK() twice in the ioctl(2) and input path.

While here remove two redundant splsoftnet()/splx() dances.

inputs and ok bluhm@

Revision 1.297 / (download) - annotate - [select for diffs], Mon Dec 19 08:36:49 2016 UTC (7 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.296: +3 -3 lines
Diff to previous 1.296 (colored)

Introduce the NET_LOCK() a rwlock used to serialize accesses to the parts
of the network stack that are not yet ready to be executed in parallel or
where new sleeping points are not possible.

This first pass replace all the entry points leading to ip_output(). This
is done to not introduce new sleeping points when trying to acquire ART's
write lock, needed when a new L2 entry is created via the RT_RESOLVE.

Inputs from and ok bluhm@, ok dlg@

Revision 1.296 / (download) - annotate - [select for diffs], Sun Nov 20 11:40:58 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.295: +4 -4 lines
Diff to previous 1.295 (colored)

Rename SRPL_ENTER() to SRPL_FIRST() and SRPL_NEXT() to SRPL_FOLLOW().

This allows us to introduce SRPL_NEXT() that can be used to start
iterating on an arbitrary member of an srp list, hence without calling
SRPL_ENTER().

ok dlg@, jmatthew@

Revision 1.295 / (download) - annotate - [select for diffs], Tue Oct 25 07:21:02 2016 UTC (7 years, 7 months ago) by yasuoka
Branch: MAIN
Changes since 1.294: +2 -2 lines
Diff to previous 1.294 (colored)

Accept CARP advertisement packets whose destination is not for multicast.
When both "carppeer" and "real mac-address" are used at once and the
BACKUP is to take over the new MASTER, the present MASTER receives
such packets.  Found by and diff from nagasaka at iij.

ok henning bluhm

Revision 1.294 / (download) - annotate - [select for diffs], Tue Oct 4 13:54:32 2016 UTC (7 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.293: +4 -4 lines
Diff to previous 1.293 (colored)

Convert timeouts that need a process context to timeout_set_proc(9).

The current reason is that rtalloc_mpath(9) inside ip_output() might
end up inserting a RTF_CLONED route and that require a write lock.

ok kettenis@, bluhm@

Revision 1.293 / (download) - annotate - [select for diffs], Mon Jul 25 16:44:04 2016 UTC (7 years, 10 months ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.292: +2 -1 lines
Diff to previous 1.292 (colored)

fix revision 1.290 of sys/netinet/ip_carp.c.

diff from jsg@
ok deraadt@, benno@

Revision 1.292 / (download) - annotate - [select for diffs], Tue Jul 19 16:08:46 2016 UTC (7 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.291: +4 -5 lines
Diff to previous 1.291 (colored)

Fix the check supposed to prevent 'ip' and 'ip-stealth' balancing modes
from leaking the multicast address.

beck@ found the hard way that this made his second CARP master use a
wrong MAC address.

This is part of a bigger diff from Florian Riehm who is currently
working on a proper solution to fix balancing modes.

ok beck@, bluhm@

Revision 1.291 / (download) - annotate - [select for diffs], Mon Jun 6 07:01:37 2016 UTC (8 years ago) by mpi
Branch: MAIN
Changes since 1.290: +3 -9 lines
Diff to previous 1.290 (colored)

Get rid of the ``enaddr'' argument of carp_iamatch().

It was only checked in balancing mode, which is currently broken, and is
no longer needed.

Discusssed with bluhm@ and Florian Riehm.

Revision 1.290 / (download) - annotate - [select for diffs], Mon May 30 12:56:16 2016 UTC (8 years ago) by mpi
Branch: MAIN
Changes since 1.289: +14 -1 lines
Diff to previous 1.289 (colored)

Insert a hack to deal with interfaces removing the VLAN header before
the packet has been feed to the pseudo-interfaces input handlers.

To fix that without introducing a layer violation we should be able to
disable HW-vlan on parent when in use with different pseudo-interfaces.

In the case of bridge(4) for example it makes no sense to let the interface
remove the VLAN header if the kernel has to add it back for every packet.

Fix issues reported by sebastia@ and markus@

From dlg@, ok claudio@

Revision 1.289 / (download) - annotate - [select for diffs], Wed May 18 03:46:03 2016 UTC (8 years ago) by dlg
Branch: MAIN
Changes since 1.288: +16 -16 lines
Diff to previous 1.288 (colored)

rework the srp api so it takes an srp_ref struct that the caller provides.

the srp_ref struct is used to track the location of the callers
hazard pointer so later calls to srp_follow and srp_enter already
know what to clear. this in turn means most of the caveats around
using srps go away. specifically, you can now:

- switch cpus while holding an srp ref
  - ie, you can sleep while holding an srp ref
- you can take and release srp refs in any order

the original intent was to simplify use of the api when dealing
with complicated data structures. the caller now no longer has to
track the location of the srp a value was fetched from, the srp_ref
effectively does that for you.

srp lists have been refactored to use srp_refs instead of srpl_iter
structs.

this is in preparation of using srps inside the ART code. ART is a
complicated data structure, and lookups require overlapping holds
of srp references.

ok mpi@ jmatthew@

Revision 1.288 / (download) - annotate - [select for diffs], Wed Apr 13 11:41:15 2016 UTC (8 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.287: +1 -2 lines
Diff to previous 1.287 (colored)

We're always ready!  So send IFQ_SET_READY() to the bitbucket.

Revision 1.287 / (download) - annotate - [select for diffs], Tue Feb 23 01:39:14 2016 UTC (8 years, 3 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.286: +2 -2 lines
Diff to previous 1.286 (colored)

provide m_dup_pkt() for doing fast deep mbuf copies with a specified alignment

if a physical interface receives a multicast/broadcast packet and
has carp interfaces on it, that packet needs to be copied for
reception by each of those carp interfaces.

previously it was using m_copym2, but that doesn't respect the
alignment of the source packet. this meant the ip header in the
copies were aligned incorrectly for the network stack, which breaks
strict alignment archs.

m_dup_pkt lets carp specify that the payload needs an ETHER_ALIGN
adjustment, so the ip header inside will be aligned correctly.

reported and tested by anthony eden who hit this on armv7
i reproduced the problem on sparc64 and verified the fix on amd64
and sparc64
ok mpi@ mikeb@ deraadt@

Revision 1.264.4.2 / (download) - annotate - [select for diffs], Tue Feb 9 17:24:15 2016 UTC (8 years, 4 months ago) by bluhm
Branch: OPENBSD_5_8
Changes since 1.264.4.1: +4 -3 lines
Diff to previous 1.264.4.1 (colored) to branchpoint 1.264 (colored) next main 1.265 (colored)

There was another bug in vlan and carp ifih refcounting.  An ifih
could be inserted twice into the the parent's list.  Then the kernel
will panic if root does an ifconfig destroy of the parent interface.
This affects OpenBSD 5.8 only.
From markus@; OK mpi@

Revision 1.264.4.1 / (download) - annotate - [select for diffs], Mon Feb 8 21:57:46 2016 UTC (8 years, 4 months ago) by bluhm
Branch: OPENBSD_5_8
Changes since 1.264: +13 -9 lines
Diff to previous 1.264 (colored)

Carp in OpenBSD 5.8 is affected by the same bug as vlan.  By creating,
changing and destroying carp interfaces multiple times, root could
crash the OpenBSD 5.8 kernel with ifconfig.  The reference counting
of carp_ifih in carp_set_ifp() was wrong, so a use after free was
possible.  Reordering the operations fixes it.
From markus@; OK mpi@

Revision 1.286 / (download) - annotate - [select for diffs], Thu Jan 21 11:23:48 2016 UTC (8 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.285: +2 -6 lines
Diff to previous 1.285 (colored)

Introduce in{,6}_hasmulti(), two functions to check in the hot path if
an interface joined a specific multicast group.

ok phessler@, visa@, dlg@

Revision 1.285 / (download) - annotate - [select for diffs], Tue Jan 12 09:22:01 2016 UTC (8 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.284: +10 -11 lines
Diff to previous 1.284 (colored)

Prevent a NULL-reference if SIOCGVH is issued without carpdev argument.

Problem reported by and diff tested by Fabian Raetz, thanks!

ok benno@, bluhm@

Revision 1.284 / (download) - annotate - [select for diffs], Sat Dec 19 11:19:35 2015 UTC (8 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.283: +12 -5 lines
Diff to previous 1.283 (colored)

Make carp_output() mpsafe.

This is needed in order to fully unlock ARP processing with carp(4)
interfaces as found the hardway by sthen@.

ok sthen@, dlg@

Revision 1.283 / (download) - annotate - [select for diffs], Thu Dec 3 16:27:32 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.282: +4 -4 lines
Diff to previous 1.282 (colored)

Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow to
fallback to a SLIST.

ok dlg@, jasper@

Revision 1.282 / (download) - annotate - [select for diffs], Wed Nov 18 13:53:59 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.281: +10 -8 lines
Diff to previous 1.281 (colored)

Make use of srp_enter()/srp_leave() in carp_iamatch() in preparation
for unlocking the ARP input path.

ok dlg@

Revision 1.281 / (download) - annotate - [select for diffs], Thu Nov 12 05:46:45 2015 UTC (8 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.280: +1 -2 lines
Diff to previous 1.280 (colored)

IFQ_DROP means a drop because enqueue on the send q failed, not cos tx
later failed.

Revision 1.280 / (download) - annotate - [select for diffs], Mon Nov 2 15:56:46 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.279: +1 -6 lines
Diff to previous 1.279 (colored)

Remove leftovers from previous carp(4)-to-relayd(8) conversion diff.

Pointed by and ok reyk@

Revision 1.279 / (download) - annotate - [select for diffs], Mon Nov 2 15:05:23 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.278: +22 -137 lines
Diff to previous 1.278 (colored)

Retire ARP load-balacing, thanks for all the fish!

One of the keys of our MP work relies on making OpenBSD's kernel simpler!
In this case turning ARP processing MP-safe is quite complicated due to
the way carp(4) is hooked in arpinput() and nowadays you'd better run
kitchensinkd(9) anyway :)

ok bluhm@, claudio@, reyk@

Revision 1.278 / (download) - annotate - [select for diffs], Sun Oct 25 11:58:11 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.277: +1 -2 lines
Diff to previous 1.277 (colored)

Introduce if_rtrequest() the successor of ifa_rtrequest().

L2 resolution depends on the protocol (encoded in the route entry) and
an ``ifp''.  Not having to care about an ``ifa'' makes our life easier
in our MP effort.  Fewer dependencies between data structures implies
fewer headaches.

Discussed with bluhm@, ok claudio@

Revision 1.277 / (download) - annotate - [select for diffs], Thu Oct 22 13:30:29 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.276: +3 -3 lines
Diff to previous 1.276 (colored)

Do not pass an ``ia'' just to dereference ``ia_ifp''.

ok claudio@, bluhm@, jsg@

Revision 1.276 / (download) - annotate - [select for diffs], Wed Oct 14 13:59:31 2015 UTC (8 years, 7 months ago) by jsg
Branch: MAIN
Changes since 1.275: +2 -2 lines
Diff to previous 1.275 (colored)

Init a variable in the recently added carp_vhe_match() function clang
and mpi believe could be used uninitialised.

ok mpi@

Revision 1.275 / (download) - annotate - [select for diffs], Mon Oct 5 19:05:09 2015 UTC (8 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.274: +1 -0 lines
Diff to previous 1.274 (colored)

Revert if_oqdrops accounting changes done in kernel, per request from mpi@.

(Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because
IFQ_ENQUEUE() already does it.  Oops.)

After this revert, the situation becomes:

- if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but
  it is not shown to userland, and

- if_data.ifi_oqdrops is shown to userland, but it is not incremented by
  anyone.

Revision 1.274 / (download) - annotate - [select for diffs], Mon Oct 5 15:52:46 2015 UTC (8 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.273: +1 -2 lines
Diff to previous 1.273 (colored)

Don't count IF_DROP()'ed packets as if_oerrors too.

mpi@ plans to clean-up IF_DROP()'s, but fix consistent use of it for now.

OK dlg@

Revision 1.273 / (download) - annotate - [select for diffs], Mon Sep 28 08:36:24 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.272: +13 -14 lines
Diff to previous 1.272 (colored)

Factors ou the route hashing code to implement Equal-Cost Multi-Path
for ART.

While here sync the two remaining mix() macros.

ok chris@, dlg@

Revision 1.272 / (download) - annotate - [select for diffs], Sun Sep 27 04:27:57 2015 UTC (8 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.271: +233 -77 lines
Diff to previous 1.271 (colored)

make carp_input mpsafe.

there are three data structures involved here:

the list of carp interfaces on a parent interface (struct carp_if)
is now accessed via the if_ih cookie. its lifetime is managed by
the if_ih_insert and if_ih_remove calls.

the second is the interfaces (struct carp_softc) in the list above.
these has been moved from being access via a TAILQ to an SRPL.
modifications to the list are serialised by the kernel lock.

the third is the list of vhost entries (struct carp_vhost_entry).
these used to be in a LIST on each carp_softc, but have been moved
to being accessed vian an SRPL. modifications to the list are
serialised by the kernel lock.

written at l2k15
tested by mpi@ and hrvoje popovski
ok mpi@

Revision 1.271 / (download) - annotate - [select for diffs], Sat Sep 12 20:51:35 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.270: +50 -50 lines
Diff to previous 1.270 (colored)

consistently name the ifnet * that refers to the parent interface
ifp0, and the ifnet * that refers to the carp interface ifp.

this makes it easier for me to read. it's probably not the right
name for ifp0, but at least it's consistent.

ok sthen@ bluhm@ mpi@ claudio@

Revision 1.270 / (download) - annotate - [select for diffs], Sat Sep 12 09:57:20 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.269: +1 -4 lines
Diff to previous 1.269 (colored)

vhif_ifp in struct carp_ifs is set but never used. it can be trimmed.

ok claudio@ mpi@

Revision 1.269 / (download) - annotate - [select for diffs], Sat Sep 12 09:36:31 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.268: +2 -4 lines
Diff to previous 1.268 (colored)

vhif_nvrs in carp_if is used to count the number of entries in
vhif_ifs so you can tell when that list is empty.

you can use TAILQ_EMPTY to see if a list is empty though, so kill
the count and use EMPTY instead.

ok mpi@

Revision 1.268 / (download) - annotate - [select for diffs], Fri Sep 11 08:17:06 2015 UTC (8 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.267: +2 -2 lines
Diff to previous 1.267 (colored)

Kill yet another argument to functions in IPv6. This time ip6_output's
ifpp - XXX: just for statistics
ifpp is always NULL in all callers so that statistic confirms ifpp is
dying
OK mpi@

Revision 1.267 / (download) - annotate - [select for diffs], Thu Sep 10 16:41:30 2015 UTC (8 years, 9 months ago) by mikeb
Branch: MAIN
Changes since 1.266: +5 -5 lines
Diff to previous 1.266 (colored)

pass a cookie argument to interface input handlers that can be used
to pass additional context or transient data with the similar life
time.

ok mpi, suggestions, hand holding and ok from dlg

Revision 1.266 / (download) - annotate - [select for diffs], Thu Sep 10 15:09:16 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.265: +51 -29 lines
Diff to previous 1.265 (colored)

if_put after if_get.

ok claudio@

Revision 1.265 / (download) - annotate - [select for diffs], Thu Sep 10 13:32:19 2015 UTC (8 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.264: +5 -22 lines
Diff to previous 1.264 (colored)

move the if input handler list to an SRP list.

instead of having every driver that manipulates the ifih list
understand SRPLs, this moves that processing into if_ih_insert and
if_ih_remove functions.

we rely on the kernel lock to serialise the modifications to the
list.

tested by mpi@
ok mpi@ claudio@ mikeb@

Revision 1.264 / (download) - annotate - [select for diffs], Thu Jul 2 09:40:03 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE
Branch point for: OPENBSD_5_8
Changes since 1.263: +4 -11 lines
Diff to previous 1.263 (colored)

By design if_input_process() needs to hold a reference on the receiving
ifp in order to access its ifih handlers.

So get rid of if_get() in the various ifih handlers we know the ifp is
live at this point.

ok dlg@

Revision 1.263 / (download) - annotate - [select for diffs], Tue Jun 30 13:54:42 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.262: +2 -2 lines
Diff to previous 1.262 (colored)

Rename if_output() into if_enqueue() to avoid confusion with comments
talking about (*ifp->if_output)().

ok claudio@, dlg@

Revision 1.262 / (download) - annotate - [select for diffs], Mon Jun 29 10:32:29 2015 UTC (8 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.261: +1 -3 lines
Diff to previous 1.261 (colored)

count if_ibytes in if_input like we do for if_ipackets.

tweaks and ok mpi@

Revision 1.261 / (download) - annotate - [select for diffs], Wed Jun 24 09:40:55 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.260: +1 -3 lines
Diff to previous 1.260 (colored)

Increment if_ipackets in if_input().

Note that pseudo-drivers not using if_input() are not affected by this
conversion.

ok mikeb@, kettenis@, claudio@, dlg@

Revision 1.260 / (download) - annotate - [select for diffs], Tue Jun 16 11:09:40 2015 UTC (8 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.259: +34 -8 lines
Diff to previous 1.259 (colored)

Store a unique ID, an interface index, rather than a pointer to the
receiving interface in the packet header of every mbuf.

The interface pointer should now be retrieved when necessary with
if_get().  If a NULL pointer is returned by if_get(), the interface
has probably been destroy/removed and the mbuf should be freed.

Such mechanism will simplify garbage collection of mbufs and limit
problems with dangling ifp pointers.

Tested by jmatthew@ and krw@, discussed with many.

ok mikeb@, bluhm@, dlg@

Revision 1.259 / (download) - annotate - [select for diffs], Mon Jun 8 13:40:48 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.258: +46 -24 lines
Diff to previous 1.258 (colored)

Move carp-related logic from ether_output() into carp_start().

ok sthen@, phessler@

Revision 1.258 / (download) - annotate - [select for diffs], Tue Jun 2 09:38:24 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.257: +78 -62 lines
Diff to previous 1.257 (colored)

Take carp(4) out of ether_input().

Tested by <mxb AT alumni DOT chalmers DOT se>, thanks!

ok bluhm@, dlg@

Revision 1.257 / (download) - annotate - [select for diffs], Thu May 21 09:17:53 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.256: +11 -8 lines
Diff to previous 1.256 (colored)

Correctly state the link state to INVALID when creating a carp interface.

Since vhe are allocated with M_ZERO and INIT is also defined to be 0,
carp_set_state() would result in a no-op because of the state check.

So explicitly initialize the state of a vhe to INIT and move the state
check in carp_set_state_all() to prevent similar issues in the future.

Problem and initial diff from Johan Ymerson, thanks!

ok henning@

Revision 1.256 / (download) - annotate - [select for diffs], Fri May 15 11:53:06 2015 UTC (9 years ago) by claudio
Branch: MAIN
Changes since 1.255: +2 -1 lines
Diff to previous 1.255 (colored)

Give carp(4) interfaces their own low priority. The change should not
change behaviour for now but will allow to share the same address with
the parent interface without major hacks.
OK mpi@

Revision 1.255 / (download) - annotate - [select for diffs], Fri May 15 10:09:23 2015 UTC (9 years ago) by mpi
Branch: MAIN
Changes since 1.254: +54 -58 lines
Diff to previous 1.254 (colored)

Remove a NULL check in carp_set_ifp() as we always pass a valid ifp
pointer to this function.

ok claudio@

Revision 1.254 / (download) - annotate - [select for diffs], Tue Apr 28 14:51:50 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.253: +2 -1 lines
Diff to previous 1.253 (colored)

Make sure to overwrite sdl_type after calling ether_ifattach().

Fix a problem found by Johan Huldtgren, ok phessler@

Revision 1.253 / (download) - annotate - [select for diffs], Wed Apr 22 06:44:17 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.252: +23 -14 lines
Diff to previous 1.252 (colored)

Add the necessary glue to keep carp(4) working while other pseudo-drivers
are converted to if_input(), this time without breaking parent-less setup.

ok sthen@, dlg@

Revision 1.252 / (download) - annotate - [select for diffs], Tue Apr 21 09:35:32 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.251: +9 -12 lines
Diff to previous 1.251 (colored)

Revert previous.  Packets going through carp_input() but not destinated
to the carp interface would end up enqueued without being decapsulated.

Found the hard way by shten@

Revision 1.251 / (download) - annotate - [select for diffs], Wed Apr 15 15:16:17 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.250: +12 -9 lines
Diff to previous 1.250 (colored)

Add the necessary glue to keep carp(4) working while other pseudo-drivers
are converted to if_input().

ok dlg@, claudio@

Revision 1.250 / (download) - annotate - [select for diffs], Wed Apr 15 15:14:37 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.249: +5 -23 lines
Diff to previous 1.249 (colored)

Use ether_ifattach() and ether_ifdetach() when cloning/destroying an
interface instead of rewritting most of them.

This change is also needed for upcoming if_input() conversion.

As a bonus pseudo-driver attached on top of carp are now detached in
the right order.

ok claudio@, henning@

Revision 1.249 / (download) - annotate - [select for diffs], Tue Apr 7 10:46:20 2015 UTC (9 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.248: +3 -3 lines
Diff to previous 1.248 (colored)

Do not pass an `ifp' argument to interface input handlers since it
might be overwritten by pseudo-drivers.

ok dlg@, henning@

Revision 1.248 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:51 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.247: +1 -2 lines
Diff to previous 1.247 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.247 / (download) - annotate - [select for diffs], Wed Mar 4 10:59:52 2015 UTC (9 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.246: +11 -10 lines
Diff to previous 1.246 (colored)

Explicitly fallback to a carp IP address if the parent does not have any
configured IP address when sending AD.

Previously ip_output() was doing this magic for us and ip6_output() was
failing, making it impossible to send AD if the parent did not have an
IPv6 address.

Fix a regression found the hardway by benno@ introduced by the move to
NOINET6 by default.

ok benno@, phessler@

Revision 1.246 / (download) - annotate - [select for diffs], Wed Feb 11 04:29:29 2015 UTC (9 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.245: +12 -2 lines
Diff to previous 1.245 (colored)

Until carp(4) is converted to call ether_ifattach() and ether_ifdetach(),
reroll the loop to free its Ethernet multicast addresses when destroying
an interface.

Prevent a panic found the hard way by phessler@

ok henning@, pelikan@, phessler@

Revision 1.245 / (download) - annotate - [select for diffs], Wed Jan 21 11:20:48 2015 UTC (9 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.244: +11 -101 lines
Diff to previous 1.244 (colored)

Remove the code to automagically find a "carpdev".

The half-backed logic to find a parent interface before configuring an
address on a carp(4) interface is responsible for too many layers of
complexity resulting in various breakages everytime something change in
the stack.

So make carp(4) a bit less special.  It now requires a parent interface
like all the other pseudo-devices.

ok mikeb@, dlg@, florian@, henning@

Revision 1.244 / (download) - annotate - [select for diffs], Thu Jan 8 10:55:45 2015 UTC (9 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.243: +3 -2 lines
Diff to previous 1.243 (colored)

Do not unconditionally set a link-local address.

carp(4) has a hack to update its Ethernet address which was also
generating the corresponding IPv6 link-local address.  Since the
removal of the NOINET6 flag, this link-local address was generated
even if no IPv6 address has been configured on the interface.

This unbreak carp setup without v6 addresses, found the hard way by
sebastia@.

ok sebastia@, benno@, stsp@, @phessler

Revision 1.243 / (download) - annotate - [select for diffs], Fri Dec 19 17:14:40 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.242: +1 -11 lines
Diff to previous 1.242 (colored)

unifdef INET in net code as a precursor to removing the pretend option.
long live the one true internet.
ok henning mikeb

Revision 1.242 / (download) - annotate - [select for diffs], Wed Dec 17 09:57:13 2014 UTC (9 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.241: +4 -4 lines
Diff to previous 1.241 (colored)

Remove the "multicast_" prefix from the fields a multicast-only struct.

Prodded by claudio@ and mikeb@

Revision 1.241 / (download) - annotate - [select for diffs], Wed Dec 17 09:45:59 2014 UTC (9 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.240: +5 -5 lines
Diff to previous 1.240 (colored)

Use an interface index instead of a pointer for multicast options.

Output interface (port) selection for multicast traffic is not done via
route lookups.  Instead the output ifp is registred when setsockopt(2)
is called with the IP{V6,}_MULTICAST_IF option.  But since there is no
mechanism to invalidate such pointer stored in a pcb when an interface
is destroyed/removed, it might lead your kernel to fault.

Prevent a fault upon resume reported by frantisek holop, thanks!

ok mikeb@, claudio@

Revision 1.240 / (download) - annotate - [select for diffs], Fri Dec 5 15:50:04 2014 UTC (9 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.239: +2 -1 lines
Diff to previous 1.239 (colored)

Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.

ok mikeb@, krw@, bluhm@, tedu@

Revision 1.239 / (download) - annotate - [select for diffs], Thu Nov 20 15:55:04 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.238: +10 -10 lines
Diff to previous 1.238 (colored)

sizes for simple free cases. sizeof(*) and one case where len is clear.

Revision 1.238 / (download) - annotate - [select for diffs], Tue Nov 18 02:37:31 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.237: +1 -4 lines
Diff to previous 1.237 (colored)

move arc4random prototype to systm.h. more appropriate for most code
to include that than rdnvar.h. ok deraadt dlg

Revision 1.237 / (download) - annotate - [select for diffs], Mon Nov 3 11:43:47 2014 UTC (9 years, 7 months ago) by gerhard
Branch: MAIN
Changes since 1.236: +12 -3 lines
Diff to previous 1.236 (colored)

Fix kernel stack overflow by preventing carp_send_ad_all() from re-entrant
calls. Also, when adjusting demote counts, don't call carp_send_ad_all()
for every ifgroup with a demote count of 1 but rather call it only once
after adjusting the demote counts of all ifgroups.

ok bluhm@ mpf@

Revision 1.236 / (download) - annotate - [select for diffs], Tue Oct 7 08:47:28 2014 UTC (9 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.235: +4 -2 lines
Diff to previous 1.235 (colored)

Do not protect the SIOCSIFADDR call by splnet().  Drivers already
raise it inside their ioctl handler (except for carp(4), what else?).

In general, global structures manipulated in the softnet codepath only
require a splsoftnet() protection when they are modified in process
(ioctl) context.

Also put some IPL_SOFNET asserts in functions accessing global structures.

Previous version diff ok mikeb@, with inputs from and ok bluhm@

Revision 1.235 / (download) - annotate - [select for diffs], Sun Sep 28 14:26:42 2014 UTC (9 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.234: +2 -3 lines
Diff to previous 1.234 (colored)

Remove a limitation that ignored IPv6 link-local addresses on carp(4).
This workaround was needed when the interface link-local address was
still enabled by default to prevent immediate state transition on
interfaces without any configured addresses.  This is not needed
anymore and removing the limitation allows to use carp(4) with
addresses like fe80::2%carp0.

discussed with some
ok mpi@ pelikan@

Revision 1.234 / (download) - annotate - [select for diffs], Mon Sep 8 06:24:13 2014 UTC (9 years, 9 months ago) by jsg
Branch: MAIN
Changes since 1.233: +1 -2 lines
Diff to previous 1.233 (colored)

remove uneeded route.h includes
ok miod@ mpi@

Revision 1.233 / (download) - annotate - [select for diffs], Tue Jul 22 11:06:10 2014 UTC (9 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.232: +1 -2 lines
Diff to previous 1.232 (colored)

Fewer <netinet/in_systm.h> !

Revision 1.232 / (download) - annotate - [select for diffs], Sat Jul 12 18:44:23 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.231: +10 -10 lines
Diff to previous 1.231 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.231 / (download) - annotate - [select for diffs], Wed Jul 9 09:30:49 2014 UTC (9 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.230: +2 -2 lines
Diff to previous 1.230 (colored)

bpf code surgery / shuffling / simplification.
the various bpf_mtap_* are very similiar, they differ in what (and to some
extent how) they prepend something, and what copy function they pass to
bpf_catchpacket.
use an internal _bpf_mtap as "backend" for bpf_mtap and friends.
extend bpf_mtap_hdr so that it covers all common cases:
if dlen is 0, nothing gets prepended.
copy function can be given, if NULL the default bpf_mcopy is used.
adjust the existing bpf_mtap_hdr users to pass a NULL ptr for the copy fn.
re-implement bpf_mtap_af as simple wrapper for bpf_mtap_hdr.
re-implement bpf_mtap_ether using bpf_map_hdr
re-implement bpf_mtap_pflog as trivial bpf_mtap_hdr wrapper
ok bluhm benno

Revision 1.230 / (download) - annotate - [select for diffs], Mon Jun 30 07:02:22 2014 UTC (9 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.229: +1 -19 lines
Diff to previous 1.229 (colored)

Kill dead code, what does a negative number of addresses on a carp(4)
mean?

ok deraadt@

Revision 1.229 / (download) - annotate - [select for diffs], Wed Apr 30 10:04:33 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.228: +1 -129 lines
Diff to previous 1.228 (colored)

Remove carp_seroute() it no longer does anything useful but mess with
your IPv4 routes.

mcbride@ says that this function has been introduced in order to be able
to reach the MASTER node from a BACKUP node using the CARP address. The
reasons are:

1) For troubleshooting, so I can ping or otherwise monitor the MASTER
host.

2) In some cases it's undesirable (or even not possible) to run
services on other IP addresses. For example, services that only allow
you to configure 1 listening IP, or services where you wish to avoid
users connecting to anything but the MASTER server.

Sadly this function becames a horrible hack.  So if somebody thinks the
reasons explained before justify such logic, feel free to submit a
correct diff.

ok bluhm@, henning@, mikeb@

Revision 1.228 / (download) - annotate - [select for diffs], Mon Apr 21 12:22:26 2014 UTC (10 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.227: +2 -2 lines
Diff to previous 1.227 (colored)

ip_output() using varargs always struck me as bizarre, esp since it's only
ever used to pass on uint32 (for ipsec). stop that madness and just pass
the uint32, 0 in all cases but the two that pass the ipsec flowinfo.
ok deraadt reyk guenther

Revision 1.227 / (download) - annotate - [select for diffs], Sun Apr 20 14:54:39 2014 UTC (10 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.226: +5 -6 lines
Diff to previous 1.226 (colored)

ether_output: instead of assembling the ethernet header and then calling
carp_rewrite_lladdr to overwrite the src lladdr, get the intended src
lladdr before assembling the ethernet header.
carp_rewrite_lladdr -> carp_get_srclladdr
ok reyk claudio

Revision 1.226 / (download) - annotate - [select for diffs], Mon Apr 14 09:06:42 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.225: +3 -3 lines
Diff to previous 1.225 (colored)

"struct pkthdr" holds a routing table ID, not a routing domain one.
Avoid the confusion by using an appropriate name for the variable.

Note that since routing domain IDs are a subset of the set of routing
table IDs, the following idiom is correct:

	rtableid = rdomain

But to get the routing domain ID corresponding to a given routing table
ID, you must call rtable_l2(9).

claudio@ likes it, ok mikeb@

Revision 1.225 / (download) - annotate - [select for diffs], Thu Mar 27 10:39:23 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.224: +1 -4 lines
Diff to previous 1.224 (colored)

Stop mixing interface address flags with routing entry ones.

Instead of always copying ifa_flags to the routing entry flags when
creating a route by calling rtinit(), explicitly pass the RTF_CLONING
flag when required.  This means ifa_flags are now *only* used to check
if an address has an associated route that was created by the kernel
auto-magically.

ok benno@

Revision 1.224 / (download) - annotate - [select for diffs], Fri Mar 21 13:48:28 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.223: +53 -41 lines
Diff to previous 1.223 (colored)

Global lists of addresses are species near extinction, even carp do
not like them!

Since carp(4) interfaces do some magic tricks to find a compatible
interface if you do not specify a `carpdev' argument, make them
iterate over &ifnet instead of &in{,6}_ifaddr.

ok benno@, mikeb@, florian@

Revision 1.223 / (download) - annotate - [select for diffs], Tue Mar 18 10:47:34 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.222: +3 -3 lines
Diff to previous 1.222 (colored)

Rename rt_gettable() into rtable_get(), swap its arguments to be
coherent with the existing rtable_* functions and document it.

While here fix some other manpage glitches pointed out by jmc@.

Revision 1.222 / (download) - annotate - [select for diffs], Thu Feb 13 10:31:42 2014 UTC (10 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.221: +3 -14 lines
Diff to previous 1.221 (colored)

When sending a neighbor advertisement, correctly use the carp mac
address and not the mac of the physical interface as target lladdr.

This allows us to get rid of the hack adding and removing the route to
loopback of a carp node when its status switch to master and backup
respectively.  Now the route entry will no longer be updated to use the
mac address of the physical interface of the master node as gateway.

While here send the ARP request through the carp interface for consistency.

Analysed with and ok mikeb@, ok bluhm@

Revision 1.221 / (download) - annotate - [select for diffs], Fri Feb 7 22:22:37 2014 UTC (10 years, 4 months ago) by stsp
Branch: MAIN
Changes since 1.220: +3 -2 lines
Diff to previous 1.220 (colored)

Make carp send IPv6 neighbour advertisements with the 'router' flag
if we're acting as router. Otherwise clients lose the default route
learned from router advertisements during carp failover.
Patch by Ole Myhre; ok bluhm@

Revision 1.220 / (download) - annotate - [select for diffs], Wed Jan 22 09:35:20 2014 UTC (10 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.219: +5 -7 lines
Diff to previous 1.219 (colored)

Pass the receiving interface pointer to carp_input() instead of re-
reading it from the packet header.  While here makes carp_input()
take the same arguments as ether_input().

ok bluhm@, mikeb@

Revision 1.219 / (download) - annotate - [select for diffs], Mon Jan 13 23:03:52 2014 UTC (10 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.218: +13 -13 lines
Diff to previous 1.218 (colored)

Call all local valiables of type struct in6_ifaddr "ia6".  This is
consistent with struct ifaddr "ifa" and struct in_ifaddr "ia".
OK mpi@

Revision 1.218 / (download) - annotate - [select for diffs], Thu Jan 9 06:29:06 2014 UTC (10 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.217: +30 -29 lines
Diff to previous 1.217 (colored)

bzero/bcmp -> memset/memcmp. ok matthew

Revision 1.217 / (download) - annotate - [select for diffs], Thu Nov 28 09:36:37 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.216: +15 -13 lines
Diff to previous 1.216 (colored)

Use the local variable referencing the receiving interface instead of
dereferencing the mbuf various times. No functional change.

ok mpf@, bluhm@

Revision 1.216 / (download) - annotate - [select for diffs], Thu Nov 21 16:16:08 2013 UTC (10 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.215: +1 -2 lines
Diff to previous 1.215 (colored)

Remove unneeded include.

ok deraadt@

Revision 1.215 / (download) - annotate - [select for diffs], Mon Oct 28 12:33:32 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.214: +1 -5 lines
Diff to previous 1.214 (colored)

tedu FDDI support and the 3 flavors the driver for DEC devices, even
miod@ cannot find two boards using the same media.

With precious punctuation review from guenther@, thanks!

ok deraadt@, henning@

Revision 1.214 / (download) - annotate - [select for diffs], Sun Oct 20 11:03:01 2013 UTC (10 years, 7 months ago) by phessler
Branch: MAIN
Changes since 1.213: +3 -2 lines
Diff to previous 1.213 (colored)

Put a large chunk of the IPv6 rdomain support in-tree.

Still some important missing pieces, and this is not yet enabled.

OK bluhm@

Revision 1.213 / (download) - annotate - [select for diffs], Sat Oct 19 16:09:53 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.212: +7 -15 lines
Diff to previous 1.212 (colored)

Now carp_set_addr() and carp_set_addr6() break out of the loop after
they have found the interface address, so we can get rid of the
additional variable ia_if.  No functional change.
OK mpi@ phessler@

Revision 1.212 / (download) - annotate - [select for diffs], Sat Oct 19 09:23:59 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.211: +3 -3 lines
Diff to previous 1.211 (colored)

In carp_set_addr6() break out of the loop after the interface address
has been found.  This makes the IPv6 code work like IPv4.
OK mpi@

Revision 1.211 / (download) - annotate - [select for diffs], Thu Oct 17 16:27:43 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.210: +2 -1 lines
Diff to previous 1.210 (colored)

The header file netinet/in_var.h included netinet6/in6_var.h.  This
created a bunch of useless dependencies.  Remove this implicit
inclusion and do an explicit #include <netinet6/in6_var.h> when it
is needed.
OK mpi@ henning@

Revision 1.210 / (download) - annotate - [select for diffs], Mon Aug 12 06:24:28 2013 UTC (10 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.209: +3 -1 lines
Diff to previous 1.209 (colored)

In the common IPv4 and IPv6 file ip_carp.c an #ifdef INET6 was
missing.  Especially the IN6_IS_ADDR_LINKLOCAL() macro should not
be necessary in IPv4 only code.  No binary change.
OK henning@ claudio@

Revision 1.209 / (download) - annotate - [select for diffs], Thu Jun 20 12:03:40 2013 UTC (10 years, 11 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.208: +5 -5 lines
Diff to previous 1.208 (colored)

Revert previous and unbreak asr, the new include should be protected.

Reported by naddy@

Revision 1.208 / (download) - annotate - [select for diffs], Thu Jun 20 09:38:24 2013 UTC (10 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.207: +5 -5 lines
Diff to previous 1.207 (colored)

Allocate the various hook head descriptors as part of the ifnet
structure rather than doing various M_WAITOK allocations during
the *attach() functions, we always rely on them anyway.

ok mikeb@, uebayasi@

Revision 1.207 / (download) - annotate - [select for diffs], Tue Jun 18 09:23:33 2013 UTC (10 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.206: +5 -8 lines
Diff to previous 1.206 (colored)

Use TAILQ_FOREACH() instead of handrolling our own version and stop
iterating once we found a matching address.

ok mpf@, yasuoka@, henning@

Revision 1.206 / (download) - annotate - [select for diffs], Mon Jun 3 17:19:40 2013 UTC (11 years ago) by yasuoka
Branch: MAIN
Changes since 1.205: +2 -2 lines
Diff to previous 1.205 (colored)

fix typo in comment

Revision 1.205 / (download) - annotate - [select for diffs], Sun Jun 2 15:03:32 2013 UTC (11 years ago) by yasuoka
Branch: MAIN
Changes since 1.204: +10 -3 lines
Diff to previous 1.204 (colored)

Exclude the mac address for the HMAC calculation if lladdr is the real
one so that we can use the real MAC address for carp(4) like an example
following.

  ifconfig carp0 carpdev REALIF lladdr <real interface's lladdr>

ok reyk mcbride

Revision 1.204 / (download) - annotate - [select for diffs], Thu Mar 28 23:10:05 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.203: +2 -1 lines
Diff to previous 1.203 (colored)

code that calls timeout functions should include timeout.h
slipped by on i386, but the zaurus doesn't automagically pick it up.
spotted by patrick

Revision 1.203 / (download) - annotate - [select for diffs], Thu Mar 28 16:55:27 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.202: +1 -3 lines
Diff to previous 1.202 (colored)

do not include machine/cpu.h from a .c file; it is the responsibility of
.h files to pull it in, if needed
ok tedu

Revision 1.202 / (download) - annotate - [select for diffs], Thu Mar 28 16:45:16 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.201: +1 -2 lines
Diff to previous 1.201 (colored)

no need for a lot of code to include proc.h

Revision 1.201 / (download) - annotate - [select for diffs], Tue Mar 26 13:19:26 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.200: +2 -2 lines
Diff to previous 1.200 (colored)

Remove various read-only *maxlen variables and use IFQ_MAXLEN directly.

ok beck@, mikeb@

Revision 1.200 / (download) - annotate - [select for diffs], Mon Mar 25 14:40:56 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.199: +2 -2 lines
Diff to previous 1.199 (colored)

Substitute the handcrafted list of IPv6 addresses by a proper TAILQ.

ok bluhm@, mikeb@

Revision 1.199 / (download) - annotate - [select for diffs], Fri Mar 22 01:41:12 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.198: +2 -3 lines
Diff to previous 1.198 (colored)

simple replacement of LIST_END with NULL. ok mpi

Revision 1.198 / (download) - annotate - [select for diffs], Mon Oct 8 18:48:25 2012 UTC (11 years, 8 months ago) by camield
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.197: +3 -9 lines
Diff to previous 1.197 (colored)

Make carp_ourether() shorter and more generic.  Only a mac address
is really needed, instead of an ethernet header and selector.

ok mikeb henning mpf

Revision 1.197 / (download) - annotate - [select for diffs], Wed Sep 19 16:14:01 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.196: +2 -2 lines
Diff to previous 1.196 (colored)

Make rt_lookup return a pointer to an rtentry struct instead of
to a radix_node struct.

The radix tree pushdown continues.

ok claudio@

Revision 1.196 / (download) - annotate - [select for diffs], Wed Sep 19 15:31:23 2012 UTC (11 years, 8 months ago) by henning
Branch: MAIN
Changes since 1.195: +2 -0 lines
Diff to previous 1.195 (colored)

inherit IFCAP_CSUM_* from the parent interface
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

Revision 1.195 / (download) - annotate - [select for diffs], Wed Apr 11 17:42:53 2012 UTC (12 years, 2 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.194: +3 -3 lines
Diff to previous 1.194 (colored)

fix all the suser calls which pass an incorrect p_acflag argument;
figured out by and ok guenther

Revision 1.194 / (download) - annotate - [select for diffs], Sat Nov 19 13:54:53 2011 UTC (12 years, 6 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.193: +3 -2 lines
Diff to previous 1.193 (colored)

Select a routing table according to the rdomain.  Allows one
to connect to the carp address when the carpdev interface has
an ip address too in the non-default rdomain.

ok claudio

Revision 1.193 / (download) - annotate - [select for diffs], Sun Oct 30 20:38:55 2011 UTC (12 years, 7 months ago) by mpf
Branch: MAIN
Changes since 1.192: +3 -1 lines
Diff to previous 1.192 (colored)

In the advbase 0 case, we have to use three times
the advskew as the master down timeout.
OK henning.

Revision 1.192 / (download) - annotate - [select for diffs], Mon Oct 24 17:48:31 2011 UTC (12 years, 7 months ago) by camield
Branch: MAIN
Changes since 1.191: +2 -2 lines
Diff to previous 1.191 (colored)

Lower carp demote count on interface detach, fixes a bug introduced by rev 1.175.

ok henning mpf

Revision 1.191 / (download) - annotate - [select for diffs], Sun Oct 16 21:07:19 2011 UTC (12 years, 7 months ago) by mpf
Branch: MAIN
Changes since 1.190: +3 -4 lines
Diff to previous 1.190 (colored)

Use m_pullup() instead of IP6_EXTHDR_GET() to get the carp header
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@

Revision 1.190 / (download) - annotate - [select for diffs], Tue Sep 6 16:00:22 2011 UTC (12 years, 9 months ago) by mpf
Branch: MAIN
Changes since 1.189: +2 -2 lines
Diff to previous 1.189 (colored)

Properly initialize struct carp_if (especially vhif_nvrs) with M_ZERO.
This lets carp delete IFF_PROMISC on its carpdev upon destroy.
Fix from Stefan Rinkes.
OK sthen, bluhm, deraadt.

Revision 1.189 / (download) - annotate - [select for diffs], Fri Jul 8 19:07:18 2011 UTC (12 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.188: +4 -1 lines
Diff to previous 1.188 (colored)

mark carp advertisements to be queued at priority 6. losing them is bad,
mkay? ok ryan

Revision 1.188 / (download) - annotate - [select for diffs], Mon Jul 4 03:13:53 2011 UTC (12 years, 11 months ago) by mpf
Branch: MAIN
Changes since 1.187: +3 -1 lines
Diff to previous 1.187 (colored)

Don't make copy multicast packets for carp interfaces
that are not up. OK henning.

Revision 1.187 / (download) - annotate - [select for diffs], Mon Jul 4 00:37:00 2011 UTC (12 years, 11 months ago) by mpf
Branch: MAIN
Changes since 1.186: +15 -6 lines
Diff to previous 1.186 (colored)

Allow advbase to be set to zero, which makes it possible to run
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.

Revision 1.186 / (download) - annotate - [select for diffs], Sun Jul 3 17:55:25 2011 UTC (12 years, 11 months ago) by dhill
Branch: MAIN
Changes since 1.185: +4 -4 lines
Diff to previous 1.185 (colored)

avoid void * pointer arithmetic

OK claudio@

Revision 1.185 / (download) - annotate - [select for diffs], Sun Jul 3 17:37:48 2011 UTC (12 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.184: +3 -2 lines
Diff to previous 1.184 (colored)

Do not use LINK_STATE_UNKNOWN for the INIT state. LINK_STATE_UNKNOWN has
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@

Revision 1.184 / (download) - annotate - [select for diffs], Wed May 4 16:05:49 2011 UTC (13 years, 1 month ago) by blambert
Branch: MAIN
Changes since 1.183: +2 -2 lines
Diff to previous 1.183 (colored)

Collapse m_pullup and m_pullup2 into a single function, as they're
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@

Revision 1.183 / (download) - annotate - [select for diffs], Fri Apr 29 12:36:31 2011 UTC (13 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.182: +10 -11 lines
Diff to previous 1.182 (colored)

The previous reconfiguration change broke IPv6 only setups.
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@

Revision 1.182 / (download) - annotate - [select for diffs], Mon Apr 4 14:25:16 2011 UTC (13 years, 2 months ago) by mikeb
Branch: MAIN
Changes since 1.181: +7 -1 lines
Diff to previous 1.181 (colored)

install an additional bpf hook in the carp_input so that multicast
and broadcast packets will be caught too; also we need to increment
the incoming packet counter as reminded by claudio.  ok claudio mpf

Revision 1.181 / (download) - annotate - [select for diffs], Tue Mar 8 22:53:28 2011 UTC (13 years, 3 months ago) by mpf
Branch: MAIN
Changes since 1.180: +6 -8 lines
Diff to previous 1.180 (colored)

Fix a subtle carp reconfiguration problem.
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@

Revision 1.180 / (download) - annotate - [select for diffs], Tue Dec 21 14:59:14 2010 UTC (13 years, 5 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.179: +3 -1 lines
Diff to previous 1.179 (colored)

Doh! Forgot to set the rdomain when sending out carp announcements.
With and OK phessler@

Revision 1.179 / (download) - annotate - [select for diffs], Fri Nov 26 12:25:52 2010 UTC (13 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (colored)

more useful logging level for demotion adjustments
ok mcbide@ claudio@ henning@

Revision 1.178 / (download) - annotate - [select for diffs], Thu Aug 26 13:28:15 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.177: +3 -3 lines
Diff to previous 1.177 (colored)

Link local multicast requires a scope (either from the src or dst address)
be more explicit and force it in dst.
OK deraadt@, mcbride@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Aug 2 10:30:00 2010 UTC (13 years, 10 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.176: +7 -5 lines
Diff to previous 1.176 (colored)

Prevent illegal struct casting by moving AF_INET/AF_INET6 address
family checks before calling ifatoia/ifatoia6.

ok deraadt@, dlg@, mcbride@

Revision 1.176 / (download) - annotate - [select for diffs], Tue Jul 20 15:36:03 2010 UTC (13 years, 10 months ago) by matthew
Branch: MAIN
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (colored)

Switch some obvious network stack MAC comparisons from bcmp() to
timingsafe_bcmp().

ok deraadt@; committed over WPA.

Revision 1.175 / (download) - annotate - [select for diffs], Sun Apr 25 17:38:53 2010 UTC (14 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.174: +42 -23 lines
Diff to previous 1.174 (colored)

Properly adjust group demotion counters when groups are added or
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.

Revision 1.174 / (download) - annotate - [select for diffs], Wed Jan 13 01:26:28 2010 UTC (14 years, 5 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.173: +3 -3 lines
Diff to previous 1.173 (colored)

let's admit it's not 1992 any more. CIDR is around for a long time, even
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

Revision 1.173 / (download) - annotate - [select for diffs], Tue Jan 12 01:40:30 2010 UTC (14 years, 5 months ago) by mpf
Branch: MAIN
Changes since 1.172: +3 -9 lines
Diff to previous 1.172 (colored)

Remove the "bump the advskew to 240 in case of errors" hack.
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@

Revision 1.172 / (download) - annotate - [select for diffs], Tue Jan 12 01:02:02 2010 UTC (14 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.171: +2 -3 lines
Diff to previous 1.171 (colored)

Use M_ZERO in malloc instead of doing a bzeor right afterwards.
From Gleydson Soares, OK beck@

Revision 1.171 / (download) - annotate - [select for diffs], Wed Jun 17 20:17:19 2009 UTC (14 years, 11 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.170: +14 -9 lines
Diff to previous 1.170 (colored)

Correctly handle the carp demote counter in all input cases.
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@

Revision 1.170 / (download) - annotate - [select for diffs], Fri Jun 5 00:05:22 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.169: +18 -11 lines
Diff to previous 1.169 (colored)

Initial support for routing domains. This allows to bind interfaces to
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@

Revision 1.169 / (download) - annotate - [select for diffs], Tue Oct 28 23:07:12 2008 UTC (15 years, 7 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.168: +4 -4 lines
Diff to previous 1.168 (colored)

Do not keep retrying to send advertisements if there is
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@

Revision 1.168 / (download) - annotate - [select for diffs], Wed Sep 3 08:37:51 2008 UTC (15 years, 9 months ago) by mpf
Branch: MAIN
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

Prevent a possible overflow when the sum of all demotion counters
gets bigger than 255. OK henning@

Revision 1.167 / (download) - annotate - [select for diffs], Sat Jun 14 21:46:22 2008 UTC (16 years ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.166: +55 -25 lines
Diff to previous 1.166 (colored)

add carppeer; an option to specify a different multicast address or
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@

Revision 1.166 / (download) - annotate - [select for diffs], Fri Jun 13 23:29:31 2008 UTC (16 years ago) by mpf
Branch: MAIN
Changes since 1.165: +8 -3 lines
Diff to previous 1.165 (colored)

Do not log carp state transitions from or to INIT by default.
Reduces the amount of dmesg noise.
Tested and OK mcbride@

Revision 1.165 / (download) - annotate - [select for diffs], Mon Jun 9 07:07:16 2008 UTC (16 years ago) by djm
Branch: MAIN
Changes since 1.164: +2 -2 lines
Diff to previous 1.164 (colored)

rename arc4random_bytes => arc4random_buf to match libc's nicer name;
ok deraadt@

Revision 1.164 / (download) - annotate - [select for diffs], Wed May 7 05:14:21 2008 UTC (16 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.163: +7 -6 lines
Diff to previous 1.163 (colored)

Implement routing priorities. Every route inserted has a priority assigned
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

Revision 1.163 / (download) - annotate - [select for diffs], Tue May 6 15:12:00 2008 UTC (16 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.162: +42 -27 lines
Diff to previous 1.162 (colored)

Use the standard syslog levels on CARP logging messages instead of
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

Revision 1.162 / (download) - annotate - [select for diffs], Wed Feb 20 22:11:53 2008 UTC (16 years, 3 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.161: +2 -1 lines
Diff to previous 1.161 (colored)

Add my copyright.
OK mcbride@, mickey@

Revision 1.161 / (download) - annotate - [select for diffs], Tue Feb 5 22:57:30 2008 UTC (16 years, 4 months ago) by mpf
Branch: MAIN
Changes since 1.160: +158 -220 lines
Diff to previous 1.160 (colored)

Move carp load balancing (ARP/IP) to a simpler configuration scheme.
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@.

Revision 1.160 / (download) - annotate - [select for diffs], Wed Jan 2 03:33:18 2008 UTC (16 years, 5 months ago) by brad
Branch: MAIN
Changes since 1.159: +2 -2 lines
Diff to previous 1.159 (colored)

return with ENOTTY instead of EINVAL for unknown ioctl requests.

ok claudio@ krw@ dlg@

Revision 1.159 / (download) - annotate - [select for diffs], Fri Dec 14 18:33:40 2007 UTC (16 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.158: +13 -5 lines
Diff to previous 1.158 (colored)

add sysctl entry points into various network layers, in particular to
provide netstat(1) with data it needs;  ok claudio reyk

Revision 1.158 / (download) - annotate - [select for diffs], Tue Nov 27 11:34:18 2007 UTC (16 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.157: +8 -3 lines
Diff to previous 1.157 (colored)

Make carp(4) behave more like a ethernet interface by initalizing the
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@

Revision 1.157 / (download) - annotate - [select for diffs], Mon Nov 26 17:26:25 2007 UTC (16 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.156: +2 -4 lines
Diff to previous 1.156 (colored)

MALLOC -> malloc and M_ZERO change

ok mpf@ henning@

Revision 1.156 / (download) - annotate - [select for diffs], Thu Nov 22 02:04:14 2007 UTC (16 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.155: +5 -5 lines
Diff to previous 1.155 (colored)

pass the carp ifp to rt_missmsg() when generating the RTM_ADD messages
so the resulting messages have ifindex set and the routing daemons can
correctly indentify that route as connected. ok mcbride

Revision 1.155 / (download) - annotate - [select for diffs], Thu Nov 22 01:21:40 2007 UTC (16 years, 6 months ago) by mpf
Branch: MAIN
Changes since 1.154: +482 -235 lines
Diff to previous 1.154 (colored)

Factor out the virtual host portion of carp into a separate struct
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@

Revision 1.154 / (download) - annotate - [select for diffs], Fri Nov 16 05:08:39 2007 UTC (16 years, 6 months ago) by djm
Branch: MAIN
Changes since 1.153: +3 -4 lines
Diff to previous 1.153 (colored)

use arc4random_bytes() instead of multiple arc4random() calls;
ok deraadt@ dlg@ henric@ mcbride@

Revision 1.153 / (download) - annotate - [select for diffs], Mon Oct 29 16:19:23 2007 UTC (16 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.152: +10 -12 lines
Diff to previous 1.152 (colored)

MALLOC/FREE -> malloc/free

ok krw@

Revision 1.152 / (download) - annotate - [select for diffs], Sat Oct 27 23:08:35 2007 UTC (16 years, 7 months ago) by mpf
Branch: MAIN
Changes since 1.151: +21 -66 lines
Diff to previous 1.151 (colored)

Replace the replay protection counter with a cookie.
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@

Revision 1.151 / (download) - annotate - [select for diffs], Mon Sep 24 11:17:20 2007 UTC (16 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.150: +10 -7 lines
Diff to previous 1.150 (colored)

Fix carp(4) after the switch to dynamic imo_membership allocation.
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)

Revision 1.150 / (download) - annotate - [select for diffs], Tue Sep 18 18:56:02 2007 UTC (16 years, 8 months ago) by markus
Branch: MAIN
Changes since 1.149: +10 -3 lines
Diff to previous 1.149 (colored)

allow 4095 instead of 20 multicast group memberships per socket (you need
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

Revision 1.149 / (download) - annotate - [select for diffs], Tue Sep 18 09:18:04 2007 UTC (16 years, 8 months ago) by mpf
Branch: MAIN
Changes since 1.148: +5 -5 lines
Diff to previous 1.148 (colored)

ARP balancing has been changed to use the source MAC address
quite a while ago.  Manpage and comment update by Matthew Dempsky.
OK jmc@

Revision 1.148 / (download) - annotate - [select for diffs], Mon Sep 3 06:10:54 2007 UTC (16 years, 9 months ago) by joel
Branch: MAIN
Changes since 1.147: +2 -1 lines
Diff to previous 1.147 (colored)

Make use of the carp preempt counter to signal number of transitions of
any carp group to master status.


ok dhartmei@

Revision 1.147 / (download) - annotate - [select for diffs], Sat Jun 23 16:15:26 2007 UTC (16 years, 11 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.146: +2 -2 lines
Diff to previous 1.146 (colored)

use a masked destination network instead of the interface ip for the
destination of the route belonging to the carp interface.

ok mpf@ claudio@

Revision 1.146 / (download) - annotate - [select for diffs], Thu Jun 14 19:31:17 2007 UTC (17 years ago) by reyk
Branch: MAIN
Changes since 1.145: +16 -1 lines
Diff to previous 1.145 (colored)

preserve the possible route label if the route belongs to the carp
interface (ip-less parent).

tested by claudio and me
ok claudio@

Revision 1.145 / (download) - annotate - [select for diffs], Wed Jun 13 04:55:49 2007 UTC (17 years ago) by claudio
Branch: MAIN
Changes since 1.144: +1 -3 lines
Diff to previous 1.144 (colored)

There is no need to set RTAX_NETMASK on RTF_HOST routes. RTAX_NETMASK will
be set to NULL as first in rtrequest1() for all host routes.
With and OK reyk@

Revision 1.144 / (download) - annotate - [select for diffs], Fri Jun 1 02:42:59 2007 UTC (17 years ago) by mpf
Branch: MAIN
Changes since 1.143: +3 -3 lines
Diff to previous 1.143 (colored)

sc_carplladdr does not need to be dereferenced.
OK mcbride@

Revision 1.143 / (download) - annotate - [select for diffs], Fri Jun 1 00:52:38 2007 UTC (17 years ago) by henning
Branch: MAIN
Changes since 1.142: +2 -2 lines
Diff to previous 1.142 (colored)

apply the "skip ipsec if there are no flows" speedup diff to IPv6 too.
we need a pointer to the inpcb to decide, which was not previously
passed to ip6_output, so this diff is a little bigger.
from itojun, ok ryan

Revision 1.142 / (download) - annotate - [select for diffs], Fri Jun 1 00:07:13 2007 UTC (17 years ago) by mpf
Branch: MAIN
Changes since 1.141: +10 -19 lines
Diff to previous 1.141 (colored)

Remove code to create a carp(4) Token Ring lladdr.
OK mcbride@

Revision 1.141 / (download) - annotate - [select for diffs], Tue May 29 18:21:19 2007 UTC (17 years ago) by claudio
Branch: MAIN
Changes since 1.140: +1 -4 lines
Diff to previous 1.140 (colored)

Move tokenring support to the attic where it can join the cards that where
decomissioned aeon ago. We will not miss it at all.
OK dlg@ henning@ and a lot of cheers by other in the room

Revision 1.140 / (download) - annotate - [select for diffs], Mon May 28 06:31:01 2007 UTC (17 years ago) by mcbride
Branch: MAIN
Changes since 1.139: +4 -1 lines
Diff to previous 1.139 (colored)

Users of arc4random() should include dev/rndvar.h directly.

ok dlg claudio

Revision 1.139 / (download) - annotate - [select for diffs], Sun May 27 20:11:44 2007 UTC (17 years ago) by dlg
Branch: MAIN
Changes since 1.138: +2 -6 lines
Diff to previous 1.138 (colored)

rewrite a static inline func that simply coerces a return type of another
function as a macro.

ok reyk@ ja ja claudio@

Revision 1.138 / (download) - annotate - [select for diffs], Sat May 26 17:13:31 2007 UTC (17 years ago) by jason
Branch: MAIN
Changes since 1.137: +1 -2 lines
Diff to previous 1.137 (colored)

one extern seems to be better than 20 for ifqmaxlen; ok krw

Revision 1.137 / (download) - annotate - [select for diffs], Sun May 6 12:20:04 2007 UTC (17 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.136: +1 -3 lines
Diff to previous 1.136 (colored)

do not fill RTAX_GATEWAY for RTM_DELETE, ok claudio

Revision 1.136 / (download) - annotate - [select for diffs], Fri May 4 12:39:39 2007 UTC (17 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.135: +39 -17 lines
Diff to previous 1.135 (colored)

make carp's routing table modification attempts (imho broken by design)
at least exhibit routing messages so it does not confuse the userland
routing daemons by routing table changes not reflected by messages on the
routing socket. effect would be bgpd using wrong nexthops for example, in
the worst case (that i actually ran into) blackholing traffic.
ok reyk claudio "looks correct" miod

Revision 1.130.2.1 / (download) - annotate - [select for diffs], Mon Apr 30 20:40:25 2007 UTC (17 years, 1 month ago) by ckuethe
Branch: OPENBSD_4_0
Changes since 1.130: +4 -3 lines
Diff to previous 1.130 (colored) next main 1.131 (colored)

From mpf@
>  Don't pick up IPv6 link local IPs on address deletions.
>  This unbreaks carp reconfiguration.
>  OK henning@, mcbride@

Revision 1.132.2.1 / (download) - annotate - [select for diffs], Mon Apr 30 20:39:44 2007 UTC (17 years, 1 month ago) by ckuethe
Branch: OPENBSD_4_1
Changes since 1.132: +4 -3 lines
Diff to previous 1.132 (colored) next main 1.133 (colored)

From mpf@
>  Don't pick up IPv6 link local IPs on address deletions.
>  This unbreaks carp reconfiguration.
>  OK henning@, mcbride@

Revision 1.135 / (download) - annotate - [select for diffs], Tue Mar 27 21:58:16 2007 UTC (17 years, 2 months ago) by mpf
Branch: MAIN
Changes since 1.134: +4 -3 lines
Diff to previous 1.134 (colored)

Don't pick up IPv6 link local IPs on address deletions.
This unbreaks carp reconfiguration.
OK henning@, mcbride@

Revision 1.134 / (download) - annotate - [select for diffs], Sun Mar 25 18:26:23 2007 UTC (17 years, 2 months ago) by mpf
Branch: MAIN
Changes since 1.133: +17 -1 lines
Diff to previous 1.133 (colored)

Synchronise carp advertisements on group demotion.
This reduces group failover time to a few milliseconds.
Diff from Nathanael.
OK henning@

Revision 1.133 / (download) - annotate - [select for diffs], Sun Mar 18 23:23:17 2007 UTC (17 years, 2 months ago) by mpf
Branch: MAIN
Changes since 1.132: +248 -82 lines
Diff to previous 1.132 (colored)

Add IP load balancing support for carp(4).
This provides a similar functionality as ARP balancing,
but also works for traffic that comes across routers.
IPv6 is supported as well.
The configuration scheme will change as soon we have sth better.

Also add support for changing the MAC address on carp(4)
interfaces. (code from mcbride)

Tested by pyr@ and reyk@
OK mcbride@

Revision 1.132 / (download) - annotate - [select for diffs], Wed Dec 13 09:01:59 2006 UTC (17 years, 6 months ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE
Branch point for: OPENBSD_4_1
Changes since 1.131: +4 -4 lines
Diff to previous 1.131 (colored)

use IN6_IS_SCOPE_EMBED to check kernel-internal form addresses
(s6_addr16[1] filled)
ok dhartmei

Revision 1.131 / (download) - annotate - [select for diffs], Thu Nov 16 13:12:43 2006 UTC (17 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.130: +5 -1 lines
Diff to previous 1.130 (colored)

in carp_attach, create the "carp" interface group, so that it is always
and early in the boot process existant. needed by the rc scripts for
carp demotion on the "carp" group. this used to work because pfsync0
was always there and member of said group; it has been broken on pfsync-less
kernels for quite some time. ok mpf mcbride

Revision 1.130 / (download) - annotate - [select for diffs], Thu Aug 31 12:37:31 2006 UTC (17 years, 9 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE
Branch point for: OPENBSD_4_0
Changes since 1.129: +64 -23 lines
Diff to previous 1.129 (colored)

Automatically add a IPv6 link-local address to carp interfaces when the
virtual MAC address is set. Among other things, this makes route6d work
correctly on systems with carp interfaces.

In order to ensure backwards compatibility, we do not include IPv6
link-local addresses in generating the HMAC, but we accept HMACs with AND
without the link-local addresses. They will be added to the HMAC in a future
release.

In short: this change should only affect backwards compatibility for
IPv6 users who are manually adding link-local addresses on carp interfaces.

testing mtu@ todd@
ok mpf@ henning@ deraadt@

Revision 1.129 / (download) - annotate - [select for diffs], Mon Aug 28 17:29:53 2006 UTC (17 years, 9 months ago) by mcbride
Branch: MAIN
Changes since 1.128: +3 -30 lines
Diff to previous 1.128 (colored)

Make carp see all IPv6 address additions and remove dead code in carp_ioctl()

ok mpf@ henning@

Revision 1.128 / (download) - annotate - [select for diffs], Wed Aug 16 09:40:52 2006 UTC (17 years, 9 months ago) by mpf
Branch: MAIN
Changes since 1.127: +11 -1 lines
Diff to previous 1.127 (colored)

Send out a second delayed gratuitous ARP request after
we've won the MASTER election.
This seems to be necessary w/ some wacky L3 switches,
that only learn by looking at ARP packets.
Fixes PR 5148.
OK mcbride@

Revision 1.127 / (download) - annotate - [select for diffs], Fri Jun 16 16:49:40 2006 UTC (17 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.126: +6 -5 lines
Diff to previous 1.126 (colored)

adjust functions dealing with the routing table to take a table ID as
parameter so they can work on alternate tables. table 0 hardcoded for
many callers yet, that will be adapted step by step.
input + ok claudio norby hshoexer

Revision 1.126 / (download) - annotate - [select for diffs], Fri Jun 2 19:53:12 2006 UTC (18 years ago) by mpf
Branch: MAIN
Changes since 1.125: +87 -27 lines
Diff to previous 1.125 (colored)

Introduce attributes to interface groups.
As a first user, move the global carp(4) demotion counter
into the interface group. Thus we have the possibility
to define which carp interfaces are demoted together.

Put the demotion counter into the reserved field of the carp header.
With this, we can have carp act smarter if multiple errors occur.
It now always takes over other carp peers, that are advertising
with a higher demote count.  As a side effect, we can also have
group failovers without the need of running in preempt mode.
The protocol change does not break compability with older
implementations.

Collaborative work with mcbride@

OK mcbride@, henning@

Revision 1.125 / (download) - annotate - [select for diffs], Mon May 22 23:25:15 2006 UTC (18 years ago) by krw
Branch: MAIN
Changes since 1.124: +4 -3 lines
Diff to previous 1.124 (colored)

Check for NULL cookies before calling hook_disestablish(). Just in case
the establish calls were bypassed or failed.

ok mpf@

Revision 1.124 / (download) - annotate - [select for diffs], Thu May 18 12:39:23 2006 UTC (18 years ago) by mpf
Branch: MAIN
Changes since 1.123: +43 -1 lines
Diff to previous 1.123 (colored)

Add a duplicate check for our own advertisements.  This is necessary
for dumb non simplex interfaces, that receive packets they've just
sent.  Fixes bug 5121.
OK deraadt@, mcbride@

Revision 1.123 / (download) - annotate - [select for diffs], Sun Mar 26 14:54:01 2006 UTC (18 years, 2 months ago) by camield
Branch: MAIN
Changes since 1.122: +2 -2 lines
Diff to previous 1.122 (colored)

if_link_state_change() is more appropriate here.

ok henning mcbride

Revision 1.122 / (download) - annotate - [select for diffs], Sat Mar 25 22:41:48 2006 UTC (18 years, 2 months ago) by djm
Branch: MAIN
Changes since 1.121: +3 -2 lines
Diff to previous 1.121 (colored)

allow bpf(4) to ignore packets based on their direction (inbound or
outbound), using a new BIOCSDIRFILT ioctl;
guidance, feedback and ok canacar@

Revision 1.121 / (download) - annotate - [select for diffs], Thu Mar 23 14:18:55 2006 UTC (18 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.120: +4 -2 lines
Diff to previous 1.120 (colored)

Set a carp MAC address of 00:00:00:00:00:00 if no vhid is assigned.

ok henning@

Revision 1.120 / (download) - annotate - [select for diffs], Wed Mar 22 14:37:44 2006 UTC (18 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.119: +6 -5 lines
Diff to previous 1.119 (colored)

prevent anything outside rote.c from accessing the routing table heads
directly. rather provide a rt_lookup function for regular lookups,
and a rt_gettable for those that need access to the head for some reason.
the latter cases should be revisted later probably so that nothing outside
the routing core code accesses the heads at all...
tested claudio jolan me, ok claudio markus

Revision 1.119 / (download) - annotate - [select for diffs], Sat Jan 28 23:47:20 2006 UTC (18 years, 4 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.118: +5 -4 lines
Diff to previous 1.118 (colored)

Fix hmac calculation.
Add some f's; do comparison in host byte order.
OK mcbride@

Revision 1.104.2.1 / (download) - annotate - [select for diffs], Sun Dec 18 04:24:05 2005 UTC (18 years, 5 months ago) by brad
Branch: OPENBSD_3_7
Changes since 1.104: +4 -14 lines
Diff to previous 1.104 (colored) next main 1.105 (colored)

MFC:
Fix by mpf@

Completly remove transition path INIT -> MASTER.
A bug introduced in -r 1.4 led lower priotorized hosts
switching to MASTER state for a short time at bootup,
if preemption was enabled.

ok deraadt@ mpf@

Revision 1.109.2.1 / (download) - annotate - [select for diffs], Fri Dec 16 23:47:44 2005 UTC (18 years, 5 months ago) by brad
Branch: OPENBSD_3_8
Changes since 1.109: +4 -14 lines
Diff to previous 1.109 (colored) next main 1.110 (colored)

MFC:
Fix by mpf@

Completly remove transition path INIT -> MASTER.
A bug introduced in -r 1.4 led lower priotorized hosts
switching to MASTER state for a short time at bootup,
if preemption was enabled.

ok deraadt@ mpf@

Revision 1.118 / (download) - annotate - [select for diffs], Tue Nov 29 09:57:44 2005 UTC (18 years, 6 months ago) by mpf
Branch: MAIN
Changes since 1.117: +4 -4 lines
Diff to previous 1.117 (colored)

Fix IPv6 hmac calculation.
OK mcbride@

Revision 1.117 / (download) - annotate - [select for diffs], Tue Nov 29 02:59:42 2005 UTC (18 years, 6 months ago) by jolan
Branch: MAIN
Changes since 1.116: +7 -7 lines
Diff to previous 1.116 (colored)

something in the eurobsdcon route-a-thon broke my simple home network
router so back out the routing stuff to pre-eurobsdcon where my machine
doesn't crash immediately.

i am happy to test diffs and report success/failures but i am not happy
to have instantaneous crashes when i reboot with a new kernel that was
compiled from pristine sources.

if you are going to be an elitist asshole then you could at least make
sure your code works.

ok and "be crass towards them" deraadt@

Revision 1.116 / (download) - annotate - [select for diffs], Sun Nov 27 16:22:45 2005 UTC (18 years, 6 months ago) by henning
Branch: MAIN
Changes since 1.115: +8 -8 lines
Diff to previous 1.115 (colored)

don't let anything outside route.c access the routing table heads directly,
but go through a provided wrapper.
also provide rt_lookup() instead of doing the lookup manually in many places.
ryan ok

Revision 1.115 / (download) - annotate - [select for diffs], Sun Nov 27 10:58:06 2005 UTC (18 years, 6 months ago) by mpf
Branch: MAIN
Changes since 1.114: +4 -14 lines
Diff to previous 1.114 (colored)

Completly remove transition path INIT -> MASTER.
A bug introduced in -r 1.4 led lower priotorized hosts
switching to MASTER state for a short time at bootup,
if preemption was enabled.
OK mcbride@

Revision 1.114 / (download) - annotate - [select for diffs], Sun Nov 27 10:48:59 2005 UTC (18 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.113: +37 -13 lines
Diff to previous 1.113 (colored)

Sort the IP addresses in ascending order when doing the carp hmac; makes
alias address order on the interface irrelevant.

prodding by henning@, ok mpf@

Revision 1.113 / (download) - annotate - [select for diffs], Fri Nov 4 08:11:54 2005 UTC (18 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.112: +51 -4 lines
Diff to previous 1.112 (colored)

Add carp_hash() - hash the ethernet address of the ARP request and use
the result to determine which carp interface should answer rather than
simply using the ip address.

Fixes breakage debugged by Matt Bradford <m.bradford@isrc.qut.edu.au>

'just commit' deraadt@

Revision 1.112 / (download) - annotate - [select for diffs], Mon Oct 31 01:40:54 2005 UTC (18 years, 7 months ago) by pascoe
Branch: MAIN
Changes since 1.111: +6 -3 lines
Diff to previous 1.111 (colored)

Fix a TAILQ_FOREACH where the item containing the next pointer could be
freed.

ok canacar deraadt

Revision 1.111 / (download) - annotate - [select for diffs], Mon Oct 24 14:31:26 2005 UTC (18 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.110: +2 -22 lines
Diff to previous 1.110 (colored)

Remove redundant duplicate packet length check.

ok mpf@

Revision 1.110 / (download) - annotate - [select for diffs], Thu Sep 29 19:39:41 2005 UTC (18 years, 8 months ago) by mpf
Branch: MAIN
Changes since 1.109: +14 -15 lines
Diff to previous 1.109 (colored)

Rework of multicast deletion code.
The previous code could wrongly delete multicast groups
on the parent interface. Now we forward only remembered
delete requests to the carpdev.
OK mcbride, mickey. "Get it in" deraadt.

Revision 1.109 / (download) - annotate - [select for diffs], Wed Aug 31 04:49:21 2005 UTC (18 years, 9 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE
Branch point for: OPENBSD_3_8
Changes since 1.108: +6 -2 lines
Diff to previous 1.108 (colored)

Comment out KASSERT(mc != NULL) in carp_ether_delmulti. Because we mess with
the multicast list elsewhere, it can occur under certain conditions (PR4475).

ok deraadt@ mpf@

Revision 1.108 / (download) - annotate - [select for diffs], Sun Jul 31 03:52:19 2005 UTC (18 years, 10 months ago) by pascoe
Branch: MAIN
Changes since 1.107: +3 -16 lines
Diff to previous 1.107 (colored)

Introduce bpf_mtap_af and bpf_mtap_hdr to be used when passing a mbuf chain
to bpf with either an address family or other header added.

These helpers only allocate a much smaller struct m_hdr on the stack when
needed, rather than leaving 256 byte struct mbufs on the stack in deep
call paths.  Also removes a fair bit of duplicated code.

commit now, tune after deraadt@

Revision 1.107 / (download) - annotate - [select for diffs], Sun Jun 19 18:17:02 2005 UTC (18 years, 11 months ago) by pascoe
Branch: MAIN
Changes since 1.106: +11 -13 lines
Diff to previous 1.106 (colored)

Don't reflect CARP's internal state via IFF_UP (which a user can modify), use
IFF_RUNNING instead.  Also, do not blindly restore flags onto an interface when
returning to the running state.

This eliminates the possibility that the kernel will bring the interface back
up after a link state change on the physical interface, even though the user
may have done an "ifconfig carpN down" in the meantime.  Similarly two link
state down events on the physical interface in succession could result in us
never coming out of the INIT state.

The master/backup state is still reported via link state information, so
bgpd/ospfd, etc, should function as before.

This also addresses PR4238.

ok mpf@, ok with the idea etc henning@

Revision 1.106 / (download) - annotate - [select for diffs], Fri May 27 08:33:25 2005 UTC (19 years ago) by mpf
Branch: MAIN
Changes since 1.105: +7 -1 lines
Diff to previous 1.105 (colored)

only access if_linkstatehooks inside splnet.
with pascoe@

Revision 1.105 / (download) - annotate - [select for diffs], Wed Apr 20 23:00:41 2005 UTC (19 years, 1 month ago) by mpf
Branch: MAIN
Changes since 1.104: +8 -3 lines
Diff to previous 1.104 (colored)

Introduce if_linkstatehooks.
This converts if_link_state_change() to a generic usable
callback with dohooks().

OK henning@, camield@
Tested by camield@ and Alexey E. Suslikov

Revision 1.104 / (download) - annotate - [select for diffs], Tue Mar 15 15:51:27 2005 UTC (19 years, 3 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE
Branch point for: OPENBSD_3_7
Changes since 1.103: +17 -16 lines
Diff to previous 1.103 (colored)

- stop tearing down routes when the carp interface goes to backup in the
  carpdev case; block outgoing packets in carp_output() instead.
- unbreak the "bow out on 'ifconfig down'" behaviour, allows instant
  failover on graceful halt/reboot to work again.

ok mpf@ henning@

Revision 1.103 / (download) - annotate - [select for diffs], Sun Mar 13 18:26:29 2005 UTC (19 years, 3 months ago) by pat
Branch: MAIN
Changes since 1.102: +2 -3 lines
Diff to previous 1.102 (colored)

fix a potential crash that could occur when CARP_LOG is being used.

ok mcbride

Revision 1.102 / (download) - annotate - [select for diffs], Sat Mar 5 13:33:49 2005 UTC (19 years, 3 months ago) by mpf
Branch: MAIN
Changes since 1.101: +5 -12 lines
Diff to previous 1.101 (colored)

Remove code which enforces a advskew=0 for the case
that carp shares the IP addresse with its physical interface.
It's neither supported nor needed, since we have carpdev now.

ok mcbride@

Revision 1.101 / (download) - annotate - [select for diffs], Tue Mar 1 19:04:56 2005 UTC (19 years, 3 months ago) by mcbride
Branch: MAIN
Changes since 1.100: +18 -44 lines
Diff to previous 1.100 (colored)

Unbreak arp_input with carp; add back the call to carp_iamatch()
which was removed in rev 1.57. This makes arpbalance work again, and
ensures that only one carp host will reply to a given arp request.

ok mpf@ pascoe@ dhartmei@ deraadt@

Revision 1.100 / (download) - annotate - [select for diffs], Mon Feb 28 00:26:47 2005 UTC (19 years, 3 months ago) by mcbride
Branch: MAIN
Changes since 1.99: +1 -2 lines
Diff to previous 1.99 (colored)

Remove unused variable if_flags in struct carp_softc, ok mickey@

Revision 1.99 / (download) - annotate - [select for diffs], Tue Feb 8 13:42:27 2005 UTC (19 years, 4 months ago) by markus
Branch: MAIN
Changes since 1.98: +8 -2 lines
Diff to previous 1.98 (colored)

build w/o INET6; ok mpf@, mcbride@

Revision 1.98 / (download) - annotate - [select for diffs], Mon Feb 7 08:58:37 2005 UTC (19 years, 4 months ago) by mcbride
Branch: MAIN
Changes since 1.97: +35 -20 lines
Diff to previous 1.97 (colored)

Unrevert the changes introduced in 1.96 and accidentally removed in 1.97
with an id10t error by yours truly.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Feb 7 04:50:51 2005 UTC (19 years, 4 months ago) by mcbride
Branch: MAIN
Changes since 1.96: +24 -34 lines
Diff to previous 1.96 (colored)

Prevent carp from attaching to other carp interfaces, which the
ifp->if_flags & IFF_MULTICAST checks no longer protect against.

ok pascoe@ mpf@

Revision 1.96 / (download) - annotate - [select for diffs], Mon Feb 7 04:14:39 2005 UTC (19 years, 4 months ago) by pascoe
Branch: MAIN
Changes since 1.95: +35 -20 lines
Diff to previous 1.95 (colored)

There is no SIOCDIFADDR call into interfaces on address deletion, so
use our carp_addr_updated callback to detect deletion and reconfigure
appropriately.

ok mcbride@

Revision 1.95 / (download) - annotate - [select for diffs], Sat Jan 29 10:06:16 2005 UTC (19 years, 4 months ago) by mcbride
Branch: MAIN
Changes since 1.94: +2 -1 lines
Diff to previous 1.94 (colored)

Check the carpdev link state when we attach to it, makes a firewall
with an interface down avoid preempting after a reboot.

Pointed out by Stephen Marley <stephen.marley@catwoman.cl-is.com>

ok pascoe@ mpf@

Revision 1.94 / (download) - annotate - [select for diffs], Tue Jan 18 23:26:52 2005 UTC (19 years, 4 months ago) by mpf
Branch: MAIN
Changes since 1.93: +3 -140 lines
Diff to previous 1.93 (colored)

Rewriting the lladdr can now be done without using mbuf tags.
Advertisements run through the carp interface first.
So we just take the address from ifp0.
While we're there,
also remove carp_macmatch6, which isn't used anymore.

Proposed by mcbride@
ok mcbride@, pascoe@

Revision 1.93 / (download) - annotate - [select for diffs], Thu Jan 6 21:45:35 2005 UTC (19 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.92: +11 -11 lines
Diff to previous 1.92 (colored)

spacing

Revision 1.92 / (download) - annotate - [select for diffs], Thu Jan 6 09:29:21 2005 UTC (19 years, 5 months ago) by mcbride
Branch: MAIN
Changes since 1.91: +17 -29 lines
Diff to previous 1.91 (colored)

Attach multicast to the carp interface for IPv6 (makes it consistent with
IPv4, and will allow us to get rid of carp_fix_lladdr() and the carp mbuf
tag later).

ok pascoe@ mpf@

Revision 1.91 / (download) - annotate - [select for diffs], Thu Jan 6 00:46:58 2005 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.90: +5 -3 lines
Diff to previous 1.90 (colored)

Error path cleanups for carp_output.  Use ENOBUFS instead of ENOMEM when
unable to tag a packet, and free mbuf chain on all failures.

ok mcbride@

Revision 1.90 / (download) - annotate - [select for diffs], Thu Jan 6 00:41:51 2005 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.89: +21 -3 lines
Diff to previous 1.89 (colored)

Tag all packets sent via a CARP interface for link local address
substitution.

With this change and the previous ARP changes, all Ethernet packets sent
via a CARP interface should now have the virtual MAC address as the source.

ok mcbride@ niklas@

Revision 1.89 / (download) - annotate - [select for diffs], Tue Jan 4 10:30:00 2005 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

Move processing of ARP packets for CARP addresses to the carp interface
instead of processing them in the parent interface.  This causes us to send
ARP packets on a carpdev with its virtual MAC address as the source, rather
than the parent's physical address.

Permits us to fail over cleanly when connected to devices that use the
source MAC address on a received ARP request to generate an ARP entry for
the requesting host, rather than going through the who-has/is-at procedure.

ok niklas@ mcbride@

Revision 1.88 / (download) - annotate - [select for diffs], Wed Dec 22 06:04:33 2004 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.87: +51 -23 lines
Diff to previous 1.87 (colored)

Instead of running carp_setroute synchronously, use if_addrhooks to get a
callback after in_ifinit has run.  This lets us correct any routes that
in_ifinit has incorrectly added for our interface.

Also be more explicit with the routing checks/changes that we make.  This
makes it possible to have different prefix lengths on a CARP interface and
the physical interface it is bound to.

ok mcbride@

Revision 1.87 / (download) - annotate - [select for diffs], Sun Dec 19 23:44:03 2004 UTC (19 years, 5 months ago) by mcbride
Branch: MAIN
Changes since 1.86: +85 -87 lines
Diff to previous 1.86 (colored)

#define sc_if sc_ac.ac_if, makes things a little more readable, and
kills a couple of ugly line wraps. From Max Laier.

ok pascoe@

Revision 1.86 / (download) - annotate - [select for diffs], Sun Dec 19 03:25:37 2004 UTC (19 years, 5 months ago) by mcbride
Branch: MAIN
Changes since 1.85: +39 -11 lines
Diff to previous 1.85 (colored)

Make it possible for carp to work on fddi and token ring again.

ok pascoe@ mpf@

Revision 1.85 / (download) - annotate - [select for diffs], Sat Dec 18 00:52:21 2004 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.84: +5 -1 lines
Diff to previous 1.84 (colored)

Decrement carp_suppress_preempt when detaching an interface that has
been experiencing output errors.

ok mcbride@

Revision 1.84 / (download) - annotate - [select for diffs], Fri Dec 17 21:40:04 2004 UTC (19 years, 5 months ago) by mpf
Branch: MAIN
Changes since 1.83: +9 -4 lines
Diff to previous 1.83 (colored)

Temporary fix to get IPv6 working again.
v6 advertisements are still received the old-fashioned way.
ok mcbride@

Revision 1.83 / (download) - annotate - [select for diffs], Fri Dec 17 12:42:01 2004 UTC (19 years, 5 months ago) by pascoe
Branch: MAIN
Changes since 1.82: +31 -16 lines
Diff to previous 1.82 (colored)

Reorder code in the ethernet output path, and enhance unicast address
matching in the bridge receive path to make CARP operate correctly
on physical interfaces that are participating in a bridge.

ok mcbride@ henning@ dlg@

Revision 1.82 / (download) - annotate - [select for diffs], Fri Dec 17 06:47:00 2004 UTC (19 years, 5 months ago) by mcbride
Branch: MAIN
Changes since 1.81: +5 -1 lines
Diff to previous 1.81 (colored)

Remember to decrement carp_suppress_preempt when detaching.

ok pascoe@

Revision 1.81 / (download) - annotate - [select for diffs], Wed Dec 15 18:40:09 2004 UTC (19 years, 5 months ago) by mcbride
Branch: MAIN
Changes since 1.80: +2 -2 lines
Diff to previous 1.80 (colored)

Add IFF_NOARP to carp interface, we want arp requests to be handled via
carp_iamatch() on the physical interface.

ok pascoe@ mpf@

Revision 1.80 / (download) - annotate - [select for diffs], Wed Dec 15 14:13:06 2004 UTC (19 years, 6 months ago) by pat
Branch: MAIN
Changes since 1.79: +21 -16 lines
Diff to previous 1.79 (colored)

* fix the multicast memberships removal
* less hardcoding in format strings for easier maintenance

mcbride ok

Revision 1.79 / (download) - annotate - [select for diffs], Fri Dec 10 23:13:52 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.78: +35 -28 lines
Diff to previous 1.78 (colored)

Add carp_set_enaddr(), call carp_set_state() after changing the vhid
to trigger a gratuitous arp and update arp tables on other hosts.

Revision 1.78 / (download) - annotate - [select for diffs], Fri Dec 10 22:35:17 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

Rename carp_output() to carp_fix_lladdr().

Revision 1.77 / (download) - annotate - [select for diffs], Wed Dec 8 17:06:12 2004 UTC (19 years, 6 months ago) by pat
Branch: MAIN
Changes since 1.76: +11 -7 lines
Diff to previous 1.76 (colored)

* knf
* M_WAITOK -> M_NOWAIT
* FREE() only when necessary
* join_multicast6 for ip6 addresses

mcbride ok

Revision 1.76 / (download) - annotate - [select for diffs], Wed Dec 8 08:16:44 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.75: +3 -19 lines
Diff to previous 1.75 (colored)

Remove code duplication duplication. Use carpdetach() in carp_clone_destroy().

Revision 1.75 / (download) - annotate - [select for diffs], Wed Dec 8 07:05:18 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.74: +5 -7 lines
Diff to previous 1.74 (colored)

Merge in more fixes from a pre-carpdev diff from Chris Pascoe.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Dec 8 06:57:55 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.73: +8 -3 lines
Diff to previous 1.73 (colored)

Check if_type in carp_carpdev_state() to make sure we're not
dealing with a carp interface.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Dec 7 20:38:47 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.72: +591 -339 lines
Diff to previous 1.72 (colored)

Convert carp(4) to behave more like a regular interface, much in the same
style as vlan(4). carp interfaces no longer require the physical interface
to be on the same subnet as the carp interface, or even that the physical
interface has an adress at all, so CARP can now be used on /30 networks.

ok deraadt@ henning@

Revision 1.72 / (download) - annotate - [select for diffs], Tue Nov 30 00:17:18 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Use %s, not %d to print the interface name. From Max Laier.

Revision 1.71 / (download) - annotate - [select for diffs], Sun Nov 28 03:14:03 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

Reverse bogus sc == NULL check in CARP_LOG(), from Max Laier.

Revision 1.70 / (download) - annotate - [select for diffs], Wed Nov 17 06:07:39 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.69: +17 -5 lines
Diff to previous 1.69 (colored)

Improved logging for advertisement failures: Add some carpstats.carps_onomem++
when sending advertisements fail due to ENOBUGS, and some CARP_LOG for other
failures.

From camield@

Revision 1.69 / (download) - annotate - [select for diffs], Tue Nov 16 18:13:02 2004 UTC (19 years, 6 months ago) by mcbride
Branch: MAIN
Changes since 1.68: +6 -2 lines
Diff to previous 1.68 (colored)

Call arprequest/ether_output at splsoftnet(). From Chris Pascoe.

ok henning@

Revision 1.44.2.2 / (download) - annotate - [select for diffs], Sat Nov 6 02:37:03 2004 UTC (19 years, 7 months ago) by brad
Branch: OPENBSD_3_5
Changes since 1.44.2.1: +10 -10 lines
Diff to previous 1.44.2.1 (colored) to branchpoint 1.44 (colored) next main 1.45 (colored)

MFC:
Fix by mcbride@

Call ip_output at splsoftnet() when sending advertisements; also don't stop
sending advertisements if we can't tag the mbuf.

Problem report and fix from Chris Pascoe, thanks.

ok deraadt@ mcbride@

Revision 1.62.2.1 / (download) - annotate - [select for diffs], Sat Nov 6 02:30:00 2004 UTC (19 years, 7 months ago) by brad
Branch: OPENBSD_3_6
Changes since 1.62: +10 -10 lines
Diff to previous 1.62 (colored) next main 1.63 (colored)

MFC:
Fix by mcbride@

Call ip_output at splsoftnet() when sending advertisements; also don't stop
sending advertisements if we can't tag the mbuf.

Problem report and fix from Chris Pascoe, thanks.

ok deraadt@ mcbride@

Revision 1.68 / (download) - annotate - [select for diffs], Thu Oct 28 20:34:20 2004 UTC (19 years, 7 months ago) by henning
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (colored)

define IFT_CARP, and set if_type to that on carp interfaces instead
of hiding under IFT_PROPVIRTUAL, ryan daniel ok

Revision 1.67 / (download) - annotate - [select for diffs], Wed Oct 6 03:56:08 2004 UTC (19 years, 8 months ago) by mcbride
Branch: MAIN
Changes since 1.66: +4 -4 lines
Diff to previous 1.66 (colored)

Unbreak tcpdump on the carp interface; variable shadowing pointed out by
Patrick Latifi (diff based on his).

Revision 1.66 / (download) - annotate - [select for diffs], Tue Oct 5 18:08:41 2004 UTC (19 years, 8 months ago) by mcbride
Branch: MAIN
Changes since 1.65: +10 -10 lines
Diff to previous 1.65 (colored)

Call ip_output at splsoftnet() when sending advertisements; also don't stop
sending advertisements if we can't tag the mbuf.

Problem report and fix from Chris Pascoe, thanks.

ok henning@

Revision 1.65 / (download) - annotate - [select for diffs], Sat Sep 18 16:15:53 2004 UTC (19 years, 8 months ago) by mcbride
Branch: MAIN
Changes since 1.64: +8 -5 lines
Diff to previous 1.64 (colored)

Oops, copy a pointer to ac_if, not the first bytes of the struct itself.
Actually this doesn't matter right now, as the first bytes of struct ifnet
are a pointer to the softc, which has ac_if at the beginning and thus by
fluke the pointer is correct.

This also makes the sc to ifp conversion for carp_macmatch6().

Revision 1.64 / (download) - annotate - [select for diffs], Sat Sep 18 06:51:49 2004 UTC (19 years, 8 months ago) by mcbride
Branch: MAIN
Changes since 1.63: +6 -6 lines
Diff to previous 1.63 (colored)

Store the carp interface ifp in PACKET_TAG_CARP instead of a pointer to
carp_softc.

Revision 1.63 / (download) - annotate - [select for diffs], Thu Sep 16 22:32:46 2004 UTC (19 years, 8 months ago) by mcbride
Branch: MAIN
Changes since 1.62: +32 -19 lines
Diff to previous 1.62 (colored)

Clean up CARP_LOG macro and include the physical interface
that bogus packets arrive on.

Revision 1.62 / (download) - annotate - [select for diffs], Tue Aug 31 05:31:39 2004 UTC (19 years, 9 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE
Branch point for: OPENBSD_3_6
Changes since 1.61: +4 -3 lines
Diff to previous 1.61 (colored)

Prevent backup CARP hosts from replying to arp requests, fixes strangeness
with some layer-3 switches. From Bill Marquette.

ok henning@ mickey@ dhartmei@ and deraadt@

Revision 1.61 / (download) - annotate - [select for diffs], Thu Jun 24 19:35:25 2004 UTC (19 years, 11 months ago) by tholo
Branch: MAIN
Changes since 1.60: +4 -4 lines
Diff to previous 1.60 (colored)

This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.

It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code.  Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.

ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@

Revision 1.35.2.3 / (download) - annotate - [select for diffs], Sun Jun 13 08:50:18 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.35.2.2: +3 -2 lines
Diff to previous 1.35.2.2 (colored) next main 1.36 (colored)

sync to HEAD

Revision 1.60 / (download) - annotate - [select for diffs], Thu Jun 10 17:00:06 2004 UTC (20 years ago) by mcbride
Branch: MAIN
CVS Tags: SMP_SYNC_A
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

zero the cif struct correctly.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Jun 10 16:55:37 2004 UTC (20 years ago) by mcbride
Branch: MAIN
Changes since 1.58: +2 -1 lines
Diff to previous 1.58 (colored)

Plug a memory leak in carp_clone_destroy()

From Patrick Latifi

Revision 1.35.2.2 / (download) - annotate - [select for diffs], Sat Jun 5 23:11:25 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.35.2.1: +260 -73 lines
Diff to previous 1.35.2.1 (colored)

Merge with the trunk

Revision 1.58 / (download) - annotate - [select for diffs], Mon May 31 21:16:57 2004 UTC (20 years ago) by mpf
Branch: MAIN
CVS Tags: SMP_SYNC_B
Changes since 1.57: +3 -1 lines
Diff to previous 1.57 (colored)

initialize struct carp_if and let vhif_nvrs counter work. ok mcbride@

Revision 1.57 / (download) - annotate - [select for diffs], Sun May 30 23:03:34 2004 UTC (20 years ago) by pvalchev
Branch: MAIN
Changes since 1.56: +5 -1 lines
Diff to previous 1.56 (colored)

compile without INET6; ok mcbride

Revision 1.56 / (download) - annotate - [select for diffs], Sat May 29 08:44:21 2004 UTC (20 years ago) by mcbride
Branch: MAIN
Changes since 1.55: +19 -2 lines
Diff to previous 1.55 (colored)

Remove multicast addresses and promiscuous mode when destroying the
carp interface.

Revision 1.55 / (download) - annotate - [select for diffs], Sat May 29 04:33:27 2004 UTC (20 years ago) by mcbride
Branch: MAIN
Changes since 1.54: +3 -7 lines
Diff to previous 1.54 (colored)

carp_ioctl() happens after ifioctl(); check flags correctly so that
'ifconfig carp0 down' and 'ifconfig carp0 up' work as expected.

Revision 1.44.2.1 / (download) - annotate - [select for diffs], Thu May 27 18:23:31 2004 UTC (20 years ago) by brad
Branch: OPENBSD_3_5
Changes since 1.44: +4 -6 lines
Diff to previous 1.44 (colored)

MFC:
Fix by mcbride@

Make sure advskew set correctly in advertisement when configured to a value
greater than 240. From Frank Denis <j@pureftpd.org>, PR3774.

ok deraadt@ mcbride@

Revision 1.54 / (download) - annotate - [select for diffs], Tue May 25 02:32:07 2004 UTC (20 years ago) by jolan
Branch: MAIN
Changes since 1.53: +1 -3 lines
Diff to previous 1.53 (colored)

let sc_counter wrap automatically, ok mcbride@

Revision 1.53 / (download) - annotate - [select for diffs], Mon May 24 18:54:47 2004 UTC (20 years ago) by mcbride
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

Check for sc->sc_ifp != NULL in carp_setroute(). Running dhclient on the
carp interface won't work, but it doesn't mean we should panic the box!

Revision 1.52 / (download) - annotate - [select for diffs], Sun May 16 02:06:10 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.51: +34 -3 lines
Diff to previous 1.51 (colored)

When we back off due to problems with the physical interface, advertise
the backoff immediately on all of the interfaces instead of waiting for
the next scheduled advertisement.

Revision 1.51 / (download) - annotate - [select for diffs], Sun May 16 00:24:45 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.50: +2 -3 lines
Diff to previous 1.50 (colored)

Remove useless test pointed out by Frank Denis <j@pureftpd.org>.

Revision 1.50 / (download) - annotate - [select for diffs], Thu May 13 08:21:18 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.49: +6 -4 lines
Diff to previous 1.49 (colored)

Act like our advskew is 240 when receiving packets as well as sending if
we're backing off.  Makes the backoff actually work like it's supposed to
instead of flip-flopping.  Problem pointed out by ho@ and jakob@

Revision 1.49 / (download) - annotate - [select for diffs], Thu May 13 05:49:06 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.48: +30 -2 lines
Diff to previous 1.48 (colored)

Add cloned interface destruction to carp (ifconfig carp0 destroy).

ok deraadt@

Revision 1.48 / (download) - annotate - [select for diffs], Thu May 13 00:04:20 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.47: +5 -5 lines
Diff to previous 1.47 (colored)

KNF

Revision 1.47 / (download) - annotate - [select for diffs], Mon May 10 02:18:52 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.46: +4 -6 lines
Diff to previous 1.46 (colored)

Make sure advskew set correctly in advertisement when configured to a value
greater than 240. From Frank Denis <j@pureftpd.org>, PR3774.

Revision 1.46 / (download) - annotate - [select for diffs], Sat May 8 02:53:03 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.45: +39 -3 lines
Diff to previous 1.45 (colored)

If a carp interface has more than CARP_SENDAD_MAX_ERRORS failed
advertisements in a row, back off all the other interfaces, until
CARP_SENDAD_MIN_SUCCESS advertisements are successful.

This makes carp deal better with ip output errors.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Apr 28 00:28:43 2004 UTC (20 years, 1 month ago) by mcbride
Branch: MAIN
Changes since 1.44: +50 -25 lines
Diff to previous 1.44 (colored)

Make carp(4) aware of its physical interface:
- If the physical interface goes down or the link goes down,
  the carp interface goes down as well.
- We treat this like the preemption holdoff with pfsync.
  So if one of the carp interfaces is known to be bad (because the
  physical interface it's associated with is bad), all the other carp
  interfaces back off: they won't preempt, and their advskew goes to 240.

ok cedric@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Mar 26 17:47:20 2004 UTC (20 years, 2 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE
Branch point for: OPENBSD_3_5
Changes since 1.43: +4 -3 lines
Diff to previous 1.43 (colored)

don't use mbuf after free; ok mcbride, deraadt, cloder

Revision 1.43 / (download) - annotate - [select for diffs], Fri Mar 26 08:31:58 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.42: +7 -2 lines
Diff to previous 1.42 (colored)

Also raise advskew to 240 while we wait for pfsync to get it's bulk update.
This is to deal with situations where the network is not working during boot
so we become master by default - the high advskew value allows other carp
boxes to preempt us when the network finally comes up.

ok deraadt@ beck@

Revision 1.42 / (download) - annotate - [select for diffs], Wed Mar 24 06:54:04 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

Correct size in error message. From mickey@

ok deraadt@

Revision 1.41 / (download) - annotate - [select for diffs], Wed Mar 24 06:13:56 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

Disable net.inet.carp.log by default.

ok deraadt@

Revision 1.40 / (download) - annotate - [select for diffs], Mon Mar 22 04:54:18 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.39: +16 -3 lines
Diff to previous 1.39 (colored)

Support for best effort bulk transfers of states when pfsync syncif is
configured.  This this allows pfsync+carp clusters to come up gracefully
without killing active connections. pfsync now prevents carp from
preempting to become master until the state table has sync'd.

ABI change, any application which use struct pf_state must be recompiled.

Reminded about this by Christian Gut. Thanks to beck@ cedric@ and dhartmei@
for testing and comments.

ok deraadt@

Revision 1.39 / (download) - annotate - [select for diffs], Sat Mar 20 11:01:35 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.38: +11 -7 lines
Diff to previous 1.38 (colored)

Unbreak routing change handling for state changes; count addresses differently
depending on where we're calling carp_addrcount() from.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Mar 18 20:46:16 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.37: +19 -22 lines
Diff to previous 1.37 (colored)

Allow the state to be changed explicitly via the ioctl.

ok markus@

Revision 1.37 / (download) - annotate - [select for diffs], Wed Mar 10 21:36:47 2004 UTC (20 years, 3 months ago) by mcbride
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Don't permit a negative index. Pointed out by Patrick Latifi.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Mar 5 12:25:56 2004 UTC (20 years, 3 months ago) by mcbride
Branch: MAIN
Changes since 1.35: +58 -27 lines
Diff to previous 1.35 (colored)

Only send route add or delete messages if it's the first identical
address being added or the last identical address being removed,
respectively.

Part of a larger diff approved by markus@ and dhartmei@, API changes held
back for now.

Revision 1.35.2.1 / (download) - annotate - [select for diffs], Thu Feb 19 10:57:23 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.35: +1 -1 lines
Diff to previous 1.35 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jan 18 12:22:39 2004 UTC (20 years, 4 months ago) by markus
Branch: MAIN
Branch point for: SMP
Changes since 1.34: +33 -11 lines
Diff to previous 1.34 (colored)

send RTM_IFINFO on carp state changes; with mpf@; ok mcbride@, mpf@

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jan 15 15:47:05 2004 UTC (20 years, 5 months ago) by dhartmei
Branch: MAIN
Changes since 1.33: +3 -1 lines
Diff to previous 1.33 (colored)

missing #ifdef INET6, ok henning@

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jan 13 07:23:43 2004 UTC (20 years, 5 months ago) by mcbride
Branch: MAIN
Changes since 1.32: +7 -1 lines
Diff to previous 1.32 (colored)

Add and remove IPv6 routes so when we're MASTER, we can connect to the
common address.

Revision 1.32 / (download) - annotate - [select for diffs], Wed Dec 10 07:22:43 2003 UTC (20 years, 6 months ago) by itojun
Branch: MAIN
Changes since 1.31: +5 -5 lines
Diff to previous 1.31 (colored)

de-register.  deraadt ok

Revision 1.31 / (download) - annotate - [select for diffs], Sat Dec 6 14:40:33 2003 UTC (20 years, 6 months ago) by grange
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Mark u_int64_t constants with ULL to make gcc3 happy.
ok drahn@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Dec 3 14:57:09 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.29: +49 -42 lines
Diff to previous 1.29 (colored)

add support for ifconfig clone; ok henning deraadt

Revision 1.29 / (download) - annotate - [select for diffs], Sun Nov 16 17:51:50 2003 UTC (20 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

compile without INET6

Revision 1.28 / (download) - annotate - [select for diffs], Fri Nov 14 08:17:46 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.27: +8 -5 lines
Diff to previous 1.27 (colored)

Don't include KAME link-local interface ID in HMAC.

from itojun@

Revision 1.27 / (download) - annotate - [select for diffs], Sun Nov 9 08:56:55 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.26: +6 -9 lines
Diff to previous 1.26 (colored)

No need to pass an unused struct carp_softc * into carp_input_c() from
carp_input() and carp6_input().

Revision 1.26 / (download) - annotate - [select for diffs], Sat Nov 8 19:17:28 2003 UTC (20 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

typos from Jonathon Gray;

Revision 1.25 / (download) - annotate - [select for diffs], Fri Nov 7 23:38:48 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.24: +19 -1 lines
Diff to previous 1.24 (colored)

Check to make sure that the packet was received on a carp-enabled interface.

Pointed out by Marco Pfatschbacher, ok mickey@

Revision 1.24 / (download) - annotate - [select for diffs], Fri Nov 7 22:04:46 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.23: +4 -3 lines
Diff to previous 1.23 (colored)

Clean up carp_iamatch() behaviour so we don't reply to arp requests when
the interface is ifconfig'd down.

Patch from Marco Pfatschbacher

Revision 1.23 / (download) - annotate - [select for diffs], Fri Nov 7 21:32:47 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.22: +3 -1 lines
Diff to previous 1.22 (colored)

Add missing #ifdef INET6.

Courtesy of markus@

Revision 1.22 / (download) - annotate - [select for diffs], Wed Nov 5 06:39:48 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.21: +9 -12 lines
Diff to previous 1.21 (colored)

Cleanups.
- Remove error variable which is not needed.
- Add missing /* INET6 */ comments.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Nov 4 21:30:44 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.20: +25 -1 lines
Diff to previous 1.20 (colored)

Add carp_setroute(), add and remove routes when the carp(4) interface
enters and leaves MASTER state. Allows the system to connect to the common
address when it is master.

ok cedric@ henning@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Nov 4 18:10:41 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.19: +3 -5 lines
Diff to previous 1.19 (colored)

Use MGETHDR() instead of m_gethdr()

Patch from Marco Pfatschbacher (Marco_Pfatschbacher at genua dot de)

Revision 1.19 / (download) - annotate - [select for diffs], Tue Nov 4 17:16:24 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.18: +2 -3 lines
Diff to previous 1.18 (colored)

- Remove bogus function prototype
- Put the correct address family in the BPF header

Pointed out by Max Laier.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Nov 4 03:19:22 2003 UTC (20 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.17: +1 -2 lines
Diff to previous 1.17 (colored)

kill a no longer relevant todo item

Revision 1.17 / (download) - annotate - [select for diffs], Tue Nov 4 02:52:40 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.16: +3 -5 lines
Diff to previous 1.16 (colored)

Some cleanups from Andrey Matveev <andrushock@korovino.net>:
        - remove duplicate string;
        - carp_set_addr() -> carp_set_addr6() when INET6;
        - spacing police.

Oh yeah, and we can take inet6 support off the todo list.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Nov 3 05:09:39 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.15: +11 -4 lines
Diff to previous 1.15 (colored)

Cleanups:
- missing #ifdef INET6.
- fix check for interface going down in carp_send_ad().
- fix memory leak which occurs when when ifpromisc() fails.

All from Max Laier, thanks.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Nov 3 03:19:27 2003 UTC (20 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +4 -4 lines
Diff to previous 1.14 (colored)

spacing

Revision 1.14 / (download) - annotate - [select for diffs], Mon Nov 3 00:55:57 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.13: +46 -49 lines
Diff to previous 1.13 (colored)

Some KNF cleanup. There's probably more to do.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Nov 2 16:15:58 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Typo; #ifdef INET not INET6.

From Max Laier.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Oct 31 09:00:32 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.11: +635 -127 lines
Diff to previous 1.11 (colored)

Add IPv6 support to CARP.

ok deraadt@

Revision 1.11 / (download) - annotate - [select for diffs], Mon Oct 27 20:57:59 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.10: +6 -3 lines
Diff to previous 1.10 (colored)

Skew the advertisement interval correctly when we reschedule.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Oct 27 06:23:57 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.9: +3 -2 lines
Diff to previous 1.9 (colored)

Also check if we're going down before scheduling an advertisement
when we fail to get an mbuf.

This too is courtesy of Max Laier.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Oct 27 06:13:43 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

Actually stop sending advertisements if we're Master and the carp(4)
interface is brought down.

Bug reported by Max Laier.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Oct 25 12:06:59 2003 UTC (20 years, 7 months ago) by markus
Branch: MAIN
Changes since 1.7: +40 -29 lines
Diff to previous 1.7 (colored)

precompute most of hmac; fix size for md; ok mcbride

Revision 1.7 / (download) - annotate - [select for diffs], Thu Oct 23 23:00:37 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

We want to hash the whole md, not just the size of the pointer.

Found testing CARP between sparc and sparc64.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Oct 22 14:56:54 2003 UTC (20 years, 7 months ago) by markus
Branch: MAIN
Changes since 1.5: +33 -11 lines
Diff to previous 1.5 (colored)

switch from keyed sha1 to hmac-sha1; ok mcbride@

Revision 1.5 / (download) - annotate - [select for diffs], Mon Oct 20 06:57:29 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.4: +8 -7 lines
Diff to previous 1.4 (colored)

Fix endianness bug in carp_sha1_generate, hash the whole counter, and
fix some whitespace nits while we're here.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Oct 20 03:01:01 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.3: +6 -8 lines
Diff to previous 1.3 (colored)

Stop all hosts from insisting they're master when preemption is
disabled.

bug report and fix testing david@

Revision 1.3 / (download) - annotate - [select for diffs], Mon Oct 20 00:43:58 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN
Changes since 1.2: +4 -7 lines
Diff to previous 1.2 (colored)

Fix but with setting advskew, only error if _both_ advbase and advskew are
set to 0. (ifconfig sets them one at a time)

tested by david@

Revision 1.2 / (download) - annotate - [select for diffs], Sun Oct 19 03:58:25 2003 UTC (20 years, 7 months ago) by david
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

more typos

Revision 1.1 / (download) - annotate - [select for diffs], Fri Oct 17 21:04:58 2003 UTC (20 years, 7 months ago) by mcbride
Branch: MAIN

Common Address Redundancy Protocol

Allows multiple hosts to share an IP address, providing high availability
and load balancing.

Based on code by mickey@, with additional help from markus@
and Marco_Pfatschbacher@genua.de

ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.