OpenBSD CVS

CVS log for src/sys/net/rtsock.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.373 / (download) - annotate - [select for diffs], Sun Dec 3 10:51:17 2023 UTC (5 months, 4 weeks ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.372: +3 -2 lines
Diff to previous 1.372 (colored)

Make rtm_senddesync_timer() timeout(9) handler mpsafe. solock() protects
the socket and the socket's PCB data.

ok bluhm

Revision 1.372 / (download) - annotate - [select for diffs], Sun Nov 12 17:51:41 2023 UTC (6 months, 2 weeks ago) by bluhm
Branch: MAIN
Changes since 1.371: +26 -24 lines
Diff to previous 1.371 (colored)

Use constant sockaddr in route lookup.

In rtalloc() and rtalloc_mpath() declare the parameter dst as const
sockaddr.  This makes MP safe route lookup easier as the destination
address is definitely not modified during the operation.  Array
rti_info, the central data structure with addresses for route
matching, contains constant sockaddr now.

OK mvs@ dlg@

Revision 1.371 / (download) - annotate - [select for diffs], Sun Nov 12 16:10:46 2023 UTC (6 months, 2 weeks ago) by bluhm
Branch: MAIN
Changes since 1.370: +20 -7 lines
Diff to previous 1.370 (colored)

Do not modify route info sockaddr in rtm_xaddrs().

The rti_info array is used to describe routes that should be found
by lookup.  Modifying the addreses in it is not a good idea.  There
were places where rtm_xaddrs() tried to fix the address family
instead of validating it.  Replace the modification with a check
and error out with EAFNOSUPPORT on failure.  Route labels always
have AF_UNSPEC and the other types are not used anyway.

OK kn@

Revision 1.370 / (download) - annotate - [select for diffs], Sat Sep 16 09:33:27 2023 UTC (8 months, 2 weeks ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.369: +2 -2 lines
Diff to previous 1.369 (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.369 / (download) - annotate - [select for diffs], Fri Jul 28 09:33:16 2023 UTC (10 months ago) by mvs
Branch: MAIN
Changes since 1.368: +2 -2 lines
Diff to previous 1.368 (colored)

Compare m_pullup(9) return value against NULL instead of 0.

Revision 1.368 / (download) - annotate - [select for diffs], Thu Jul 27 22:20:51 2023 UTC (10 months ago) by mvs
Branch: MAIN
Changes since 1.367: +3 -2 lines
Diff to previous 1.367 (colored)

Fix routing message size check in route_output(). `rtm_hdrlen' type is
u_short, so add sizeof(rtm->rtm_hdrlen) instead of 1 to its offset
within rt_msghdr structure.

ok claudio

Revision 1.367 / (download) - annotate - [select for diffs], Mon Jun 26 07:52:18 2023 UTC (11 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.366: +35 -25 lines
Diff to previous 1.366 (colored)

Revert unrelated change that sneaked into the pf_ioctl.c commit.

Revision 1.366 / (download) - annotate - [select for diffs], Mon Jun 26 07:49:48 2023 UTC (11 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.365: +26 -36 lines
Diff to previous 1.365 (colored)

Close all pf transactions before opening a new one in DIOCGETRULES.

Processes like snmpd or systat open pf(4) once and then issue many
DIOCGETRULES calls over their runtime. This accumulates many pf_trans
structs over their lifetime. At some point the kernel runs out of
memory because of that. By closing all transactions before creating
a new one, long living processes do no longer leak transactions.

This probably needs further refinement once more transactions types are
added but for now this solves the problem.

Problem found by florian@
OK sashan@ kn@

Revision 1.365 / (download) - annotate - [select for diffs], Thu Apr 20 21:43:17 2023 UTC (13 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.364: +3 -3 lines
Diff to previous 1.364 (colored)

Call sysctl_source() with shared netlock. It performs read-only
access to netlock protected data.

ok kn@ bluhm@

Revision 1.364 / (download) - annotate - [select for diffs], Wed Apr 19 17:42:47 2023 UTC (13 months, 2 weeks ago) by bluhm
Branch: MAIN
Changes since 1.363: +3 -1 lines
Diff to previous 1.363 (colored)

Protect rtable_setsource() and rtable_getsource() with exclusive
and shared netlock respectively.
OK kn@ mvs@

Revision 1.363 / (download) - annotate - [select for diffs], Tue Apr 18 22:01:24 2023 UTC (13 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.362: +7 -12 lines
Diff to previous 1.362 (colored)

Remove kernel lock from ifa_ifwithaddr() and ifa_ifwithdstaddr().
Netlock protects `if_list', `ifa_list' and returned `ifa' dereference,
so put netlock assertion within.

Please note, rtable_setsource() doesn't destroy data pointed by
`ar_source'. This is the `ifa_addr' data belongs to `ifa' and exclusive
netlock is required to destroy it. So the kernel lock is not required
within rt_setsource(). Take netlock by rt_setsource() caller to make
`ifa' dereference safe.

Suggestions and ok by bluhm@

Revision 1.362 / (download) - annotate - [select for diffs], Tue Apr 18 09:56:54 2023 UTC (13 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.361: +3 -3 lines
Diff to previous 1.361 (colored)

Call sysctl_dumpentry() with shared netlock. It performs read-only
access to netlock protected data. Please note, kernel lock is still
taken, as required by rtable_getsource() or BFD subsystem.

ok kn@ bluhm@

Revision 1.361 / (download) - annotate - [select for diffs], Tue Apr 18 09:55:34 2023 UTC (13 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.360: +3 -3 lines
Diff to previous 1.360 (colored)

Call sysctl_iflist() with shared netlock. It performs read-only access
to netlock protected data.

ok kn@ bluhm@

Revision 1.360 / (download) - annotate - [select for diffs], Tue Apr 18 09:54:53 2023 UTC (13 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.359: +3 -3 lines
Diff to previous 1.359 (colored)

Call sysctl_ifnames() with shared netlock. It performs read-only access
to netlock protected data.

ok kn@ bluhm@

Revision 1.359 / (download) - annotate - [select for diffs], Sun Jan 22 12:05:44 2023 UTC (16 months, 1 week ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.358: +3 -3 lines
Diff to previous 1.358 (colored)

Move SS_CANTRCVMORE and SS_RCVATMARK bits from `so_state' to `sb_state' of
receive buffer. As it was done for SS_CANTSENDMORE bit, the definition
kept as is, but now these bits belongs to the `sb_state' of receive
buffer. `sb_state' ored with `so_state' when socket data exporting to the
userland.

ok bluhm@

Revision 1.358 / (download) - annotate - [select for diffs], Mon Oct 17 14:49:02 2022 UTC (19 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.357: +1 -10 lines
Diff to previous 1.357 (colored)

Change pru_abort() return type to the type of void and make pru_abort()
optional.

We have no interest on pru_abort() return value. We call it only from
soabort() which is dummy pru_abort() wrapper and has no return value.

Only the connection oriented sockets need to implement (*pru_abort)()
handler. Such sockets are tcp(4) and unix(4) sockets, so remove existing
code for all others, it doesn't called.

ok guenther@

Revision 1.357 / (download) - annotate - [select for diffs], Mon Oct 3 16:43:52 2022 UTC (19 months, 4 weeks ago) by bluhm
Branch: MAIN
Changes since 1.356: +7 -4 lines
Diff to previous 1.356 (colored)

System calls should not fail due to temporary memory shortage in
malloc(9) or pool_get(9).
Pass down a wait flag to pru_attach().  During syscall socket(2)
it is ok to wait, this logic was missing for internet pcb.  Pfkey
and route sockets were already waiting.
sonewconn() must not wait when called during TCP 3-way handshake.
This logic has been preserved.  Unix domain stream socket connect(2)
can wait until the other side has created the socket to accept.
OK mvs@

Revision 1.356 / (download) - annotate - [select for diffs], Tue Sep 13 09:05:47 2022 UTC (20 months, 2 weeks ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.355: +3 -5 lines
Diff to previous 1.355 (colored)

Change pru_rcvd() return type to the type of void. We have no interest
on pru_rcvd() return value.

Drop "pru_rcvd != NULL" check within pru_rcvd() wrapper. We only call it
if the socket's protocol have PR_WANTRCVD flag set. Such sockets are
route domain, tcp(4) and unix(4) sockets.

ok guenther@ bluhm@

Revision 1.355 / (download) - annotate - [select for diffs], Thu Sep 8 10:22:06 2022 UTC (20 months, 3 weeks ago) by kn
Branch: MAIN
Changes since 1.354: +4 -4 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], Mon Sep 5 10:31:25 2022 UTC (20 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.353: +3 -1 lines
Diff to previous 1.353 (colored)

Add missing prototypes for route_attach() and route_detach().

Revision 1.353 / (download) - annotate - [select for diffs], Sat Sep 3 22:43:38 2022 UTC (20 months, 4 weeks ago) by mvs
Branch: MAIN
Changes since 1.352: +12 -43 lines
Diff to previous 1.352 (colored)

Move PRU_PEERADDR request to (*pru_peeraddr)().

Introduce in{,6}_peeraddr() and use them for inet and inet6 sockets,
except tcp(4) case.

Also remove *_usrreq() handlers.

ok bluhm@

Revision 1.352 / (download) - annotate - [select for diffs], Sat Sep 3 18:48:50 2022 UTC (20 months, 4 weeks ago) by mvs
Branch: MAIN
Changes since 1.351: +9 -4 lines
Diff to previous 1.351 (colored)

Move PRU_SOCKADDR request to (*pru_sockaddr)()

Introduce in{,6}_sockaddr() functions, and use them for all except tcp(4)
inet sockets. For tcp(4) sockets use tcp_sockaddr() to keep debug ability.

The key management and route domain sockets returns EINVAL error for
PRU_SOCKADDR request, so keep this behaviour for a while instead of make
pru_sockaddr handler optional and return EOPNOTSUPP.

ok bluhm@

Revision 1.351 / (download) - annotate - [select for diffs], Fri Sep 2 13:12:32 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.350: +1 -4 lines
Diff to previous 1.350 (colored)

Move PRU_CONTROL request to (*pru_control)().

The 'proc *' arg is not used for PRU_CONTROL request, so remove it from
pru_control() wrapper.

Split out {tcp,udp}6_usrreqs from {tcp,udp}_usrreqs and use them for
inet6 case.

ok guenther@ bluhm@

Revision 1.350 / (download) - annotate - [select for diffs], Thu Sep 1 18:21:23 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.349: +1 -6 lines
Diff to previous 1.349 (colored)

Move PRU_CONNECT2 request to (*pru_connect2)().

ok bluhm@

Revision 1.349 / (download) - annotate - [select for diffs], Wed Aug 31 21:23:02 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.348: +1 -4 lines
Diff to previous 1.348 (colored)

Move PRU_SENDOOB request to (*pru_sendoob)().

PRU_SENDOOB request always consumes passed `top' and `control' mbufs. To
avoid dummy m_freem(9) handlers for all protocols release passed mbufs
in the pru_sendoob() EOPNOTSUPP error path.

Also fix `control' mbuf(9) leak in the tcp(4) PRU_SENDOOB error path.

ok bluhm@

Revision 1.348 / (download) - annotate - [select for diffs], Mon Aug 29 08:08:17 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.347: +1 -2 lines
Diff to previous 1.347 (colored)

Move PRU_RCVOOB request to (*pru_rcvoob)().

ok bluhm@

Revision 1.347 / (download) - annotate - [select for diffs], Mon Aug 29 07:51:45 2022 UTC (21 months ago) by bluhm
Branch: MAIN
Changes since 1.346: +2 -3 lines
Diff to previous 1.346 (colored)

Use struct refcnt for interface address reference counting.
There was a crash due to use after free of the ifa although it is
ref counted.  As ifa_refcnt was a simple integer increment, there
may be a path where multiple CPUs access it concurrently.  So change
to struct refcnt which is MP safe and provides dt(4) leak debugging.
Link level address for IPsec enc(4) and various MPLS interfaces is
special.  There ifa is part of struct sc.  Use refcount anyway and
add a panic to detect use after free.
bug report stsp@; OK mvs@

Revision 1.346 / (download) - annotate - [select for diffs], Sun Aug 28 21:35:12 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.345: +1 -5 lines
Diff to previous 1.345 (colored)

Move PRU_SENSE request to (*pru_sense)().

ok bluhm@

Revision 1.345 / (download) - annotate - [select for diffs], Sun Aug 28 20:32:01 2022 UTC (21 months ago) by bluhm
Branch: MAIN
Changes since 1.344: +4 -7 lines
Diff to previous 1.344 (colored)

Since we have no raw_usrreq anymore, remove pr_output indirection.
pfkeyv2 and route can call their output functions directly.
OK mvs@

Revision 1.344 / (download) - annotate - [select for diffs], Sun Aug 28 18:44:16 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.343: +10 -4 lines
Diff to previous 1.343 (colored)

Move PRU_ABORT request to (*pru_abort)().

We abort only the sockets which are linked to `so_q' or `so_q0' queues of
listening socket. Such sockets have no corresponding file descriptor and
are not accessed from userland, so PRU_ABORT used to destroy them on
listening socket destruction.

Currently all our sockets support PRU_ABORT request, but actually it
required only for tcp(4) and unix(4) sockets, so i should be optional.
However, they will be removed with separate diff, and this time  PRU_ABORT
requests were converted as is.

Also, the socket should be destroyed on PRU_ABORT request, but route and
key management sockets leave it alive. This was also converted as is,
because this wrong code never called.

ok bluhm@

Revision 1.343 / (download) - annotate - [select for diffs], Sat Aug 27 20:28:01 2022 UTC (21 months ago) by mvs
Branch: MAIN
Changes since 1.342: +32 -9 lines
Diff to previous 1.342 (colored)

Move PRU_SEND request to (*pru_send)().

The former PRU_SEND error path of gre_usrreq() had `control' mbuf(9)
leak. It was fixed in new gre_send().

The former pfkeyv2_send() was renamed to pfkeyv2_dosend().

ok bluhm@

Revision 1.342 / (download) - annotate - [select for diffs], Fri Aug 26 16:17:39 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.341: +22 -12 lines
Diff to previous 1.341 (colored)

Move PRU_RCVD request to (*pru_rcvd)().

ok bluhm@

Revision 1.341 / (download) - annotate - [select for diffs], Mon Aug 22 21:18:48 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.340: +10 -4 lines
Diff to previous 1.340 (colored)

Move PRU_SHUTDOWN request to (*pru_shutdown)().

ok bluhm@

Revision 1.340 / (download) - annotate - [select for diffs], Mon Aug 22 13:23:07 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.339: +10 -2 lines
Diff to previous 1.339 (colored)

Move PRU_DISCONNECT request to (*pru_disconnect).

ok bluhm@

Revision 1.339 / (download) - annotate - [select for diffs], Mon Aug 22 08:08:46 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.338: +1 -2 lines
Diff to previous 1.338 (colored)

Move PRU_ACCEPT request to (*pru_accept)().

ok bluhm@

Revision 1.338 / (download) - annotate - [select for diffs], Sun Aug 21 22:45:55 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.337: +1 -2 lines
Diff to previous 1.337 (colored)

Move PRU_CONNECT request to (*pru_connect)() handler.

ok bluhm@

Revision 1.337 / (download) - annotate - [select for diffs], Sun Aug 21 17:30:21 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.336: +1 -2 lines
Diff to previous 1.336 (colored)

Move PRU_LISTEN request to (*pru_listen)() handler.

ok bluhm@

Revision 1.336 / (download) - annotate - [select for diffs], Sat Aug 20 23:48:58 2022 UTC (21 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.335: +1 -2 lines
Diff to previous 1.335 (colored)

Move PRU_BIND request to (*pru_bind)() handler.

For the protocols which don't support request, leave handler NULL. Do the
NULL check within corresponding pru_() wrapper and return EOPNOTSUPP in
such case. This will be done for all upcoming user request handlers.

ok bluhm@ guenther@

Revision 1.335 / (download) - annotate - [select for diffs], Mon Aug 15 09:11:38 2022 UTC (21 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.334: +8 -4 lines
Diff to previous 1.334 (colored)

Introduce 'pr_usrreqs' structure and move existing user-protocol
handlers into it. We want to split existing (*pr_usrreq)() to multiple
short handlers for each PRU_ request as it was already done for
PRU_ATTACH and PRU_DETACH. This is the preparation step, (*pr_usrreq)()
split will be done with the following diffs.

Based on reverted diff from guenther@.

ok bluhm@

Revision 1.334 / (download) - annotate - [select for diffs], Tue Jun 28 10:01:13 2022 UTC (23 months ago) by bluhm
Branch: MAIN
Changes since 1.333: +2 -2 lines
Diff to previous 1.333 (colored)

Use refcnt API for struct rtentry instead of hand-crafted atomic
operations.
OK mvs@

Revision 1.333 / (download) - annotate - [select for diffs], Mon Jun 27 21:26:46 2022 UTC (23 months ago) by claudio
Branch: MAIN
Changes since 1.332: +8 -5 lines
Diff to previous 1.332 (colored)

Rework the rttimer code. Instead of a global queue and a global timeout
use a per rttimer struct timeout. On enqueue the struct rttimer belongs
to the timeout, in case the route is removed before the timer fires
cleanup based on the timeout_del() return value. If the timeout currently
running then just clear the rtt_rt pointer and let the timeout handle the
cleanup. This should hopefully fix the icmp_pmtu_timeout crashes reported
by some people.
OK bluhm@

Revision 1.332 / (download) - annotate - [select for diffs], Mon Jun 27 17:15:35 2022 UTC (23 months ago) by bluhm
Branch: MAIN
Changes since 1.331: +7 -7 lines
Diff to previous 1.331 (colored)

Fix white space and wrap long lines.

Revision 1.331 / (download) - annotate - [select for diffs], Mon Jun 27 08:15:38 2022 UTC (23 months ago) by claudio
Branch: MAIN
Changes since 1.330: +18 -10 lines
Diff to previous 1.330 (colored)

Don't copy more than sa_len from the sockaddr to the sysctl / rt msg buffer.
In the rt msg buffer the size of the full buffer is calculated first then
filled out after allocating the mbuf. In the sysctl code this is not needed
since the buffer is already provided.
OK mvs@

Revision 1.330 / (download) - annotate - [select for diffs], Sun Jun 26 16:07:00 2022 UTC (23 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.329: +11 -11 lines
Diff to previous 1.329 (colored)

Switch walkargs for the buffer size to size_t and change the overflow
check to the less awkward w->w_needed <= w->w_given.
OK bluhm@

Revision 1.329 / (download) - annotate - [select for diffs], Thu Jun 16 10:35:45 2022 UTC (23 months, 2 weeks ago) by claudio
Branch: MAIN
Changes since 1.328: +2 -2 lines
Diff to previous 1.328 (colored)

Mark routes sent via sysctl(2) with RTF_DONE like it is done on the
route socket. All messages passed are by definition done. This may
allow to share more code between sysctl and route socket parsers.
OK mpi@

Revision 1.328 / (download) - annotate - [select for diffs], Mon Jun 6 14:45:41 2022 UTC (23 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.327: +7 -9 lines
Diff to previous 1.327 (colored)

Simplify solock() and sounlock(). There is no reason to return a value
for the lock operation and to pass a value to the unlock operation.
sofree() still needs an extra flag to know if sounlock() should be called
or not. But sofree() is called less often and mostly without keeping the lock.
OK mpi@ mvs@

Revision 1.327 / (download) - annotate - [select for diffs], Wed Mar 9 17:29:52 2022 UTC (2 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.326: +7 -4 lines
Diff to previous 1.326 (colored)

Change the logic around rounding up the needed memory for sysctls since
the network state can change between the two sysctl calls. Adding 10%
extra works for larger routing tables but can be too little on smaller
tables to hold even a single extra message. Instead of that add at least
1024 bytes or 10% (whichever is bigger) and round the size up to the next
page. With this there are no more sporadic errors in the bgpd integration
tests.
OK sthen@

Revision 1.326 / (download) - annotate - [select for diffs], Fri Feb 25 23:51:03 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.325: +6 -7 lines
Diff to previous 1.325 (colored)

Reported-by: syzbot+1b5b209ce506db4d411d@syzkaller.appspotmail.com
Revert the pr_usrreqs move: syzkaller found a NULL pointer deref
and I won't be available to monitor for followup issues for a bit

Revision 1.325 / (download) - annotate - [select for diffs], Fri Feb 25 08:36:01 2022 UTC (2 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.324: +7 -6 lines
Diff to previous 1.324 (colored)

Move pr_attach and pr_detach to a new structure pr_usrreqs that can
then be shared among protosw structures, following the same basic
direction as NetBSD and FreeBSD for this.

Split PRU_CONTROL out of pr_usrreq into pru_control, giving it the
proper prototype to eliminate the previously necessary casts.

ok mvs@ bluhm@

Revision 1.324 / (download) - annotate - [select for diffs], Thu Jan 20 11:06:57 2022 UTC (2 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.323: +5 -5 lines
Diff to previous 1.323 (colored)

Shifting signed integers left by 31 is undefined behavior in C.
found by kubsan; joint work with tobhe@; OK miod@

Revision 1.323 / (download) - annotate - [select for diffs], Thu Dec 16 09:33:56 2021 UTC (2 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.322: +2 -2 lines
Diff to previous 1.322 (colored)

When adding the extra 10% of space to a needed sysctl buffer use math
that is less likely to overflow the int type used. A BGP fullfeed is
now so big that this calculation overflowed and then got sign extended.
The result was for example 'route -n show' failures.
Problem identified with deraadt@
OK deraadt@ (more cleanup needed but this fix is a good start)

Revision 1.322 / (download) - annotate - [select for diffs], Tue Sep 14 09:15:55 2021 UTC (2 years, 8 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.321: +15 -4 lines
Diff to previous 1.321 (colored)

Add missing kernel lock for Bi-directional Forwarding Detection data.

Also bfdset() calls pool_get(9) with PR_WAITOK flag so it should be done
before we check the existence of this `bfd', otherwise it could be added
multiple times.

We have BFD disabled in the default kernel so this diff is for
consistency mostly.

ok mpi@

Revision 1.321 / (download) - annotate - [select for diffs], Tue Sep 7 16:07:46 2021 UTC (2 years, 8 months ago) by mvs
Branch: MAIN
Changes since 1.320: +9 -9 lines
Diff to previous 1.320 (colored)

Fix NULL pointer dereference introduced by previous commit.

Reported-by: syzbot+684597dbbb9b516e76ae@syzkaller.appspotmail.com

ok mpi@

Revision 1.320 / (download) - annotate - [select for diffs], Tue Sep 7 09:56:00 2021 UTC (2 years, 8 months ago) by mvs
Branch: MAIN
Changes since 1.319: +27 -13 lines
Diff to previous 1.319 (colored)

Fix the race between if_detach() and rtm_output().

When the dying network interface descriptor has if_get(9) obtained
reference owned by foreign thread, the if_detach() thread will sleep
just after it removed this interface from the interface index map.

The data related to this interface is still in routing table, so
if_get(9) called by concurrent rtm_output() thread will return NULL and
the following "ifp != NULL" assertion will be triggered.

So remove the "ifp != NULL" assertions from rtm_output() and try to grab
`ifp' as early as possible then hold it until we finish the work. In the
case we won the race and we have `ifp' non NULL, concurrent if_detach()
thread will wait us. In the case we lost we just return ESRCH.

The problem reported by danj@.
Diff tested by danj@.

ok mpi@

Revision 1.319 / (download) - annotate - [select for diffs], Wed Jun 23 16:10:45 2021 UTC (2 years, 11 months ago) by cheloha
Branch: MAIN
Changes since 1.318: +2 -3 lines
Diff to previous 1.318 (colored)

rtsock: revert from timeout_set_flags(9) to timeout_set_proc(9); ok mvs@

Revision 1.318 / (download) - annotate - [select for diffs], Tue Jun 1 14:23:34 2021 UTC (3 years ago) by mvs
Branch: MAIN
Changes since 1.317: +10 -1 lines
Diff to previous 1.317 (colored)

Check `so_state' in rtm_senddesync() and return if SS_ISCONNECTED or
SS_CANTRCVMORE bits are set.

The first check required to prevent timeout_add(9) reschedule
`rop_timeout', otherwise timeout_del_barrier(9) can't help us.

The second check is for the case when shutdown(2) with SHUT_RD argument
occurred on this socket and we should not receive anything include
RTM_DESYNC packets.

ok claudio@

Revision 1.317 / (download) - annotate - [select for diffs], Sun May 30 21:01:27 2021 UTC (3 years ago) by bluhm
Branch: MAIN
Changes since 1.316: +2 -2 lines
Diff to previous 1.316 (colored)

Declare all struct protosw as constant.
OK mvs@

Revision 1.316 / (download) - annotate - [select for diffs], Tue May 25 22:45:09 2021 UTC (3 years ago) by bluhm
Branch: MAIN
Changes since 1.315: +2 -4 lines
Diff to previous 1.315 (colored)

As network features are not added dynamically, the domain structures
are constant.  Having more const makes MP review easier.  More
pointers are mapped read-only in the kernel image.
OK deraadt@ mvs@

Revision 1.315 / (download) - annotate - [select for diffs], Mon May 17 17:58:35 2021 UTC (3 years ago) by claudio
Branch: MAIN
Changes since 1.314: +12 -68 lines
Diff to previous 1.314 (colored)

Revert. Last change should not have been committed.

Revision 1.314 / (download) - annotate - [select for diffs], Mon May 17 17:06:51 2021 UTC (3 years ago) by claudio
Branch: MAIN
Changes since 1.313: +69 -13 lines
Diff to previous 1.313 (colored)

Increase the default buffer space using on PF_UNIX sockets to 8k.
Additionally make the values tuneable via sysctl.
OK deraadt@ mvs@

Revision 1.313 / (download) - annotate - [select for diffs], Sun May 16 13:09:39 2021 UTC (3 years ago) by mvs
Branch: MAIN
Changes since 1.312: +2 -3 lines
Diff to previous 1.312 (colored)

In route detach we delete `rop_timeout' while `rop' is still linked to
`rtp_list' so it could be re-added by concurrent thread. Also
timeout_del(9) doesn't wait timeout proc to be finished and
timeout_del_barrier(9) should be used for that.

So use timeout_del_barrier(9) instead of timeout_del(9) and moved it
just after refcnt_finalize(9). This fixes potential use-after-free
issue in route_detach().

ok mpi@

Revision 1.312 / (download) - annotate - [select for diffs], Sat May 1 16:13:13 2021 UTC (3 years, 1 month ago) by mvs
Branch: MAIN
Changes since 1.311: +35 -16 lines
Diff to previous 1.311 (colored)

Implement per-socket `so_lock' rwlock(9) and use it to protect routing
(PF_ROUTE) sockets. This can be done because we have no cases where one
thread should lock two sockets simultaneously.

Against the previous version rtm_senddesync_timer() execution was moved
to process context.

Also this time `so_lock' used for routing sockets only but in the future
it will be used to other socket types too.

tested by claudio@

ok claudio@ bluhm@

Revision 1.311 / (download) - annotate - [select for diffs], Mon Apr 26 08:21:36 2021 UTC (3 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.310: +15 -33 lines
Diff to previous 1.310 (colored)

Revert per-socket `so_lock' rwlock(9) and use it to protect routing
(PF_ROUTE) sockets. There is a locking issue with timeouts that needs
to be fixed.
Requested by deraadt@

Revision 1.310 / (download) - annotate - [select for diffs], Sun Apr 25 00:00:35 2021 UTC (3 years, 1 month ago) by mvs
Branch: MAIN
Changes since 1.309: +33 -15 lines
Diff to previous 1.309 (colored)

Implement per-socket `so_lock' rwlock(9) and use it to protect routing
(PF_ROUTE) sockets. This can be done because we have no cases where one
thread should lock two sockets simultaneously.

Also this time `so_lock 'used for routing sockets only but in the future
it will be used to other socket types too.

ok bluhm@

Revision 1.309 / (download) - annotate - [select for diffs], Fri Mar 26 22:40:08 2021 UTC (3 years, 2 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.308: +10 -3 lines
Diff to previous 1.308 (colored)

Push kernel lock down to rt_setsource() to make `ifa' dereference safe.
Netlock doesn't make sense here because ifa_ifwithaddr() holds kernel
lock while performs lists walkthrough.

This was made to decrease the future diff for PF_ROUTE sockets
unlocking. This time kernel lock is still held while we perform
rt_setsource().

ok mpi@

Revision 1.308 / (download) - annotate - [select for diffs], Thu Mar 18 15:55:19 2021 UTC (3 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.307: +6 -3 lines
Diff to previous 1.307 (colored)

Like in the sysctl case include the ifp_sadl as RTA_IFP address in RTM_IFINFO
messages. This way userland can detect if the lladdr of an interface was
changed.
OK florian@ bluhm@

Revision 1.307 / (download) - annotate - [select for diffs], Sat Feb 27 11:44:48 2021 UTC (3 years, 3 months ago) by mvs
Branch: MAIN
Changes since 1.306: +12 -32 lines
Diff to previous 1.306 (colored)

Rework route_input() and rtm_sendup(). While we perform foreach loop
in route_input() we drop solock() after we checked socket state. We
pass mbuf(9) to this socket at next loops, while it referenced as
`last'. Socket's state could be changed by concurrent thread while
it's not locked.

Since we perform socket's checks and output in same iteration, the
logic which prevents mbuf(9) chain copy for the last socket in list
was removed.

ok bluhm@ claudio@

Revision 1.306 / (download) - annotate - [select for diffs], Thu Feb 25 02:48:21 2021 UTC (3 years, 3 months ago) by dlg
Branch: MAIN
Changes since 1.305: +2 -2 lines
Diff to previous 1.305 (colored)

we don't have to cast to caddr_t when calling m_copydata anymore.

the first cut of this diff was made with coccinelle using this spatch:

@rule@
type caddr_t;
expression m, off, len, cp;
@@
-m_copydata(m, off, len, (caddr_t)cp)
+m_copydata(m, off, len, cp)

i had fix it's opinionated idea of formatting by hand though, so
i'm not sure it was worth it.

ok deraadt@ bluhm@

Revision 1.305 / (download) - annotate - [select for diffs], Mon Feb 15 19:01:30 2021 UTC (3 years, 3 months ago) by mvs
Branch: MAIN
Changes since 1.304: +4 -10 lines
Diff to previous 1.304 (colored)

Simplify error path in in route_attach(). We always call it in thread
context so we always have `curproc' Also protocol control block is not
required for soreserve() so we can do it before `rop' allocation.

ok bluhm@

Revision 1.304 / (download) - annotate - [select for diffs], Sat Nov 7 09:51:40 2020 UTC (3 years, 6 months ago) by denis
Branch: MAIN
Changes since 1.303: +45 -2 lines
Diff to previous 1.303 (colored)

Rework source IP address setting.

- Move most of the processing out of rtable.c (reasonnable tb@, ok bluhm@)
- Remove memory allocation, store pointer to existing ifaddr
- Fix tunnel interface handling

looks fine mpi@

Revision 1.303 / (download) - annotate - [select for diffs], Thu Oct 29 21:15:27 2020 UTC (3 years, 7 months ago) by denis
Branch: MAIN
Changes since 1.302: +71 -8 lines
Diff to previous 1.302 (colored)

Add feature to force the selection of source IP address

Based/previous work on an idea from deraadt@
Input from claudio@, djm@, deraadt@, sthen@

OK deraadt@

Revision 1.302 / (download) - annotate - [select for diffs], Wed Sep 23 17:52:58 2020 UTC (3 years, 8 months ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.301: +2 -2 lines
Diff to previous 1.301 (colored)

Fix declaration of `routedomain'. It's not external here.

"Correct" by deraadt@

Revision 1.301 / (download) - annotate - [select for diffs], Tue Sep 22 19:25:27 2020 UTC (3 years, 8 months ago) by mvs
Branch: MAIN
Changes since 1.300: +13 -8 lines
Diff to previous 1.300 (colored)

Document locks which protect `rtpcb' struct members.

ok mpi@

Revision 1.300 / (download) - annotate - [select for diffs], Thu Aug 13 04:58:22 2020 UTC (3 years, 9 months ago) by jmatthew
Branch: MAIN
Changes since 1.299: +19 -4 lines
Diff to previous 1.299 (colored)

Add a ROUTE_FLAGFILTER socket option for routing sockets, allowing
filtering out messages for routes with flags matching any bit in a mask.
This allows routing daemons to opt out of receiving messages for L2 and
broadcast route entries, which they currently discard.

ok dlg@ sthen@ deraadt@

Revision 1.299 / (download) - annotate - [select for diffs], Wed Jun 24 22:03:42 2020 UTC (3 years, 11 months ago) by cheloha
Branch: MAIN
Changes since 1.298: +5 -5 lines
Diff to previous 1.298 (colored)

kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)

time_second(9) and time_uptime(9) are widely used in the kernel to
quickly get the system UTC or system uptime as a time_t.  However,
time_t is 64-bit everywhere, so it is not generally safe to use them
on 32-bit platforms: you have a split-read problem if your hardware
cannot perform atomic 64-bit reads.

This patch replaces time_second(9) with gettime(9), a safer successor
interface, throughout the kernel.  Similarly, time_uptime(9) is replaced
with getuptime(9).

There is a performance cost on 32-bit platforms in exchange for
eliminating the split-read problem: instead of two register reads you
now have a lockless read loop to pull the values from the timehands.
This is really not *too* bad in the grand scheme of things, but
compared to what we were doing before it is several times slower.

There is no performance cost on 64-bit (__LP64__) platforms.

With input from visa@, dlg@, and tedu@.

Several bugs squashed by visa@.

ok kettenis@

Revision 1.298 / (download) - annotate - [select for diffs], Tue Mar 24 13:50:18 2020 UTC (4 years, 2 months ago) by tobhe
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.297: +7 -9 lines
Diff to previous 1.297 (colored)

Remove redundant 'NULL' check for 'rtm'.

CID 1453252

ok claudio@ mpi@

Revision 1.297 / (download) - annotate - [select for diffs], Sun Nov 24 07:56:03 2019 UTC (4 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.296: +14 -1 lines
Diff to previous 1.296 (colored)

If the RTM_PROPOSAL is a solicitation proposal forward the request to
all interfaces. Most handlers will ignore it but at least umb(4) will
send a response back.
OK florian@

Revision 1.296 / (download) - annotate - [select for diffs], Fri Nov 22 15:28:05 2019 UTC (4 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.295: +3 -4 lines
Diff to previous 1.295 (colored)

The DNS proposal list can (soon) be empty to signal a withdraw, relax
the size constraint to allow this to pass through the kernel.
Looks good to deraadt@

Revision 1.295 / (download) - annotate - [select for diffs], Fri Nov 22 06:20:15 2019 UTC (4 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.294: +25 -1 lines
Diff to previous 1.294 (colored)

Add rtm_proposal, a function to send out RTM_PROPOSAL messages from the
kernel. Will be used to have umb(4) inform unwind(8) about DNS changes.
OK bluhm@ tested by florian@ and deraadt@

Revision 1.294 / (download) - annotate - [select for diffs], Wed Nov 6 15:18:53 2019 UTC (4 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.293: +2 -2 lines
Diff to previous 1.293 (colored)

Pull break into ifdef; noticed by bluhm who also OK'ed the previous
commit.

Revision 1.293 / (download) - annotate - [select for diffs], Wed Nov 6 14:51:22 2019 UTC (4 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.292: +32 -4 lines
Diff to previous 1.292 (colored)

Fix RTA_DNS checks:
Do not overwrite the address family, we need to know if this is IPv4
or IPv6 to parse the message.
Nameservers are IP addresses, not NUL-terminated strings.
Check that the length is a multiple of the length of an IP address.

OK krw

Revision 1.292 / (download) - annotate - [select for diffs], Mon Sep 23 11:00:42 2019 UTC (4 years, 8 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.291: +109 -1 lines
Diff to previous 1.291 (colored)

Do more sanity checks when accepting socket addresses in routing
messages from user land.  Inspect length field early in rtm_xaddrs().
Strings must be NUL terminated.  The socket address type and length
depend on the routing message type.  Currently checks are not super
strict to avoid too much user land fallout.
OK mpi@
Reported-by: syzbot+638dbf7851da8e255af5@syzkaller.appspotmail.com

Revision 1.291 / (download) - annotate - [select for diffs], Wed Aug 28 22:36:41 2019 UTC (4 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.290: +8 -12 lines
Diff to previous 1.290 (colored)

Fix white spaces and wrap long lines.

Revision 1.290 / (download) - annotate - [select for diffs], Wed Aug 28 20:54:24 2019 UTC (4 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.289: +104 -109 lines
Diff to previous 1.289 (colored)

In rev 1.273 RTM_LOCK has been removed from net/rtsock.c.  Since
then the big switch in rtm_output() has RTM_CHANGE as a unique case.
Remove redundant checks of rtm_type within this case.
OK kn@

Revision 1.289 / (download) - annotate - [select for diffs], Wed Jul 17 19:57:32 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.288: +8 -4 lines
Diff to previous 1.288 (colored)

Convert struct rtpcb malloc(9) to pool_get(9).  PCB for routing
socket is only used in process context, so pass PR_WAITOK to
pool_init(9).  The possible sleep in pool_put(9) should not hurt
as route_detach() is only called by soclose(9).  As both pr_attach()
and pr_detach() are always called with kernel lock, PR_RWLOCK is
not needed.
OK mpi@

Revision 1.288 / (download) - annotate - [select for diffs], Fri Jun 21 17:11:42 2019 UTC (4 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.287: +4 -3 lines
Diff to previous 1.287 (colored)

Prevent recursions by not deleting entries inside rtable_walk(9).

rtable_walk(9) now passes a routing entry back to the caller when
a non zero value is returned and if it asked for it.
This allows us to call rtdeletemsg()/rtrequest_delete() from the
caller without creating a recursion because of rtflushclone().

Multicast code hasn't been adapted and is still possibly creating
recursions.  However multicast route entries aren't cloned so if
a recursion exists it isn't because of rtflushclone().

Fix stack exhaustion triggered by the use of "-msave-args".

Issue reported by Dániel Lévai on bugs@ confirmed by and ok bluhm@.

Revision 1.287 / (download) - annotate - [select for diffs], Wed Jun 5 12:53:43 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.286: +3 -10 lines
Diff to previous 1.286 (colored)

Remove workaround and return EINVAL when userland sends routing messages
with bad address flags.
OK bluhm@ sthen@

Revision 1.286 / (download) - annotate - [select for diffs], Sat May 11 16:47:02 2019 UTC (5 years ago) by claudio
Branch: MAIN
Changes since 1.285: +8 -7 lines
Diff to previous 1.285 (colored)

Make rt_mpls_set() be more strict in what it accepts. Also ensure that
the RTF_MPLS can't be toggled without rt_mpls_set() being called. While
RTF_MPLS is part of RTF_FMASK it should be excluded from the flags and mask
when they are applied to the route since toggling it requires a call to
rt_mpls_set().
OK bluhm@

Reported-by: syzbot+86344a9e31c27aa6f15b@syzkaller.appspotmail.com

Revision 1.285 / (download) - annotate - [select for diffs], Fri Apr 5 12:58:34 2019 UTC (5 years, 1 month ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.284: +11 -4 lines
Diff to previous 1.284 (colored)

Broken userland software sets address bit in routing message without
providing a corresponding socket address.  A stricter kernel check
returns EINVAL and the software does not work anymore.  Relax the
check for OpenBSD 6.5 release so we have more time to find and fix
bugs in ports afterwards.  This is a temporary workaround.
analysis sthen@; OK claudio@ jca@

Revision 1.284 / (download) - annotate - [select for diffs], Sun Mar 31 15:34:02 2019 UTC (5 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.283: +28 -14 lines
Diff to previous 1.283 (colored)

Add a more strict rtm_hdrlen size check. Make sure that at least
struct rt_msghdr bytes are passed in. Also return a failure from
rtm_xaddrs() if rti_addrs has bad flags or run out of space.
Ok bluhm@

Reported-by: syzbot+18fd599cf8e14c507115@syzkaller.appspotmail.com

Revision 1.283 / (download) - annotate - [select for diffs], Fri Feb 8 16:52:54 2019 UTC (5 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.282: +3 -2 lines
Diff to previous 1.282 (colored)

Fix kernel info leak in routing message.
from NetBSD; OK deraadt@ visa@

Revision 1.282 / (download) - annotate - [select for diffs], Mon Feb 4 21:40:52 2019 UTC (5 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.281: +8 -7 lines
Diff to previous 1.281 (colored)

Avoid an mbuf double free in the oob soreceive() path.  In the
usrreq functions move the mbuf m_freem() logic to the release block
instead of distributing it over the switch statement.  Then the
goto release in the initial check, whether the pcb still exists,
will not free the mbuf for the PRU_RCVD, PRU_RVCOOB, PRU_SENSE
command.
OK claudio@ mpi@ visa@
Reported-by: syzbot+8e7997d4036ae523c79c@syzkaller.appspotmail.com

Revision 1.281 / (download) - annotate - [select for diffs], Thu Dec 20 10:27:37 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.280: +3 -3 lines
Diff to previous 1.280 (colored)

Convert to timeout_add_msec instead of counting ticks.
OK visa@ bluhm@ kn@

Revision 1.280 / (download) - annotate - [select for diffs], Mon Nov 12 16:36:54 2018 UTC (5 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.279: +28 -1 lines
Diff to previous 1.279 (colored)

Add new routing socket message RTM_80211INFO to provide details of
802.11 interface state changes (e.g. SSID) to interested parties.

Original diff from phessler@. Many suggestions and tweaks from
claudio@, stsp@, anton@.

ok claudio@ stsp@ anton@ phessler@

Revision 1.279 / (download) - annotate - [select for diffs], Tue Jul 10 20:28:34 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.278: +5 -3 lines
Diff to previous 1.278 (colored)

Remove net/raw_cb.h from includes and replace the RAWSNDQ, RAWRCVQ with
protocol specific ones.
OK mpi@

Revision 1.278 / (download) - annotate - [select for diffs], Tue Jul 10 10:02:14 2018 UTC (5 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.277: +2 -2 lines
Diff to previous 1.277 (colored)

After removing raw_usrreq() from route and pfkey, the global sockaddr
variables can be delared constant.
OK claudio@ mpi@

Revision 1.277 / (download) - annotate - [select for diffs], Mon Jul 9 16:49:36 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.276: +63 -17 lines
Diff to previous 1.276 (colored)

Inline the raw_usrreq() function into route_usrreq(). This simplifies the
route code since there is no more special wrapping needed and in some
places the PRU cases get easier because route(4) for example always connected.
OK bluhm@ henning@ mpi@

Revision 1.276 / (download) - annotate - [select for diffs], Thu Jul 5 21:48:32 2018 UTC (5 years, 10 months ago) by sthen
Branch: MAIN
Changes since 1.275: +2 -2 lines
Diff to previous 1.275 (colored)

fix comment: s/always send/always sent/

Revision 1.275 / (download) - annotate - [select for diffs], Thu Jul 5 13:48:06 2018 UTC (5 years, 10 months ago) by benno
Branch: MAIN
Changes since 1.274: +2 -1 lines
Diff to previous 1.274 (colored)

RTM_BFD route messages are also a special case. suggested by claudio@,
ok phessler@

Revision 1.274 / (download) - annotate - [select for diffs], Thu Jul 5 11:59:26 2018 UTC (5 years, 10 months ago) by benno
Branch: MAIN
Changes since 1.273: +4 -4 lines
Diff to previous 1.273 (colored)

not all route messages have a priority. Move the priority filter check
where it belongs.  Problem spotted by by remi@
ok sthen@ claudio@ krw@

Revision 1.273 / (download) - annotate - [select for diffs], Sun Jul 1 08:53:03 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.272: +1 -7 lines
Diff to previous 1.272 (colored)

Retire support for unused RTM_LOCK messages, it's redundant w/ RTM_CHANGE.

ok tb@, sthen@

Revision 1.272 / (download) - annotate - [select for diffs], Mon Jun 25 09:41:45 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.271: +10 -38 lines
Diff to previous 1.271 (colored)

Factorize MPLS setup/teardown into two functions.

ok claudio@

Revision 1.271 / (download) - annotate - [select for diffs], Mon Jun 25 09:39:16 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.270: +36 -11 lines
Diff to previous 1.270 (colored)

Push the NET_LOCK() down in rtm_output().

ok tb@, visa@

Revision 1.270 / (download) - annotate - [select for diffs], Mon Jun 11 09:05:05 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.269: +46 -46 lines
Diff to previous 1.269 (colored)

Rename routing & pfkey tables for coherency with other PCB tables.

ok claudio@

Revision 1.269 / (download) - annotate - [select for diffs], Mon Jun 11 08:48:54 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.268: +50 -24 lines
Diff to previous 1.268 (colored)

Push the KERNEL_LOCK() inside route_input().

ok visa@, tb@

Revision 1.268 / (download) - annotate - [select for diffs], Wed Jun 6 07:12:52 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.267: +38 -37 lines
Diff to previous 1.267 (colored)

Prefix fields of pfkey & routing PCBs, part 2, no functionnal change.

ok tb@

Revision 1.267 / (download) - annotate - [select for diffs], Wed Jun 6 07:10:12 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.266: +26 -26 lines
Diff to previous 1.266 (colored)

Prefix fields of pfkey & routing PCBs, no functionnal change.

ok visa@, tb@

Revision 1.266 / (download) - annotate - [select for diffs], Wed Jun 6 06:47:01 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.265: +2 -2 lines
Diff to previous 1.265 (colored)

Asseert that a pfkey or routing socket is referenced by a `fp' instead
of calling sofree(), when its PCB is detached.

This is different from TCP which does not always detach `inpcb's from
sockets.  In the pfkey & routing case caling sofree() there is a noop
whereas for TCP it's needed to free closed connections.

Having fewer sofree() makes it easier to understand the code and move
the locks down.

ok visa@

Revision 1.265 / (download) - annotate - [select for diffs], Mon May 14 07:33:59 2018 UTC (6 years ago) by mpi
Branch: MAIN
Changes since 1.264: +8 -11 lines
Diff to previous 1.264 (colored)

Use a SRP list to protect pfkeyv2 sockets, thus removing the need to
grab the KERNEL_LOCK() when delivering messages.

This is the same solution already used by routing sockets.

ok claudio@, visa@

Revision 1.264 / (download) - annotate - [select for diffs], Tue May 8 14:10:43 2018 UTC (6 years ago) by mpi
Branch: MAIN
Changes since 1.263: +34 -33 lines
Diff to previous 1.263 (colored)

Introduce rtm_sendup() a function to deliver routing messages to a
socket receive buffer.

It is modelled after pfkey_sendup() as both will need the same MP
treatment.

ok tb@, bluhm@, visa@

Revision 1.263 / (download) - annotate - [select for diffs], Tue Apr 24 06:19:47 2018 UTC (6 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.262: +2 -2 lines
Diff to previous 1.262 (colored)

Remove unused rtentry parameter.
Input bluhm
OK benno, kn, claudio

Revision 1.262 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:52 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.261: +2 -2 lines
Diff to previous 1.261 (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.261 / (download) - annotate - [select for diffs], Sun Feb 11 02:26:55 2018 UTC (6 years, 3 months ago) by benno
Branch: MAIN
Changes since 1.260: +20 -2 lines
Diff to previous 1.260 (colored)

Add a ROUTE_PRIOFILTER socket option for roueing sockets that
allows filtering on the priority of the route. All routes up to
the specified value will be passed.
ok claudio, ok henning previous version, feedback and manpage from
sthen.

Revision 1.260 / (download) - annotate - [select for diffs], Thu Feb 8 22:24:41 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.259: +65 -56 lines
Diff to previous 1.259 (colored)

Make the routing socket more MP save by using a SRPL list for the pcb list.
Still needs the big kernel lock but this is another step in the right direction.
With and OK mpi@

Revision 1.259 / (download) - annotate - [select for diffs], Mon Dec 18 09:40:17 2017 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.258: +14 -15 lines
Diff to previous 1.258 (colored)

Size for free(9).

From <kshe59 at zoho.eu>

Revision 1.258 / (download) - annotate - [select for diffs], Wed Dec 13 08:59:02 2017 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.257: +5 -5 lines
Diff to previous 1.257 (colored)

Spacing from kshe59@zoho.eu.

Revision 1.257 / (download) - annotate - [select for diffs], Wed Dec 13 08:54:59 2017 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.256: +8 -7 lines
Diff to previous 1.256 (colored)

Sizes for free in route_output().

From kshe59@zoho.eu.

Revision 1.256 / (download) - annotate - [select for diffs], Sun Dec 10 11:25:18 2017 UTC (6 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.255: +3 -9 lines
Diff to previous 1.255 (colored)

Remove outdated comment and trailing spaces.

From kshe59@zoho.eu

Revision 1.255 / (download) - annotate - [select for diffs], Fri Nov 3 16:23:20 2017 UTC (6 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.254: +2 -2 lines
Diff to previous 1.254 (colored)

After inlining of raw_detach we know the sizes for free; pointed out
by & OK mpi, input & OK visa

Revision 1.254 / (download) - annotate - [select for diffs], Fri Nov 3 14:10:33 2017 UTC (6 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.253: +2 -7 lines
Diff to previous 1.253 (colored)

use rop->rcb similar like in pfkeyv2_detach(); suggested by visa

Revision 1.253 / (download) - annotate - [select for diffs], Fri Nov 3 13:01:20 2017 UTC (6 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.252: +18 -4 lines
Diff to previous 1.252 (colored)

Inline trivial functions from raw_cb.c and tedu it.
Suggested by and OK mpi, OK visa

Revision 1.252 / (download) - annotate - [select for diffs], Thu Nov 2 14:01:18 2017 UTC (6 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.251: +29 -16 lines
Diff to previous 1.251 (colored)

Move PRU_DETACH out of pr_usrreq into per proto pr_detach
functions to pave way for more fine grained locking.

Suggested by, comments & OK mpi

Revision 1.251 / (download) - annotate - [select for diffs], Mon Oct 9 08:35:38 2017 UTC (6 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.250: +7 -3 lines
Diff to previous 1.250 (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.250 / (download) - annotate - [select for diffs], Tue Sep 5 07:59:11 2017 UTC (6 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.249: +3 -1 lines
Diff to previous 1.249 (colored)

Replace NET_ASSERT_LOCKED() by soassertlocked() in *_usrreq().

Not all of them need the NET_LOCK().

ok bluhm@

Revision 1.249 / (download) - annotate - [select for diffs], Fri Sep 1 15:05:31 2017 UTC (6 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.248: +3 -8 lines
Diff to previous 1.248 (colored)

Change sosetopt() to no longer free the mbuf it receives and change
all the callers to call m_freem(9).

Support from deraadt@ and tedu@, ok visa@, bluhm@

Revision 1.248 / (download) - annotate - [select for diffs], Fri Aug 11 21:24:19 2017 UTC (6 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.247: +3 -4 lines
Diff to previous 1.247 (colored)

Remove NET_LOCK()'s argument.

Tested by Hrvoje Popovski, ok bluhm@

Revision 1.247 / (download) - annotate - [select for diffs], Thu Aug 10 13:00:30 2017 UTC (6 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.246: +10 -1 lines
Diff to previous 1.246 (colored)

Prevent userland to modify RTF_LOCAL route entries.

In particular setting an expiration timer on a route entry which would
confuse L2 state machines.

ok bluhm@

Revision 1.246 / (download) - annotate - [select for diffs], Wed Aug 2 07:42:11 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.245: +11 -1 lines
Diff to previous 1.245 (colored)

Move a sanity check that only makes sense for userland where it belongs.

ok bluhm@, florian@

Revision 1.245 / (download) - annotate - [select for diffs], Sun Jul 30 18:18:08 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.244: +1 -7 lines
Diff to previous 1.244 (colored)

Enable mpath support in the Allotment Routing Table (ART) on the ramdisk.
OK mpi

Revision 1.244 / (download) - annotate - [select for diffs], Sun Jul 30 18:16:14 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.243: +1 -3 lines
Diff to previous 1.243 (colored)

Switch installer to Allotment Routing Table (ART).
Prompted by a bugreport by naddy that IPv6 autoconfiguration is broken
in the installer.
OK mpi, "go for it" deraadt

Revision 1.243 / (download) - annotate - [select for diffs], Fri Jul 28 09:01:09 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.242: +3 -3 lines
Diff to previous 1.242 (colored)

Add an error argument to rtm_send() instead of rerolling it inside
rtdeletemsg().

ok bluhm@

Revision 1.242 / (download) - annotate - [select for diffs], Wed Jul 26 20:32:58 2017 UTC (6 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.241: +2 -2 lines
Diff to previous 1.241 (colored)

Fix typo in comment, ok deraadt@

Revision 1.241 / (download) - annotate - [select for diffs], Mon Jul 24 09:20:32 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.240: +123 -2 lines
Diff to previous 1.240 (colored)

rt_getifa() is only needed for routing commands submited by userland.

So rename it to rtm_getifa(), move it where it belongs and stop calling
it from rtrequest(9).  Route entries created by the kernel must always
specify the corresponding `ifa'.

ok claudio@

Revision 1.240 / (download) - annotate - [select for diffs], Mon Jul 3 19:23:47 2017 UTC (6 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.239: +58 -55 lines
Diff to previous 1.239 (colored)

Both PF_ROUTE and PF_KEY need to start to take care of their own PCB list
to simplify the locking of those lists. For now move the LIST_ENTRY from
rawcb into routecb and in the pfkey case a new keycb. Do some cleanup and
renaming in the pfkey code but more to come.
OK bluhm@ mpi@

Revision 1.239 / (download) - annotate - [select for diffs], Mon Jun 26 09:32:32 2017 UTC (6 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.238: +8 -7 lines
Diff to previous 1.238 (colored)

Assert that the corresponding socket is locked when manipulating socket
buffers.

This is one step towards unlocking TCP input path.  Note that all the
functions asserting for the socket lock are not necessarilly MP-safe.
All the fields of 'struct socket' aren't protected.

Introduce a new kernel-only kqueue hint, NOTE_SUBMIT, to be able to
tell when a filter needs to lock the underlying data structures.  Logic
and name taken from NetBSD.

Tested by Hrvoje Popovski.

ok claudio@, bluhm@, mikeb@

Revision 1.238 / (download) - annotate - [select for diffs], Fri Jun 9 12:56:43 2017 UTC (6 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.237: +15 -10 lines
Diff to previous 1.237 (colored)

Replace rtrequest(RTM_DELETE...) rtrequest_delete() and do not even
try to remove a route from the table if it is and invalid cache.

This is a step towards decoupling code dealing with userland and kernel
inserted routes.

ok bluhm@

Revision 1.237 / (download) - annotate - [select for diffs], Wed Apr 19 15:21:54 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.236: +3 -3 lines
Diff to previous 1.236 (colored)

Use the rt_rmx defines that hide the struct rt_kmetrics indirection.
No binary change.
OK mpi@

Revision 1.236 / (download) - annotate - [select for diffs], Wed Apr 5 13:35:18 2017 UTC (7 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.235: +3 -2 lines
Diff to previous 1.235 (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.235 / (download) - annotate - [select for diffs], Thu Mar 16 10:13:11 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.234: +17 -5 lines
Diff to previous 1.234 (colored)

Do not allow to change the gateway of an existing entry if the AF
family is incorrect.

Prevent bgpd(8) to corrupt ARP entries as reported by Joe Holden.

ok benno@, claudio@

Revision 1.234 / (download) - annotate - [select for diffs], Mon Mar 13 20:18:21 2017 UTC (7 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.233: +47 -41 lines
Diff to previous 1.233 (colored)

Move PRU_ATTACH out of the pr_usrreq functions into pr_attach.
Attach is quite a different thing to the other PRU functions and
this should make locking a bit simpler. This also removes the ugly
hack on how proto was passed to the attach function.
OK bluhm@ and mpi@ on a previous version

Revision 1.233 / (download) - annotate - [select for diffs], Thu Mar 9 16:53:20 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.232: +2 -10 lines
Diff to previous 1.232 (colored)

Remove unecessary splsoftnet()/splx() dances.

ok bluhm@, claudio@

Revision 1.232 / (download) - annotate - [select for diffs], Tue Mar 7 09:23:27 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.231: +11 -3 lines
Diff to previous 1.231 (colored)

Do not grab the NET_LOCK() for routing sockets operations.

The only function that need the lock is rtm_output() as it messes with
the routing table.  So grab the lock there since it is safe to sleep
in a process context.

ok bluhm@

Revision 1.231 / (download) - annotate - [select for diffs], Tue Mar 7 06:58:55 2017 UTC (7 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.230: +14 -15 lines
Diff to previous 1.230 (colored)

Since route_input is no longer part of the protosw struct it is possible to
pass the socket to it and do the SO_USELOOPBACK check there. This removes
a the nasty hack in the output function where the sp_family is set to 0
temporarily.
OK bluhm@ mpi@

Revision 1.230 / (download) - annotate - [select for diffs], Mon Mar 6 10:19:17 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.229: +106 -107 lines
Diff to previous 1.229 (colored)

Move the guts of route_output() meesing with the routing table in their
own function.

ok bluhm@

Revision 1.229 / (download) - annotate - [select for diffs], Mon Mar 6 08:56:39 2017 UTC (7 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.228: +71 -45 lines
Diff to previous 1.228 (colored)

Prefix functions dealing with routing messages with 'rtm_' and keep
them all in net/rtsock.c.

This allows to easily spot which functions are doing a copyout(9)
when dealing with the routing midlayer.

ok phessler@, bluhm@, dhill@, krw@, claudio@

Revision 1.228 / (download) - annotate - [select for diffs], Fri Mar 3 15:48:02 2017 UTC (7 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.227: +3 -8 lines
Diff to previous 1.227 (colored)

Convert the variable argument list of the pr_output functions to
fixed parameters.
OK mpi@ claudio@ dhill@

Revision 1.227 / (download) - annotate - [select for diffs], Fri Mar 3 14:22:40 2017 UTC (7 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.226: +5 -19 lines
Diff to previous 1.226 (colored)

It is allowed to sleep in route_output() as we run in process context
and do no critical operations on global structures or per socket.
The route entry we are working on is reference counted.  Call
malloc(9) with M_WAITOK and remove the NULL result checks.
OK mpi@

Revision 1.226 / (download) - annotate - [select for diffs], Thu Mar 2 17:09:21 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.225: +104 -3 lines
Diff to previous 1.225 (colored)

Implement a new routing message RTM_PROPOSAL that communicates
information that can be used to configure an interface and
related network components.

ok bluhm@, ok for various older versions mpi@ florian@ claudio@

Revision 1.225 / (download) - annotate - [select for diffs], Thu Mar 2 09:37:04 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.224: +7 -12 lines
Diff to previous 1.224 (colored)

Fix a rtentry leak in error path.

ok bluhm@

Revision 1.224 / (download) - annotate - [select for diffs], Thu Mar 2 08:58:24 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.223: +8 -4 lines
Diff to previous 1.223 (colored)

Convert domain declarations to C99 initializers.

ok dhill@, florian@, bluhm@

Revision 1.223 / (download) - annotate - [select for diffs], Wed Feb 22 19:34:42 2017 UTC (7 years, 3 months ago) by dhill
Branch: MAIN
Changes since 1.222: +10 -6 lines
Diff to previous 1.222 (colored)

Use c99 struct initialization with protosw.

This makes it easier to grep for a member, such as .pr_usrreq, and know
which functions to review.

ok mpi@ bluhm@ jca@

Revision 1.222 / (download) - annotate - [select for diffs], Wed Feb 1 20:59:47 2017 UTC (7 years, 4 months ago) by dhill
Branch: MAIN
Changes since 1.221: +5 -8 lines
Diff to previous 1.221 (colored)

In sogetopt, preallocate an mbuf to avoid using sleeping mallocs with
the netlock held.  This also changes the prototypes of the *ctloutput
functions to take an mbuf instead of an mbuf pointer.

help, guidance from bluhm@ and mpi@
ok bluhm@

Revision 1.221 / (download) - annotate - [select for diffs], Tue Jan 31 10:24:41 2017 UTC (7 years, 4 months ago) by jca
Branch: MAIN
Changes since 1.220: +2 -2 lines
Diff to previous 1.220 (colored)

Use CTASSERT instead of KASSERT for a few sysctl that use the counters API

ok dlg@ mpi@

Revision 1.220 / (download) - annotate - [select for diffs], Tue Jan 24 00:17:14 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.219: +114 -97 lines
Diff to previous 1.219 (colored)

Introduce rt_report() a function that generates a route message from an
rt_entry. Use this function in the success case of all route commands.
Reduce the goto madness in route_output and make the code hopefully a
bit easier to read and work with.
OK mpi@ bluhm@

Revision 1.219 / (download) - annotate - [select for diffs], Mon Jan 23 07:27:21 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.218: +3 -3 lines
Diff to previous 1.218 (colored)

i botched the copyout to ifr->ifr_data in SIOCGIFDATA.

this lets pflogd run again.

rename if_data() to if_getdata() while here to make grepping for
things less noisy.

reported by jsg@
worked through with deraadt@

Revision 1.218 / (download) - annotate - [select for diffs], Mon Jan 23 01:26:09 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.217: +3 -3 lines
Diff to previous 1.217 (colored)

merge the ifnet and ifqueue stats together when userland wants them.

a new if_data() function takes a pointer to ifnet and merges its
if_data and ifq statistics. it takes the ifq mutex around the reads
of the ifq stats so they get a consistent copy.

the ifnet and ifq stats are merged because some parts of the stack
still update the ifnet counters.

ok visa@ (on an earlier diff) mpi@ claudio@

Revision 1.217 / (download) - annotate - [select for diffs], Mon Jan 23 00:10:07 2017 UTC (7 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.216: +22 -22 lines
Diff to previous 1.216 (colored)

Zap some bad whitespace.

Revision 1.216 / (download) - annotate - [select for diffs], Sun Jan 22 04:31:02 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.215: +9 -19 lines
Diff to previous 1.215 (colored)

Cleanup error handling. Do not use 'goto flush' early on since the message
is actually not syntactically valid, call 'goto fail' instead.
Remove unneeded rtable_exists() exists checks since those have been done
early on.
OK mpi@

Revision 1.215 / (download) - annotate - [select for diffs], Sat Jan 21 03:44:46 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.214: +24 -38 lines
Diff to previous 1.214 (colored)

Change route_input to a non-variadic function and just pass the address
family to it. Simplifies the code and disconnects route_input from protosw.
The rouing socket is special so no need to try to work like other protos.
With input from bluhm@, OK mpi@

Revision 1.214 / (download) - annotate - [select for diffs], Fri Jan 20 08:10:54 2017 UTC (7 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.213: +22 -4 lines
Diff to previous 1.213 (colored)

use per-cpu counters for rtstat.

ok mpi@

Revision 1.213 / (download) - annotate - [select for diffs], Thu Jan 19 23:18:29 2017 UTC (7 years, 4 months ago) by phessler
Branch: MAIN
Changes since 1.212: +20 -19 lines
Diff to previous 1.212 (colored)

add hooks so we can query the current state of a BFD session

bfd session details are visible with "route -n get 192.0.2.1 -bfd"

OK mpi@ deraadt@ claudio@

Revision 1.212 / (download) - annotate - [select for diffs], Tue Dec 20 18:33:43 2016 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.211: +5 -9 lines
Diff to previous 1.211 (colored)

A NET_LOCK() was is missing in tcp_sysctl() which shows up as spl
softnet assert failures.  It is better to place the lock into
net_sysctl() where all the protocol sysctls are called via pr_sysctl.
As calling sysctl(2) is in the slow path, doing fine grained locking
has no benefit.  Many sysctl cases copy out a struct.  Having a
lock around that keeps the struct consistent.  Put assertions in
the protocol sysctls that need it.
OK mpi@

Revision 1.211 / (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.210: +2 -2 lines
Diff to previous 1.210 (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.210 / (download) - annotate - [select for diffs], Tue Nov 29 10:22:30 2016 UTC (7 years, 6 months ago) by jsg
Branch: MAIN
Changes since 1.209: +2 -3 lines
Diff to previous 1.209 (colored)

m_free() and m_freem() test for NULL.  Simplify callers which had their own
NULL tests.

ok mpi@

Revision 1.209 / (download) - annotate - [select for diffs], Mon Nov 21 09:09:06 2016 UTC (7 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.208: +4 -5 lines
Diff to previous 1.208 (colored)

Enforce that pr_usrreq functions are called at IPL_SOFTNET.

This will allow us to keep locking simple as soon as we trade
splsoftnet() for a rwlock.

ok bluhm@, claudio@

Revision 1.208 / (download) - annotate - [select for diffs], Tue Oct 18 11:05:45 2016 UTC (7 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.207: +6 -2 lines
Diff to previous 1.207 (colored)

Place splsoftnet() in route_input() to shut up splassert warnings
in sorwakeup().
Report from egorenar-dev at posteo.net; OK henning@

Revision 1.207 / (download) - annotate - [select for diffs], Tue Sep 27 18:41:11 2016 UTC (7 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.206: +20 -14 lines
Diff to previous 1.206 (colored)

Protect sbappendaddr() and sorwakeup() with splsoftnet in
rt_senddesync().  This fixes a splassert warning seen by sthen@.
Problem found by David Hill; OK sthen@

Revision 1.206 / (download) - annotate - [select for diffs], Sat Sep 24 19:27:10 2016 UTC (7 years, 8 months ago) by phessler
Branch: MAIN
Changes since 1.205: +52 -1 lines
Diff to previous 1.205 (colored)

a route message for BFD, so we can notify userland about the status.
currently used on state-transitions.

OK mpi@

Revision 1.205 / (download) - annotate - [select for diffs], Sat Sep 17 07:35:05 2016 UTC (7 years, 8 months ago) by phessler
Branch: MAIN
Changes since 1.204: +3 -3 lines
Diff to previous 1.204 (colored)

*** empty log message ***

Revision 1.204 / (download) - annotate - [select for diffs], Wed Sep 7 09:36:49 2016 UTC (7 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.203: +4 -4 lines
Diff to previous 1.203 (colored)

Rename rtable_mpath_next() into rtable_iterate() and make it do a proper
reference count.

rtable_iterate() frees the passed ``rt'' and returns the next one on the
multipath list or NULL if there's none.

ok dlg@

Revision 1.203 / (download) - annotate - [select for diffs], Mon Sep 5 15:12:30 2016 UTC (7 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.202: +2 -2 lines
Diff to previous 1.202 (colored)

Kill raw_ctlinput() this function is INCOMPLETE since rev 1.1 and is not
needed. All callers using the protosw pr_ctlinput pointer do a NULL check
before so there is no need to provide the function.

Revision 1.202 / (download) - annotate - [select for diffs], Sun Sep 4 09:39:01 2016 UTC (7 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.201: +15 -2 lines
Diff to previous 1.201 (colored)

Make it possible to toggle RTF_BFD via RTM_CHANGE and fix some minor things
in bfd.c. Make bfd_rtfree() a void function.
OK phessler@

Revision 1.201 / (download) - annotate - [select for diffs], Thu Sep 1 17:00:38 2016 UTC (7 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.200: +4 -5 lines
Diff to previous 1.200 (colored)

No longer needed to special case RTM_GET in these if statements since
RTM_GET is no longer sharing this case block.

Revision 1.200 / (download) - annotate - [select for diffs], Thu Sep 1 16:53:38 2016 UTC (7 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.199: +69 -59 lines
Diff to previous 1.199 (colored)

Move RTM_GET into its own case block not intermixing it with RTM_CHANGE
and RTM_LOCK. This is start for more changes here. OK mpi@

Revision 1.199 / (download) - annotate - [select for diffs], Thu Sep 1 11:26:44 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.198: +12 -1 lines
Diff to previous 1.198 (colored)

Move the RTF_LOCAL check that only makes sense for userland to
route_output().

ok claudio@

Revision 1.198 / (download) - annotate - [select for diffs], Thu Sep 1 09:35:28 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.197: +2 -2 lines
Diff to previous 1.197 (colored)

Use rtable_match() rather than rtalloc() when looking for an existing
entry in RTM_ADD.

rtable_match() does not modify the 'Use' counter of the route and unbreak
regression tests.

Breakage reported by bluhm@

Revision 1.197 / (download) - annotate - [select for diffs], Thu Sep 1 09:22:58 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.196: +9 -2 lines
Diff to previous 1.196 (colored)

RTM_CHANGE should not allow to change the gateway of a mpath route.

Fix rttest13.

ok claudio@

Revision 1.196 / (download) - annotate - [select for diffs], Tue Aug 23 13:07:26 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.195: +30 -16 lines
Diff to previous 1.195 (colored)

Update the L2 content of a RTF_CACHED entry instead of going though
a create/delete/insert cycle as such entry cannot be deleted when
referenced.

Regression reported by and ok bluhm@

Revision 1.195 / (download) - annotate - [select for diffs], Mon Aug 22 16:01:52 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.194: +46 -8 lines
Diff to previous 1.194 (colored)

Make the ``rt_gwroute'' pointer of RTF_GATEWAY entries immutable.

This means that no protection is needed to guarantee that the next hop
route wont be modified by CPU1 while CPU0 is dereferencing it in a L2
resolution functions.

While here also fix an ``ifa'' leak resulting in RTF_GATEWAY being always
invalid.

dlg@ likes it, inputs and ok bluhm@

Revision 1.194 / (download) - annotate - [select for diffs], Mon Jul 11 13:06:31 2016 UTC (7 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.193: +3 -2 lines
Diff to previous 1.193 (colored)

Path MTU discovery was slightly broken.  I took two ICMP packets
to create and change the dynamic route.  This behavior was introduced
in net/route.c rev 1.269 when the gateway route allocation was moved
from rt_setgateway() to _rtalloc().  So rtrequest(RTM_ADD) could
return a route without a valid gateway route.  To fix this, call
rt_setgwroute() from _rtalloc() and rt_setgateway().
OK mpi@

Revision 1.193 / (download) - annotate - [select for diffs], Mon Jul 11 09:23:06 2016 UTC (7 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.192: +3 -3 lines
Diff to previous 1.192 (colored)

Revert the introduction of ``rt_addr''.

Being able to add route entries without configured addresses is a nice
feature but this is not my fight.  So I'd rather no add another pointer
to ``struct rtentry'' if I'm not removing another one.

Revision 1.192 / (download) - annotate - [select for diffs], Tue Jun 14 09:48:52 2016 UTC (7 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.191: +2 -3 lines
Diff to previous 1.191 (colored)

Pass the configured ``ifa'' to rt_sendaddrmsg() instead of getting it via
``rt->rt_ifa'' later.

Revision 1.191 / (download) - annotate - [select for diffs], Tue Jun 14 09:44:41 2016 UTC (7 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.190: +3 -3 lines
Diff to previous 1.190 (colored)

Store the source address associated with a route in its own chunk of
memory.

This will allow to unlink 'sruct rtentry' and 'struct ifaddr' to be able
to add route entries without needing an address.

ok sthen@, visa@, florian@

Revision 1.190 / (download) - annotate - [select for diffs], Fri Jun 3 02:56:59 2016 UTC (8 years ago) by dlg
Branch: MAIN
Changes since 1.189: +24 -6 lines
Diff to previous 1.189 (colored)

set rt_expire times against time_uptime, not time_second.

time_second is unix time so it can be affected by clock changes.
time_uptime is monotonic so it isnt affected by clock changes. that
in turn means route expiries wont jump with clock changes if set
against time_uptime.

the expiry is translated into unix time for export to userland though.

ok mpi@

Revision 1.189 / (download) - annotate - [select for diffs], Wed Jun 1 12:06:49 2016 UTC (8 years ago) by mpi
Branch: MAIN
Changes since 1.188: +1 -4 lines
Diff to previous 1.188 (colored)

Remove ART-specific hack now that route reference counts is similar
to the original BSD routing table.

All route(8) and arp(8) tests still pass.

Fix a harmless underflow reported by Hrvoje Popovski.

Revision 1.188 / (download) - annotate - [select for diffs], Wed Mar 30 10:13:14 2016 UTC (8 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.187: +45 -1 lines
Diff to previous 1.187 (colored)

Implement proxy ARP for ART based on mpath support.

Since mpath is not enabled in RAMDISK, proxy ARP won't work there either.

ok bluhm@

Revision 1.187 / (download) - annotate - [select for diffs], Sat Mar 26 21:56:04 2016 UTC (8 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.186: +4 -3 lines
Diff to previous 1.186 (colored)

Always include the route priority in routing messages.

From Florian Riehm, ok bluhm@

Revision 1.186 / (download) - annotate - [select for diffs], Tue Jan 12 09:27:46 2016 UTC (8 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.185: +9 -11 lines
Diff to previous 1.185 (colored)

Compare if the prefix lengths are equal rather than checking if the
netmasks are non-NULL for RTM_CHANGE and RTM_LOCK.

Fix route(8) regressions tests 14 and 16 with ART kernels.  These tests
were failing because with ART, RTF_HOST routes always have a mask.

ok claudio@, bluhm@

Revision 1.185 / (download) - annotate - [select for diffs], Thu Dec 3 21:57:59 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.184: +10 -5 lines
Diff to previous 1.184 (colored)

Get rid of rt_mask() and stop allocating a "struct sockaddr" for every
route entry in ART.

rt_plen() now represents the prefix length of a route entry and should
be used instead.

For now use a "struct sockaddr_in6" to represent the mask when needed,
this should be then replaced by the prefix length and RTA_NETMASK only
used for compatibility with userland.

ok claudio@

Revision 1.184 / (download) - annotate - [select for diffs], Thu Dec 3 14:19:55 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.183: +2 -2 lines
Diff to previous 1.183 (colored)

Store an interface index instead of a pointer in the "struct rtentry".

These indexes are unique and should be used with if_get() to get a
pointer to the corresponding ``ifp''.  Such pointer is guaranteed to
be valid in a MP environment until if_put() is called.

ok claudio@, sthen@

Revision 1.183 / (download) - annotate - [select for diffs], Wed Nov 18 14:13:52 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.182: +15 -8 lines
Diff to previous 1.182 (colored)

Do not dereference rt_ifp to call if_rtrequest.

This only happens under KERNEL_LOCK() so we know for sure that the
interface attached to a route entry is valid.

Revision 1.182 / (download) - annotate - [select for diffs], Mon Nov 9 10:26:26 2015 UTC (8 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.181: +3 -4 lines
Diff to previous 1.181 (colored)

Rewrite rtalloc(9) to consider RTF_GATEWAY entries without valid next-
hop route as invalid.

Previously when such entrie was returned by rtalloc(9) a second route
lookup was done in rt_checkgate() very late in the journey of a packet.

In other words a single rtalloc(9) call can now result in multiple
route lookups if a RTF_GATEWAY entry is returned.

This is a step towards always calling L2 output functions with valid
destination information.

Tested by various including jmc@, naddy@, Hrvoje Popovski

Revision 1.181 / (download) - annotate - [select for diffs], Mon Nov 2 14:40:09 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.180: +25 -40 lines
Diff to previous 1.180 (colored)

Merge rtable_mpath_match() into rtable_lookup().

ok bluhm@

Revision 1.180 / (download) - annotate - [select for diffs], Fri Oct 30 09:39:42 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.179: +3 -3 lines
Diff to previous 1.179 (colored)

Rename rtrequest1() to rtrequest().
OK mpi@

Revision 1.179 / (download) - annotate - [select for diffs], Sun Oct 25 14:41:09 2015 UTC (8 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.178: +3 -2 lines
Diff to previous 1.178 (colored)

Be more consisten with rtmsgs. Always set rtm_index (even in the RTM_GET
case) and always set rtm_pid to the pid of the requestor (even in the
sysctl code path).
OK mpi@

Revision 1.178 / (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.177: +4 -6 lines
Diff to previous 1.177 (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.177 / (download) - annotate - [select for diffs], Sun Oct 25 10:05:09 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.176: +4 -5 lines
Diff to previous 1.176 (colored)

Instead of doing the the if_get() dance for rt_missmsg(), change the
function to take an interface index.
discussed with mpi@;  OK claudio@

Revision 1.176 / (download) - annotate - [select for diffs], Sat Oct 24 11:58:47 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.175: +13 -9 lines
Diff to previous 1.175 (colored)

Some rt_ifp to rt_ifidx conversions.

ok bluhm@

Revision 1.175 / (download) - annotate - [select for diffs], Fri Oct 23 13:41:41 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.174: +8 -7 lines
Diff to previous 1.174 (colored)

It was possible to create a gateway route pointing to another gateway
route by changing the gateway.  Despite the error message when doing
so, the route did actually change.  The gateway is modified by
rt_setgate(), the error is created by rt_getifa().  Do these
operations the other way around.
OK mpi@

Revision 1.174 / (download) - annotate - [select for diffs], Fri Oct 23 10:22:29 2015 UTC (8 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.173: +35 -2 lines
Diff to previous 1.173 (colored)

Introduce a new sysctl NET_RT_IFNAMES that returns only ifnames to ifindex
mappings. This will be used by if_nameindex(3), if_nametoindex(3) and
if_indextoname(3) soon to fix the issues in pledge because of inet6 link
local addressing.
OK mpi@ benno@ deraadt@
The libc version will follow soon so better start updating your kernels

Revision 1.173 / (download) - annotate - [select for diffs], Thu Oct 22 17:19:38 2015 UTC (8 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.172: +3 -2 lines
Diff to previous 1.172 (colored)

Use only one refcounting mechanism for route entries.

ok bluhm@, dlg@, claudio@

Revision 1.172 / (download) - annotate - [select for diffs], Thu Oct 22 15:37:47 2015 UTC (8 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.171: +6 -7 lines
Diff to previous 1.171 (colored)

Inspired by satosin(), use inline functions to convert sockaddr dl.
Instead of casts they check wether the incoming object has the
expected type.  So introduce satosdl() and sdltosa() in the kernel.
OK mpi@

Revision 1.171 / (download) - annotate - [select for diffs], Mon Sep 21 11:27:08 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.170: +2 -2 lines
Diff to previous 1.170 (colored)

Pass the correct variable to free(9) and while here add the size.

From David Hill, ok sthen@

Revision 1.170 / (download) - annotate - [select for diffs], Fri Sep 11 16:58:00 2015 UTC (8 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (colored)

Introduce rtref(9) use it in rtable_lookup() before returning a route
entry.

ok bluhm@, claudio@

Revision 1.169 / (download) - annotate - [select for diffs], Mon Aug 24 22:11:33 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.168: +4 -8 lines
Diff to previous 1.168 (colored)

Always increment the reference counter of the returned route entry in
rtrequest1(9).

This simplifies rtfree(9) dances and will prevent another CPU to free
the entry before we're done with it as soon as routing functions can
be executed in parallel.

ok bluhm@, mikeb@

Revision 1.168 / (download) - annotate - [select for diffs], Wed Aug 19 13:27:38 2015 UTC (8 years, 9 months ago) by bluhm
Branch: MAIN
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

Convert all calls to rtrequest1() and the following error check
into a common pattern.  In the man page clarify the usage of the
returned route.
OK mpi@ mikeb@ jmc@

Revision 1.167 / (download) - annotate - [select for diffs], Mon Aug 17 09:46:26 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.166: +2 -2 lines
Diff to previous 1.166 (colored)

Convert two rt->rt_refcnt-- into rtfree(9) making sure the route entry
is freed when we no longer need it.

In this case both code paths are executed in process context and thus
serialized by the KERNEL_LOCK.  Since we are adding a route entry to
the table in both cases, rtfree(9) will not actually free the entry
because it is still RT_VALID.

ok bluhm@

Revision 1.166 / (download) - annotate - [select for diffs], Sat Jul 18 21:58:06 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.165: +3 -1 lines
Diff to previous 1.165 (colored)

NET_RT_DUMP is dumb and tries to iterates over all possible AF tables
of a given rtable if none is specified.  In this case do not return an
error if a table is missing for one of the ~30 funky AF defines we
have in <sys/socket.h>

Breakage found by and fix discussed with claudio@

Revision 1.165 / (download) - annotate - [select for diffs], Sat Jul 18 15:51:16 2015 UTC (8 years, 10 months ago) by mpi
Branch: MAIN
Changes since 1.164: +42 -45 lines
Diff to previous 1.164 (colored)

Abstract the routing table internals behind an rtable_* API.

Code abusing the radix internals for the routing table should now
includes <net/rtable.h> and only deal with "struct rtentry".

Code using a radix tree for another purpose can still include
<net/radix.h>.

Inputs from and ok claudio@, mikeb@

Revision 1.164 / (download) - annotate - [select for diffs], Sat Jul 18 00:02:30 2015 UTC (8 years, 10 months ago) by phessler
Branch: MAIN
Changes since 1.163: +14 -1 lines
Diff to previous 1.163 (colored)

On systems with a full routing table (550k+), we often want to be able to
look at the routes with a priority, or to display all routes that do not
have a specific priority (normally, don't show bgp).

OK mpi@ benno@
previous versions OK deraadt@ sthen@

Revision 1.163 / (download) - annotate - [select for diffs], Thu Jul 16 18:17:27 2015 UTC (8 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.162: +2 -6 lines
Diff to previous 1.162 (colored)

Fix rn_match and there for the expoerted lookup functions in radix.c
to never return the internal RNF_ROOT nodes. This removes the checks
in the callee to verify that not an RNF_ROOT node was returned.
OK mpi@

Revision 1.162 / (download) - annotate - [select for diffs], Wed Jul 15 22:16:42 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.161: +2 -3 lines
Diff to previous 1.161 (colored)

m_freem() can handle NULL, do not check for this condition beforehands.
ok stsp mpi

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

Get rid of the undocumented & temporary* m_copy() macro added for
compatibility with 4.3BSD in September 1989.

*Pick your own definition for "temporary".

ok bluhm@, claudio@, dlg@

Revision 1.160 / (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.159: +2 -2 lines
Diff to previous 1.159 (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.159 / (download) - annotate - [select for diffs], Wed May 13 10:42:46 2015 UTC (9 years ago) by jsg
Branch: MAIN
Changes since 1.158: +9 -9 lines
Diff to previous 1.158 (colored)

test mbuf pointers against NULL not 0
ok krw@ miod@

Revision 1.158 / (download) - annotate - [select for diffs], Tue May 5 09:41:43 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.157: +7 -1 lines
Diff to previous 1.157 (colored)

Flag user specified routes with an AF_LINK gateway as RTF_LLINFO.

This makes ND6 and ARP layers happy since they both check for this flag,
but is was redundant to provide route(8)'s "-llinfo" option when adding
a l2 route.

RTF_LLINFO is clearly redundant for userland tools, so only allow the
kernel to set it.

ok benno@, claudio@

Revision 1.157 / (download) - annotate - [select for diffs], Wed Feb 11 23:34:43 2015 UTC (9 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.156: +3 -3 lines
Diff to previous 1.156 (colored)

Do not store the key and the gateway of a route entry in the same chunk
of memory.

The key (destination) is only set once, when the route is inserted in
the routing table, and does not need to change afterward.  The gateway
might change and rt_setgate() will do all the checks for you.

ok claudio@

Revision 1.156 / (download) - annotate - [select for diffs], Tue Jan 13 12:14:00 2015 UTC (9 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.155: +24 -58 lines
Diff to previous 1.155 (colored)

Restore sending RTM_ADD and RTM_DELETE messages to userland for every
route created/deleted with rt_ifa_add(9)/rt_ifa_del(9), not only for
RTF_LOCAL routes.

Regression introduced in r1.172 when restoring the original behavior
of RTM_NEWADDR/RTM_RTM_DELADDR reported by Florian Riehm.

Joint work with Florian Riehm, with input from and ok bluhm@.

Revision 1.155 / (download) - annotate - [select for diffs], Fri Dec 19 18:57:17 2014 UTC (9 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.154: +3 -5 lines
Diff to previous 1.154 (colored)

Do not report an EDQUOT "Disk quota exceeded" error from the routing
code.  Instead generate an ENOBUFS "No buffer space available" error
at the malloc(9) failure in rt_setgate(9) and propagate it.
OK mpi@

Revision 1.154 / (download) - annotate - [select for diffs], Thu Dec 11 08:55:10 2014 UTC (9 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.153: +12 -9 lines
Diff to previous 1.153 (colored)

Do not change the interface of a route if it is not intended.

When a route change message is submitted, looks for a new ifa to attach
the route only if a gateway, an ifp or an ifa has been specified.

Fix a regression reported by Florian Riehm, ok bluhm@.

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

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

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

Revision 1.152 / (download) - annotate - [select for diffs], Tue Aug 12 13:52:08 2014 UTC (9 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.151: +10 -1 lines
Diff to previous 1.151 (colored)

route_cb is internal to rtsock.c

Revision 1.151 / (download) - annotate - [select for diffs], Mon Aug 11 11:59:05 2014 UTC (9 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.150: +9 -2 lines
Diff to previous 1.150 (colored)

Put back the checks about RTF_LOCAL routes now that userland tools are
aware of them.

Original commit message was:

Reserve the highest route priority for kernel-managed routes and prevent
userland from playing with the local and broadcast flags.

ok claudio@

Revision 1.150 / (download) - annotate - [select for diffs], Tue Jul 29 12:18:41 2014 UTC (9 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.149: +2 -9 lines
Diff to previous 1.149 (colored)

Revert the checks about RTF_LOCAL routes.

Even if in the end we would like to be more strict about what userland
can do with kernel-managed route entries, most of the tools out there
are not yet ready for this.  Since RTF_LOCAL routes are for the moment
just like RTF_LLINFO routes without expire timer, allow userland tools
to remove/modify them.  In case they are missing, the good old cloning
mechanism will recreate what you need.

bluhm@ and deraadt@ agree.

Revision 1.149 / (download) - annotate - [select for diffs], Sat Jul 12 18:44:22 2014 UTC (9 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.148: +8 -8 lines
Diff to previous 1.148 (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.148 / (download) - annotate - [select for diffs], Tue Jul 8 17:19:25 2014 UTC (9 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.147: +2 -4 lines
Diff to previous 1.147 (colored)

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis

Revision 1.147 / (download) - annotate - [select for diffs], Sat May 31 15:36:44 2014 UTC (10 years ago) by claudio
Branch: MAIN
Changes since 1.146: +28 -19 lines
Diff to previous 1.146 (colored)

Unbreak RTM_CHANGE. Unlike RTM_LOCK or RTM_GET it is OK to pass in a
new gateway for RTM_CHANGE if the route is not a multipath route.
Fixes issues found by benno@, OK benno@

Revision 1.146 / (download) - annotate - [select for diffs], Tue May 27 19:38:15 2014 UTC (10 years ago) by claudio
Branch: MAIN
Changes since 1.145: +12 -34 lines
Diff to previous 1.145 (colored)

Big refactoring of the radix code (mainly rn_addroute but also part
of rn_delete was changed). The mpath code gets a much better
rn_mpath_next() function that allows looping through the dupedkey list
based on prio, any or only active routes. This solves the issues seen
with failed deletes of down routes.
Commit this now so that it gets tested. Both sthen@ and blambert@ agree.

Revision 1.145 / (download) - annotate - [select for diffs], Tue May 27 09:39:58 2014 UTC (10 years ago) by mpi
Branch: MAIN
Changes since 1.144: +10 -2 lines
Diff to previous 1.144 (colored)

Reserve the highest route priority for kernel-managed routes and prevent
userland from playing with the local and broadcast flags.

ok claudio@

Revision 1.144 / (download) - annotate - [select for diffs], Fri May 16 08:21:54 2014 UTC (10 years ago) by mpi
Branch: MAIN
Changes since 1.143: +2 -3 lines
Diff to previous 1.143 (colored)

Do not put any link-layer address on the per-ifp lists or on the RB-
Tree.

Since interfaces only support one link-layer address accessible via the
if_sadl member, there's no need to have it elsewhere.  This improves
various address lookups because the first element of the list, the link-
layer address, won't necessarily be discarded.

Finally remove the empty netmask associated to every link-layer address.
This hack was needed to (ab)use the address & netmask comparison code to
do a strcmp() on the interface name embedded in the sdl_data field.

ok henning@, claudio@

Revision 1.143 / (download) - annotate - [select for diffs], Fri Apr 25 10:41:09 2014 UTC (10 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.142: +2 -2 lines
Diff to previous 1.142 (colored)

Remove rti_ifp from rt_addrinfo, one less ifp pointer, say yay!

This pointer was only needed by rt_getifa() to find an address, so
turn it into a local variable.

ok henning@, bluhm@

Revision 1.142 / (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.141: +3 -3 lines
Diff to previous 1.141 (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.141 / (download) - annotate - [select for diffs], Mon Mar 17 10:24:40 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.140: +14 -25 lines
Diff to previous 1.140 (colored)

Remove pre-rt_getifa() code to find the address descriptor (ifa) related
to a route entry, no need to do the work twice.

This chunk should have been deleted when post-4.4BSD changes from BSD/OS
4.2 were merged more than 10 years ago.

While here properly indent the following block.

tested by chris@, ok krw@

Revision 1.140 / (download) - annotate - [select for diffs], Wed Mar 12 12:03:55 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.139: +9 -9 lines
Diff to previous 1.139 (colored)

RTAX_IFP points to the "struct sockaddr_dl" corresponding to the
link-layer address of an interface.  This ugly structure is used
to export the interface's name and index, not only the link-layer
address as its name might suggest.

So instead reaching this descriptor by forcing and abusing the
position of the link-layer "struct ifaddr" in the per-interface
list, use the if_sadl pointer directly.

ok mikeb@, henning@

Revision 1.139 / (download) - annotate - [select for diffs], Thu Feb 13 22:01:50 2014 UTC (10 years, 3 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.138: +6 -27 lines
Diff to previous 1.138 (colored)

Replace hand crafted routing label code with the rtlabel_id2sa()
function call.  Name sockaddr_rtlabel variable sa_rl everywhere.
OK mpi@ claudio@

Revision 1.138 / (download) - annotate - [select for diffs], Wed Feb 12 13:01:50 2014 UTC (10 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.137: +4 -1 lines
Diff to previous 1.137 (colored)

Add rtlabel to rt_newaddrmsg, From: Florian Riehm <mail at friehm dot de>
ok bluhm claudio

Revision 1.137 / (download) - annotate - [select for diffs], Wed Jan 22 06:28:09 2014 UTC (10 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.136: +4 -23 lines
Diff to previous 1.136 (colored)

Remove genmask support from the kernel. rtmsgs with RTA_GENMASK set will
now cause a EINVAL. The RTA_GENMASK and RTAX_GENMASK defines are kept for
compatibility reasons.
OK benno@ and agreed by dlg@

Revision 1.136 / (download) - annotate - [select for diffs], Tue Jan 21 10:08:02 2014 UTC (10 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.135: +100 -83 lines
Diff to previous 1.135 (colored)

Substitute crazy defines and convert some 0 to NULL.

ok claudio@, henning@

Revision 1.135 / (download) - annotate - [select for diffs], Mon Jan 20 22:11:42 2014 UTC (10 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.134: +1 -202 lines
Diff to previous 1.134 (colored)

Get rid of the old routing message version 4 transition code before
5.5 release.
OK claudio@

Revision 1.134 / (download) - annotate - [select for diffs], Sun Jan 19 11:20:46 2014 UTC (10 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.133: +2 -2 lines
Diff to previous 1.133 (colored)

RTF_MPATH is a flag userland needs to be able to pass in since it is used
to set multipath routes. So since more then 2 month multipath was broken.

Revision 1.133 / (download) - annotate - [select for diffs], Fri Jan 10 14:29:08 2014 UTC (10 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.132: +15 -17 lines
Diff to previous 1.132 (colored)

replace the rest of the obsolete radix macros
sprinkle 0 -> NULL where obvious
ok millert mpi

Revision 1.132 / (download) - annotate - [select for diffs], Thu Jan 9 21:57:52 2014 UTC (10 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.131: +2 -2 lines
Diff to previous 1.131 (colored)

replace Bcopy macro with memmove and memcpy. ok mpi

Revision 1.131 / (download) - annotate - [select for diffs], Fri Nov 1 20:09:14 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.130: +19 -19 lines
Diff to previous 1.130 (colored)

The old routing messages compatibility code did not work on strict
alignment architectures.  Use m_copydata() instead of mtod().
OK deraadt@

Revision 1.130 / (download) - annotate - [select for diffs], Thu Oct 31 18:10:21 2013 UTC (10 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.129: +205 -2 lines
Diff to previous 1.129 (colored)

Convert the route expire timestamp in kernel and routing message
to 64 bit.  Increase the routing message version from 4 to 5.  Add
a small compatibility layer that allows to set routes with old user
land and new kernel.  Old kernel with new user land does not work.

The compatibility layer ist not perfect, but it allows to configure
addresses with old ifconfig and new kernel.  Route get also works
in this setup.  dhclient hangs as messages for interface address
changes with old version are not generated.

OK claudio@

Revision 1.129 / (download) - annotate - [select for diffs], Sun Oct 20 13:21:57 2013 UTC (10 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

rt_mpath_next() was always called with 0 in the last argument. So drop it.
OK henning@

Revision 1.128 / (download) - annotate - [select for diffs], Sun Oct 20 12:35:48 2013 UTC (10 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.127: +9 -6 lines
Diff to previous 1.127 (colored)

Make sure that the RTM_DESYNC message is not filtered out. Also ensure that
rtm_flags and rtm_fmask do not change flags that are kernel specific (e.g.
RTF_CLONED). OK henning@

Revision 1.127 / (download) - annotate - [select for diffs], Wed Aug 28 06:58:57 2013 UTC (10 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.126: +3 -4 lines
Diff to previous 1.126 (colored)

Remove unused argument from *rtrequest()

ok krw@, mikeb@

Revision 1.123.2.1 / (download) - annotate - [select for diffs], Fri May 17 11:34:49 2013 UTC (11 years ago) by sthen
Branch: OPENBSD_5_3
Changes since 1.123: +2 -1 lines
Diff to previous 1.123 (colored) next main 1.124 (colored)

MFC rtsock fix to OPENBSD_5_3:

-/--------------------------
revision 1.126
date: 2013/05/17 11:13:37;  author: krw;  state: Exp;  lines: +2 -1
Do not attempt to delete the undeletable RNF_ROOT route.

Discovered & fix tested by Peter J Philip.

ok claudio@ blambert@
-/--------------------------

Revision 1.126 / (download) - annotate - [select for diffs], Fri May 17 11:13:37 2013 UTC (11 years ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.125: +2 -1 lines
Diff to previous 1.125 (colored)

Do not attempt to delete the undeletable RNF_ROOT route.

Discovered & fix tested by Peter J Philip.

ok claudio@ blambert@

Revision 1.125 / (download) - annotate - [select for diffs], Fri Mar 15 20:45:34 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.124: +2 -3 lines
Diff to previous 1.124 (colored)

change LIST_END to literal NULL for clarity.
ok claudio mpi

Revision 1.124 / (download) - annotate - [select for diffs], Thu Mar 7 09:03:16 2013 UTC (11 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.123: +2 -2 lines
Diff to previous 1.123 (colored)

Remove the IFAFREE() macro, the ifafree() function it was calling already
check for the reference counter.

ok mikeb@, miod@, pelikan@, kettenis@, krw@

Revision 1.123 / (download) - annotate - [select for diffs], Thu Sep 20 20:53:13 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE
Branch point for: OPENBSD_5_3
Changes since 1.122: +2 -2 lines
Diff to previous 1.122 (colored)

Fix a pair of typos in comments.

ok claudio@

Revision 1.122 / (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.121: +3 -3 lines
Diff to previous 1.121 (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.121 / (download) - annotate - [select for diffs], Wed Sep 19 12:35:07 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

More radix internals pushdown; place rn_mpath_next, which accepts and
returns radix_node pointers, inside a new rt_mpath_next, which accepts
and returns rtentry pointers, and start using that instead.

ok claudio@

Revision 1.120 / (download) - annotate - [select for diffs], Mon Sep 17 19:00:36 2012 UTC (11 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.119: +3 -3 lines
Diff to previous 1.119 (colored)

Whitespace change (excess indentation).

ok claudio@

Revision 1.119 / (download) - annotate - [select for diffs], Wed Mar 28 18:10:38 2012 UTC (12 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.118: +2 -2 lines
Diff to previous 1.118 (colored)

Use p_p->ps_pid as pid in the route header instead of the thread pid. Give
userland a chance to compare the value against getpid().
This unbreaks transmission for me. OK deraadt@, guenther@

Revision 1.118 / (download) - annotate - [select for diffs], Thu Apr 7 15:30:16 2011 UTC (13 years, 1 month ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.117: +2 -2 lines
Diff to previous 1.117 (colored)

Do not use NULL in integer comparisons. No functional change.
ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@

Revision 1.117 / (download) - annotate - [select for diffs], Mon Apr 4 20:25:35 2011 UTC (13 years, 2 months ago) by blambert
Branch: MAIN
Changes since 1.116: +6 -8 lines
Diff to previous 1.116 (colored)

m_copyback is no longer a void function, so start using its error return
instead of coming at it sideways to detect failure.

ok claudio@

Revision 1.116 / (download) - annotate - [select for diffs], Sun Apr 3 17:01:23 2011 UTC (13 years, 2 months ago) by jsing
Branch: MAIN
Changes since 1.115: +4 -2 lines
Diff to previous 1.115 (colored)

Always reserve space in the routing socket for a desync mbuf. This allows
a desync to be appended when the socket buffer becomes full, rather than
continuall retrying until space becomes available (which may be never).

ok claudio@

Revision 1.115 / (download) - annotate - [select for diffs], Thu Mar 31 10:36:42 2011 UTC (13 years, 2 months ago) by jasper
Branch: MAIN
Changes since 1.114: +2 -2 lines
Diff to previous 1.114 (colored)

- use nitems(); no binary change

ok claudio@

Revision 1.114 / (download) - annotate - [select for diffs], Mon Feb 14 12:53:27 2011 UTC (13 years, 3 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.113: +3 -1 lines
Diff to previous 1.113 (colored)

free mbuf in failure case.  fix for pr6562.  ok claudio.

Revision 1.97.2.1 / (download) - annotate - [select for diffs], Thu Jan 13 15:57:32 2011 UTC (13 years, 4 months ago) by jsg
Branch: OPENBSD_4_7
Changes since 1.97: +3 -3 lines
Diff to previous 1.97 (colored) next main 1.98 (colored)

MFC rtsock fix by claudio at claudio's request:

dst my point to memory inside rt so move the check up before the
rtfree(rt). Without this the sp_protocol on RTM_DELETE is garbage
and rtsocket user that restrict the AF of the socket (like ospfd)
will not see a single one of the RTM_DELETE.
OK henning@, dlg@

Revision 1.105.2.1 / (download) - annotate - [select for diffs], Thu Jan 13 15:53:46 2011 UTC (13 years, 4 months ago) by jsg
Branch: OPENBSD_4_8
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (colored) next main 1.106 (colored)

MFC rtsock fix by claudio at claudio's request:

dst my point to memory inside rt so move the check up before the
rtfree(rt). Without this the sp_protocol on RTM_DELETE is garbage
and rtsocket user that restrict the AF of the socket (like ospfd)
will not see a single one of the RTM_DELETE.
OK henning@, dlg@

Revision 1.113 / (download) - annotate - [select for diffs], Thu Jan 6 14:50:11 2011 UTC (13 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.112: +3 -3 lines
Diff to previous 1.112 (colored)

dst my point to memory inside rt so move the check up before the
rtfree(rt). Without this the sp_protocol on RTM_DELETE is garbage
and rtsocket user that restrict the AF of the socket (like ospfd)
will not see a single one of the RTM_DELETE.
OK henning@, dlg@

Revision 1.112 / (download) - annotate - [select for diffs], Thu Jan 6 14:45:07 2011 UTC (13 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.111: +2 -3 lines
Diff to previous 1.111 (colored)

Minor style nit

Revision 1.111 / (download) - annotate - [select for diffs], Thu Oct 28 17:18:35 2010 UTC (13 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.110: +34 -20 lines
Diff to previous 1.110 (colored)

Do not send route messages to userland processes that the kernel
rejects because of bad encoding. Userland processes trust that the
messages on the rtsock are correctly encoded. Moved some checks up
to do the suser() check as soon as possible.
After discussion with deraadt@, OK deraadt@ and sthen@ (earlier version)

Revision 1.110 / (download) - annotate - [select for diffs], Mon Oct 11 11:41:08 2010 UTC (13 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.109: +52 -6 lines
Diff to previous 1.109 (colored)

Implement an rtsocket filter for rtableids. A process will initially
only get messages that are for the rtable the process is bound to.
Depending on the rtm_type the rdomain or rtable id are used for
comparison.  It is possible to change the filter with a setsockopt(s,
AF_ROUTE, ROUTE_TABLEFILTER,...) and if set to RTABLE_ANY the filter
is deactivated.  Additionally set the tableid in struct if_msghdr
to the rdomain id and use the process rtableid in the sysctl if no
table was specified.

OK henning@

Revision 1.109 / (download) - annotate - [select for diffs], Wed Sep 8 08:20:45 2010 UTC (13 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.108: +11 -11 lines
Diff to previous 1.108 (colored)

Switch the MPLS blocks for RTM_CHANGE. Do not always remove the MPLS
information if the gateway changes, since real MPLS routes need to
change gateway and outgoing label on topology changes. So if there is
MPLS information and an outgoing label do a proper change but if the
gateway of a non-MPLS route is changed remove the MPLS path since it is
no longer valid.
OK michele@

Revision 1.108 / (download) - annotate - [select for diffs], Thu Sep 2 09:38:05 2010 UTC (13 years, 9 months ago) by blambert
Branch: MAIN
Changes since 1.107: +3 -1 lines
Diff to previous 1.107 (colored)

don't attempt to enqueue routing messages on sockets marked SS_CANTRCVMORE

ok claudio@

Revision 1.107 / (download) - annotate - [select for diffs], Wed Aug 25 14:07:24 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.106: +2 -4 lines
Diff to previous 1.106 (colored)

Let rtable_add() return usefull errnos so that the ioctl handler and the
rtsock code can return a more reasonable error to the user.
OK henning

Revision 1.106 / (download) - annotate - [select for diffs], Tue Aug 24 12:45:08 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.105: +2 -3 lines
Diff to previous 1.105 (colored)

last is a pointer so initialize to NULL and not 0. Also move initialization
up to the declaration.

Revision 1.105 / (download) - annotate - [select for diffs], Wed Jul 14 20:56:35 2010 UTC (13 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE
Branch point for: OPENBSD_4_8
Changes since 1.104: +1 -3 lines
Diff to previous 1.104 (colored)

The append side of a socketbuffer is not allowed to call sbflush().
Learned the hard way. dlg@ confirmed that it is save to just remove them,
the desync will still work but the reader needs to dequeue all packets first.

Revision 1.104 / (download) - annotate - [select for diffs], Wed Jul 14 00:42:57 2010 UTC (13 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.103: +89 -7 lines
Diff to previous 1.103 (colored)

if we produce a lot of rtsock messages it is possible we will hit a
condition that prevents us from queuing it, which in turn means that
processes listening on the routing socket for changes to the kernel state
will get out of sync. currently this is handled by the following comment:

	/* should notify about lost packet */

this change introduces a new rtsock message called RTM_DESYNC that
notifies about lost packets and uses it instead of this comment.

when we detect loss we flush all the message in the routing socket and
attempt to queue an RTM_DESYNC message instead. to guarantee that we will
enqueue DESYNC we keep trying it when an attempt to enqueue or dequeue
any messages is made, and in the worst case a timeout tries to guarantee
that desync is added to the socket.

ive been running this in production for 2 or 3 weeks.
tested by sthen@
ok sthen@ claudio@ deraadt@
code written by andrew sallaway at the univeristy of queensland.

Revision 1.103 / (download) - annotate - [select for diffs], Fri Jul 9 15:36:54 2010 UTC (13 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.102: +2 -1 lines
Diff to previous 1.102 (colored)

When protocol filtering is used on the rtsocket filter only messages that
actually have a protocol/address family set. Messages like RTM_IFINFO or
RTM_IFANNOUNCE are family independent and should not be filtered but
it is possible to use a ROUTE_MSGFILTER to filter these messages.
This allows to reduce the messages sent to AF_INET or AF_INET6 only daemons.
OK henning@, deraadt@

Revision 1.102 / (download) - annotate - [select for diffs], Fri Jul 2 02:40:16 2010 UTC (13 years, 11 months ago) by blambert
Branch: MAIN
Changes since 1.101: +3 -3 lines
Diff to previous 1.101 (colored)

m_copyback can fail to allocate memory, but is a void fucntion so gymnastics
are required to detect that.

Change the function to take a wait argument (used in nfs server, but
M_NOWAIT everywhere else for now) and to return an error

ok claudio@ henning@ krw@

Revision 1.101 / (download) - annotate - [select for diffs], Mon Jun 28 18:50:37 2010 UTC (13 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.100: +4 -3 lines
Diff to previous 1.100 (colored)

Add the rtable id as an argument to rn_walktree(). Functions like
rt_if_remove_rtdelete() need to know the table id to be able to correctly
remove nodes.
Problem found by Andrea Parazzini and analyzed by Martin Pelikán.
OK henning@

Revision 1.100 / (download) - annotate - [select for diffs], Wed May 19 13:09:09 2010 UTC (14 years ago) by claudio
Branch: MAIN
Changes since 1.99: +45 -42 lines
Diff to previous 1.99 (colored)

Require RTF_MPLS to be set when a mpls route is added or changed.  To remove
only the MPLS bits from a route set rtm_fmask to RTF_MPLS.  Additionally check
if the nexthop is modified and in that case always remove the MPLS info since
the path changed.  This change makes life in userland a lot easier since the
routing daemons normaly don't know about MPLS and until now they destroyed
MPLS information when issuing RTM_CHANGEs.
OK michele@

Revision 1.99 / (download) - annotate - [select for diffs], Wed Apr 21 11:52:46 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.98: +15 -2 lines
Diff to previous 1.98 (colored)

Implement a way to get information about a rtable. Currently only the rtableid
and rdomainid are returned. This is necessary to know where L2 information
of a table is stored (which will be needed soon by bgpd).
Also while there change the errno for non-existing routing tables to ENOENT.
'Fine' deraadt@

Revision 1.98 / (download) - annotate - [select for diffs], Tue Mar 23 15:03:25 2010 UTC (14 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.97: +2 -1 lines
Diff to previous 1.97 (colored)

Set rtm_mpls on RTM_GET so that we get the correct options on mpls routes.
OK michele@

Revision 1.97 / (download) - annotate - [select for diffs], Tue Feb 9 16:34:57 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE
Branch point for: OPENBSD_4_7
Changes since 1.96: +2 -1 lines
Diff to previous 1.96 (colored)

Set the rtm_priority when sending RTM_ADD/RTM_DELETE messages out in
rt_newaddrmsg(). Makes the routing daemons a bit less confused when
interfaces are reconfigured.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Feb 9 16:31:14 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.95: +7 -1 lines
Diff to previous 1.95 (colored)

Correctly track RTF_UP on RTM_CHANGE. Since the interface can change
rt_if_linkstate_change() needs to be rerun for this route and the
resulting rt_flags need to copied to the rtm_flags for userland.
Problem found and diagnosed by Doran Mori. OK henning@, jsing@

Revision 1.95 / (download) - annotate - [select for diffs], Tue Nov 3 10:59:04 2009 UTC (14 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.94: +7 -8 lines
Diff to previous 1.94 (colored)

rtables are stacked on rdomains (it is possible to have multiple routing
tables on top of a rdomain) but until now our code was a crazy mix so that
it was impossible to correctly use rtables in that case. Additionally pf(4)
only knows about rtables and not about rdomains. This is especially bad when
tracking (possibly conflicting) states in various domains.
This diff fixes all or most of these issues. It adds a lookup function to
get the rdomain id based on a rtable id. Makes pf understand rdomains and
allows pf to move packets between rdomains (it is similar to NAT).
Because pf states now track the rdomain id as well it is necessary to modify
the pfsync wire format. So old and new systems will not sync up.
A lot of help by dlg@, tested by sthen@, jsg@ and probably more
OK dlg@, mpf@, deraadt@

Revision 1.94 / (download) - annotate - [select for diffs], Thu Sep 17 13:27:24 2009 UTC (14 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.93: +5 -143 lines
Diff to previous 1.93 (colored)

Remove the comaptibility structures for routing socket version 3.
The RTM_VERSION bump is 2 years ago and so there is no need for this.
Diff made by tedu@ some time ago but got never commited so I do it now.

Revision 1.93 / (download) - annotate - [select for diffs], Tue Jul 7 10:38:49 2009 UTC (14 years, 10 months ago) by michele
Branch: MAIN
Changes since 1.92: +7 -2 lines
Diff to previous 1.92 (colored)

When adding or changing a MPLS route, add RTF_MPLS flag to
routing message. We can then rely on that flag to spot out
MPLS routes coming from routing socket.

ok claudio@

Revision 1.92 / (download) - annotate - [select for diffs], Fri Jun 26 10:14:24 2009 UTC (14 years, 11 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.91: +38 -33 lines
Diff to previous 1.91 (colored)

the pr_usrreq implementation for routing sockets shares exactly one line
of code between cases, so stop pretending otherwise, and move the
if() dance to a switch, as is done in every other pr_usrreq I'm aware of.

ok claudio@ michele@

Revision 1.91 / (download) - annotate - [select for diffs], Mon Jun 22 19:01:56 2009 UTC (14 years, 11 months ago) by blambert
Branch: MAIN
Changes since 1.90: +1 -2 lines
Diff to previous 1.90 (colored)

Remove unneeded sotorawpcb() call, as the PCB is unmolested between
malloc()ing it and calling that macro.

No functional change, just tightening things up a bit.

ok claudio@ michele@

Revision 1.90 / (download) - annotate - [select for diffs], Sat Jun 20 10:39:52 2009 UTC (14 years, 11 months ago) by blambert
Branch: MAIN
Changes since 1.89: +7 -3 lines
Diff to previous 1.89 (colored)

Decrement routing socket count in MPLS detach case

While here, fix whitespace (spaces -> tabs) issue spotted by michele@

ok michele@, claudio@

Revision 1.89 / (download) - annotate - [select for diffs], Sat Jun 6 12:31:17 2009 UTC (15 years ago) by rainer
Branch: MAIN
Changes since 1.88: +2 -1 lines
Diff to previous 1.88 (colored)

when xflags got changed, tell the userland by routing sockets

ok henning@

Revision 1.88 / (download) - annotate - [select for diffs], Fri Jun 5 00:05:22 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.87: +11 -6 lines
Diff to previous 1.87 (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.87 / (download) - annotate - [select for diffs], Sun May 31 18:00:54 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.86: +8 -7 lines
Diff to previous 1.86 (colored)

Hide RTP_DOWN in the kernel and don't expose it to userland. Userland is
not smart enough to handle it in a sensible way. Make sure the kernel
selected routing priority is actually exported to userland or to help
daemons like bgpd to keep correctly track of the routes. This should fix
some of the rather strange errors seen by people having multipath routes
on their bgpd boxes. While there make the interface priority inheritance
on static routes work again.
OK henning@

Revision 1.86 / (download) - annotate - [select for diffs], Sun May 31 03:27:17 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.85: +4 -2 lines
Diff to previous 1.85 (colored)

Fix for the rtfree 2 panic seen by some people before the release. A missing
refcnt bump caused the panic to be triggered. While there also make the
priority so that the compare is working a bit better.
henning@ cries in agony (I already gave up)

Revision 1.85 / (download) - annotate - [select for diffs], Sat Apr 18 10:45:47 2009 UTC (15 years, 1 month ago) by michele
Branch: MAIN
Changes since 1.84: +40 -2 lines
Diff to previous 1.84 (colored)

Make "route(8) change" aware of MPLS.
It is now possible to change routes' MPLS parameters via route change.

ok laurent@, ok and input claudio@

Revision 1.84 / (download) - annotate - [select for diffs], Tue Feb 3 16:42:54 2009 UTC (15 years, 4 months ago) by michele
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.83: +11 -13 lines
Diff to previous 1.83 (colored)

Use our own flags to set the operations and not RTF_PROTOX.
Switch the padding field into a MPLS one in rt_msghdr to store
relevant informations.

OK claudio@ laurent@

Revision 1.83 / (download) - annotate - [select for diffs], Wed Jan 28 22:18:44 2009 UTC (15 years, 4 months ago) by michele
Branch: MAIN
Changes since 1.82: +20 -13 lines
Diff to previous 1.82 (colored)

Get rid of the ugly rtentry hack.

We can now act as edge node and allow ipv4 packets to
enter a Label Switched Path and not just forwarding
MPLS packets.

OK claudio@

Revision 1.82 / (download) - annotate - [select for diffs], Wed Jan 28 12:34:09 2009 UTC (15 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.81: +147 -8 lines
Diff to previous 1.81 (colored)

Implement basic routing socket filtering. It is possible to give a list --
actually a bitfield -- of routing messages a listener is interested in.
This list can be changed with a setsockopt(s, AF_ROUTE, ROUTE_MSGFILTER, ...)
call. OK henning@, dlg@

Revision 1.81 / (download) - annotate - [select for diffs], Thu Jan 8 12:47:45 2009 UTC (15 years, 4 months ago) by michele
Branch: MAIN
Changes since 1.80: +34 -2 lines
Diff to previous 1.80 (colored)

Fix sockaddr_mpls structure.
Now it contains just the label as it must be.

This introduces a ugly hack in rtentry that will be removed
as soon as possible.

OK claudio@

Revision 1.80 / (download) - annotate - [select for diffs], Sat Jan 3 15:31:03 2009 UTC (15 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.79: +5 -2 lines
Diff to previous 1.79 (colored)

Write back the priority the kernel used. Fixes a problem seen in ospfd when
routes are added via route(8) -- those where added with the wrong priority
and so where not correctly tracked later on.
Found and tested by gollo@

Revision 1.79 / (download) - annotate - [select for diffs], Fri Dec 12 21:52:04 2008 UTC (15 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.78: +4 -1 lines
Diff to previous 1.78 (colored)

Make sure that incomming routing messages don't have RTP_DOWN set. Mask
the rtm_priority with RTP_MASK so that userland (e.g. arp) can issue a RTM_GET
and reissue the message as RTM_DELETE.

Revision 1.78 / (download) - annotate - [select for diffs], Sat Nov 22 22:34:11 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.77: +4 -8 lines
Diff to previous 1.77 (colored)

Allow rt_msg1() to get a NULL as struct rt_addrinfo this simplifies a few
callers (plus an upcomming one). OK henning@, dlg@

Revision 1.77 / (download) - annotate - [select for diffs], Fri Nov 21 18:01:30 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Change rn_mpath_next() to be able to walk over the full multipath list
not only over routes of the same prio. This makes it possible to modify
rt_mpath_matchgate() so that if only gateway is specified without a specific
priority it will scan the full list and not only the first routes.
This is also needed for upcoming link state tracking.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Aug 7 21:32:08 2008 UTC (15 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.75: +1 -4 lines
Diff to previous 1.75 (colored)

Remove workaround used for the 4.4 release. More route prio stuff is comming
soon.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Aug 1 05:08:08 2008 UTC (15 years, 10 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.74: +4 -1 lines
Diff to previous 1.74 (colored)

force route priority to RTP_DEFAULT unconditionally, effectively disabling
route prios. playing safe for 4.4-release, as not all parts of the system
deal correctly with route prios yet. ok claudio

Revision 1.74 / (download) - annotate - [select for diffs], Mon Jul 28 19:38:07 2008 UTC (15 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.73: +3 -1 lines
Diff to previous 1.73 (colored)

Align the route message length to the next natural boundary via ALIGN() to
ensure that the next message is nicely aligned as well. Some archs (sparc, m88k)have strict alignement issues since the inclusion of 64bit counters in the
messages because those values could end up on non aligned addresses.
Found and fix tested by miod@, OK deraadt@

Revision 1.73 / (download) - annotate - [select for diffs], Fri Jun 13 21:49:57 2008 UTC (15 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.72: +31 -7 lines
Diff to previous 1.72 (colored)

Change the logic when selecting routes on RTM_CHANGE & RTM_GET. RTM_CHANGE
can not supply the correct nexthop if the nexthop is changed. So if the
route we want to change is a non-multipath one allow the change to succeed.
This unbreaks RTM_CHANGE in most situations. Found by jsing@ Ok henning@

Revision 1.72 / (download) - annotate - [select for diffs], Fri Jun 13 06:10:46 2008 UTC (15 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.71: +2 -11 lines
Diff to previous 1.71 (colored)

Cleanup a bit. Instead of doing dst = 0 in every error handling block init
it once at start instead.

Revision 1.71 / (download) - annotate - [select for diffs], Fri May 23 15:51:12 2008 UTC (16 years ago) by thib
Branch: MAIN
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (colored)

Deal with the situation when TCP nfs mounts timeout and processes
get hung in nfs_reconnect() because they do not have the proper
privilages to bind to a socket, by adding a struct proc * argument
to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind)
and do the sobind() with proc0 in nfs_connect.

OK markus@, blambert@.
"go ahead" deraadt@.

Fixes an issue reported by bernd@ (Tested by bernd@).
Fixes PR5135 too.

Revision 1.70 / (download) - annotate - [select for diffs], Wed May 7 05:14:21 2008 UTC (16 years ago) by claudio
Branch: MAIN
Changes since 1.69: +26 -5 lines
Diff to previous 1.69 (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.69 / (download) - annotate - [select for diffs], Wed Apr 23 10:55:14 2008 UTC (16 years, 1 month ago) by norby
Branch: MAIN
Changes since 1.68: +9 -1 lines
Diff to previous 1.68 (colored)

Import MPLS (Multi Protocol Label Switching)

MPLS support partly based on the (abandoned?) AYAME project.
Basic LSR (Label Switch Router) functionality is present, but not fully
functional yet.

It is currently possible to insert entries in the LIB (Label Information Base)
with route(8), but setting the operation type is not supported yet.

Imported to allow more people to work on this in the coming weeks.

ok claudio@ laurent@ dlg@

Revision 1.68 / (download) - annotate - [select for diffs], Sat Sep 15 16:43:51 2007 UTC (16 years, 8 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.67: +2 -3 lines
Diff to previous 1.67 (colored)

malloc sweep:
-remove useless casts
-MALLOC/FREE -> malloc/free
-use M_ZERO where appropriate instead of seperate bzero
feedback & ok krw, hshoexer

Revision 1.67 / (download) - annotate - [select for diffs], Sun Sep 9 12:01:58 2007 UTC (16 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

Only clear the message header if it is called from a sysctl walk. This
unbreaks RTM_GET. Problem reported by fkr@

Revision 1.66 / (download) - annotate - [select for diffs], Sat Sep 8 16:55:05 2007 UTC (16 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.65: +4 -5 lines
Diff to previous 1.65 (colored)

Clear the message header (and only the message header) in rt_msg2.
By doing so we ensure that all the memory is initialised and we no longer
have to ensure that none of the structure elements is forgotten in
sysctl_iflist() and sysctl_dumpentry().
This solves the route flush issues seen by aanriot@
OK henning@

Revision 1.65 / (download) - annotate - [select for diffs], Fri Sep 7 11:15:19 2007 UTC (16 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.64: +8 -1 lines
Diff to previous 1.64 (colored)

Check if rtm_hdrlen is smaller then the passed message or it would be possible
to access uninitialised memory.
Set dst to 0 on error, the error path tries to access dst but dst is inited
later down the code. This fixes a kernel panic seen by aanriot@
OK henning@

Revision 1.64 / (download) - annotate - [select for diffs], Mon Sep 3 15:24:49 2007 UTC (16 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.63: +191 -33 lines
Diff to previous 1.63 (colored)

Bump RTM_VERSION to 4 and start a new aera of routing in OpenBSD :)
Changes include 64bit counters instead of u_long, routing table id in the header
of most messages, reserved routing priority field, added a hdrlen field to skip
over the header so that binary compatibility becomes easier.
A minimal backward support for old binaries is included to ease upgrades but
don't expect anything more than ifconfig, route and dhclient to correctly work.
OK henning@ mglocker@

Revision 1.63 / (download) - annotate - [select for diffs], Wed Feb 14 00:53:48 2007 UTC (17 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

Consistently spell FALLTHROUGH to appease lint.
ok kettenis@ cloder@ tom@ henning@

Revision 1.62 / (download) - annotate - [select for diffs], Fri Jun 16 17:45:37 2006 UTC (17 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.61: +11 -3 lines
Diff to previous 1.61 (colored)

support passing the desired routing table ID via the sysctl interface
(NET_RT_DUMP & friends) too. keep supporting the old form (and imply id 0)
of course. claudio ok

Revision 1.61 / (download) - annotate - [select for diffs], Fri Jun 16 16:52:08 2006 UTC (17 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.60: +15 -1 lines
Diff to previous 1.60 (colored)

pass the routing table ID over the routing socket, so we can start to
manipulate alternate tables from userland. new tables are created
implicitely when an RTM_ADD for that table is seen.
ok norby claudio hshoexer

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jun 16 16:49:39 2006 UTC (17 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.59: +9 -8 lines
Diff to previous 1.59 (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.59 / (download) - annotate - [select for diffs], Tue May 30 21:58:28 2006 UTC (18 years ago) by claudio
Branch: MAIN
Changes since 1.58: +15 -1 lines
Diff to previous 1.58 (colored)

Export the route labels via sysctl interface not only via RTM_GET.
OK henning@ norby@

Revision 1.58 / (download) - annotate - [select for diffs], Sat Apr 22 19:43:07 2006 UTC (18 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.57: +5 -2 lines
Diff to previous 1.57 (colored)

Routes announced via rt_missmsg() do not have rtm_index set. While in most
cases harmless it is used by the IPv6 code. The result is that bgpd is unable
to assigning link local addresses to the correct interface. OK henning@
Fix for PR 5063.

Revision 1.57 / (download) - annotate - [select for diffs], Fri Mar 31 17:30:39 2006 UTC (18 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.56: +8 -1 lines
Diff to previous 1.56 (colored)

Add sysctl to retrieve the routing table statisitcs. Will be used by netstat
instead of kvm access. OK henning@

Revision 1.56 / (download) - annotate - [select for diffs], Thu Mar 30 09:53:43 2006 UTC (18 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.55: +2 -1 lines
Diff to previous 1.55 (colored)

In sysctl_dumpentry() pass the rt_refcnt by overloading rmx_rttvar.
This new rmx_refcnt can be used by route(8) to produce the same output
as netstat(1). OK henning@

Revision 1.55 / (download) - annotate - [select for diffs], Thu Mar 30 08:28:16 2006 UTC (18 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

Spelling in comment.

Revision 1.54 / (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.53: +4 -4 lines
Diff to previous 1.53 (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.53 / (download) - annotate - [select for diffs], Thu Feb 23 14:15:53 2006 UTC (18 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.52: +5 -4 lines
Diff to previous 1.52 (colored)

Until now it was only possible to unset the RTF_JUMBO flag on a RTM_CHANGE
request. Extend the "hack" to include more flags (RTF_PROTO[123] flags,
RTF_BLACKHOLE, RTF_REJECT and RTF_STATIC). Because rtm_use is "abused" --
rtm_use was replaced long time ago with rtm_rmx->rmx_pksent -- it is now
forced to 0 in RTM_GET requests and sysctl_dumpentry(). This is done to
prevent false changes because of a reused RTM_GET message.
OK henning@, mcbride@, makes sense markus@

Revision 1.52 / (download) - annotate - [select for diffs], Thu Feb 2 13:59:45 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.51: +3 -1 lines
Diff to previous 1.51 (colored)

Set rtm_index to the correct interface index for RTM_ADD and RTM_CHANGE.
bgpd and ospfd use this information to track the availability of a route.
Discussed with dlg@, OK henning@

Revision 1.51 / (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.50: +4 -6 lines
Diff to previous 1.50 (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.50 / (download) - annotate - [select for diffs], Sun Nov 27 19:33:20 2005 UTC (18 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.49: +3 -1 lines
Diff to previous 1.49 (colored)

repair builds.  ramdisk kernels forgotten about again.

Revision 1.49 / (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.48: +4 -4 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Wed Jun 8 06:43:07 2005 UTC (18 years, 11 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.47: +1 -9 lines
Diff to previous 1.47 (colored)

kill some leftover bits from netns and iso routing

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jun 7 18:21:44 2005 UTC (18 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.46: +2 -1 lines
Diff to previous 1.46 (colored)

introduce a default "external" interface group, containing the interface(s)
the the default route(s) point to.
handles IPv4 and IPv6 as well as multipath routes.
follows default route changes, of course.
eases writing pf rulesets especially on laptops etc. that use different
interfaces depending on the environment (wired, wireless, ...)
ok theo ryan

Revision 1.46 / (download) - annotate - [select for diffs], Fri May 27 22:37:46 2005 UTC (19 years ago) by mcbride
Branch: MAIN
Changes since 1.45: +4 -3 lines
Diff to previous 1.45 (colored)

Use rtm_fmask instead of rtm_use.

ok marius@ claudio@

Revision 1.45 / (download) - annotate - [select for diffs], Fri May 27 07:11:21 2005 UTC (19 years ago) by mcbride
Branch: MAIN
Changes since 1.44: +2 -2 lines
Diff to previous 1.44 (colored)

Allow us to clear the RTM_JUMBO flag as well as set it.

Reported by Cedric Berger

Revision 1.44 / (download) - annotate - [select for diffs], Fri May 27 04:55:27 2005 UTC (19 years ago) by mcbride
Branch: MAIN
Changes since 1.43: +7 -1 lines
Diff to previous 1.43 (colored)

Experimental support for opportunitic use of jumbograms where only some hosts
on the local network support them.

This adds a new socket option, SO_JUMBO, and a new route flag,
RTF_JUMBO. If _both_ the socket option is set and the route for the host
has RTF_JUMBO set, ip_output will fragment the packet to the largest
possible size for the link, ignoring the card's MTU.

The semantics of this feature will be evolving rapidly; talk to us
if you intend to use it.

ok deraadt@ marius@

Revision 1.43 / (download) - annotate - [select for diffs], Thu Sep 16 22:31:29 2004 UTC (19 years, 8 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.42: +8 -1 lines
Diff to previous 1.42 (colored)

handle route labels on RTM_CHANGE, ok mcbride, prodded my markus some time ago

Revision 1.42 / (download) - annotate - [select for diffs], Tue Aug 3 11:22:15 2004 UTC (19 years, 10 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.41: +15 -1 lines
Diff to previous 1.41 (colored)

introduce route labels, allowing for up to 32 bytes of info to be attached
to a route.
the label is sent over the routing socket wrapped into a new
struct sockaddr_rtlabel, allowing for handling it like any other sockaddr.
struct rtentry only contains a (16 bit) label-ID, with the actual labels
kept outside the routing table.
ID allocator code inspired by my own code for altq and pf tags.
mostly hacked at the c2k4 hackathon, markus ok

Revision 1.41 / (download) - annotate - [select for diffs], Thu Jun 24 22:25:25 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.40: +205 -224 lines
Diff to previous 1.40 (colored)

KNF, cleanup, readability fixes... this hurt
ok itojun claudio

Revision 1.40 / (download) - annotate - [select for diffs], Tue Jun 22 07:35:20 2004 UTC (19 years, 11 months ago) by cedric
Branch: MAIN
Changes since 1.39: +1 -6 lines
Diff to previous 1.39 (colored)

Pull the plug on source-based routing until remaining bugs are eradicated.
No need to reconfig kernel or rebuild userland stuff.
requested deraadt@, help beck@

Revision 1.9.2.14 / (download) - annotate - [select for diffs], Mon Jun 7 20:41:38 2004 UTC (19 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.9.2.13: +5 -0 lines
Diff to previous 1.9.2.13 (colored) to branchpoint 1.9 (colored) next main 1.10 (colored)

sync to head

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jun 6 16:49:09 2004 UTC (20 years ago) by cedric
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A
Changes since 1.38: +6 -1 lines
Diff to previous 1.38 (colored)

extend routing table to be able to match and route packets based on
their *source* IP address in addition to their destination address.
routing table "destination" now contains a "struct sockaddr_rtin"
for IPv4 instead of a "struct sockaddr_in".
the routing socket has been extended in a backward-compatible way.
todo: PMTU enhancements, IPv6. ok deraadt@ mcbride@

Revision 1.9.2.13 / (download) - annotate - [select for diffs], Sat Jun 5 23:11:25 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.9.2.12: +56 -19 lines
Diff to previous 1.9.2.12 (colored) to branchpoint 1.9 (colored)

Merge with the trunk

Revision 1.38 / (download) - annotate - [select for diffs], Wed May 12 20:46:00 2004 UTC (20 years ago) by claudio
Branch: MAIN
Changes since 1.37: +19 -24 lines
Diff to previous 1.37 (colored)

Rework a block readded by the multipath commit that should ensure that
RTM_CHANGE/LOCK only work on perfect matching routes. ppp and bgpd got
broken because of this. Most of the code in the "grotty" block is already
done by rn_lookup() only host routes need some special treatment.
OK cedric@

Revision 1.37 / (download) - annotate - [select for diffs], Tue May 4 22:50:18 2004 UTC (20 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.36: +19 -10 lines
Diff to previous 1.36 (colored)

The tcp specific routing metrics are almost never used so reduce the routing
table from these metrics. struct rt_msghdr used by the routing socket is not
affected and so most userland apps don't need to be changed.
some man page polishing by jmc@
OK henning@ markus@ theo@

Revision 1.36 / (download) - annotate - [select for diffs], Sun Apr 25 02:48:04 2004 UTC (20 years, 1 month ago) by itojun
Branch: MAIN
Changes since 1.35: +34 -1 lines
Diff to previous 1.35 (colored)

radix tree with multipath support.  from kame.  deraadt ok
user visible changes:
- you can add multiple routes with same key (route add A B then route add A C)
- you have to specify gateway address if there are multiple entries on the table
  (route delete A B, instead of route delete A)
kernel change:
- radix_node_head has an extra entry
- rnh_deladdr takes extra argument

TODO:
- actually take advantage of multipath (rtalloc -> rtalloc_mpath)

Revision 1.9.2.12 / (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.9.2.11: +78 -48 lines
Diff to previous 1.9.2.11 (colored) to branchpoint 1.9 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.35 / (download) - annotate - [select for diffs], Thu Jan 15 10:47:55 2004 UTC (20 years, 4 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.34: +32 -1 lines
Diff to previous 1.34 (colored)

add a RTM_IFANNOUNCE message; from netbsd; ok itojun, henning

Revision 1.34 / (download) - annotate - [select for diffs], Sat Jan 3 14:08:53 2004 UTC (20 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

put an mi wrapper around stdarg.h/varargs.h. gcc3 moved stdarg/varargs macros
to built-ins, so eventually we will have one version of these files.
Special adjustments for the kernel to cope: machine/stdarg.h -> sys/stdarg.h
and machine/ansi.h needs to have a _BSD_VA_LIST_ for syslog* prototypes.
okay millert@, drahn@, miod@.

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

de-register.  deraadt ok

Revision 1.32 / (download) - annotate - [select for diffs], Fri Aug 15 20:32:19 2003 UTC (20 years, 9 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.31: +2 -3 lines
Diff to previous 1.31 (colored)

change arguments to suser.  suser now takes the process, and a flags
argument.  old cred only calls user suser_ucred.  this will allow future
work to more flexibly implement the idea of a root process.  looks like
something i saw in freebsd, but a little different.
use of suser_ucred vs suser in file system code should be looked at again,
for the moment semantics remain unchanged.
review and input from art@  testing and further review miod@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Aug 14 19:00:12 2003 UTC (20 years, 9 months ago) by jason
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

m_copyback()'s 4th arg is const void *, nuke (caddr_t) casts.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Jul 5 00:00:32 2003 UTC (20 years, 11 months ago) by itojun
Branch: MAIN
Changes since 1.29: +1 -17 lines
Diff to previous 1.29 (colored)

backout 1.29; problem reported by Rukh w/ userland ppp.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jun 24 09:09:25 2003 UTC (20 years, 11 months ago) by itojun
Branch: MAIN
Changes since 1.28: +17 -1 lines
Diff to previous 1.28 (colored)

recover code that requires exact match on rtm_change/lock (lost in netbsd 1.16).
without it "route change X" would change less-specific route by mistake.
reported by jinmei@kame, markus ok

Revision 1.9.2.11 / (download) - annotate - [select for diffs], Sat Jun 7 11:06:07 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.9.2.10: +2 -6 lines
Diff to previous 1.9.2.10 (colored) to branchpoint 1.9 (colored)

Sync SMP branch to -current

Revision 1.28 / (download) - annotate - [select for diffs], Mon Jun 2 23:28:12 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.27: +2 -6 lines
Diff to previous 1.27 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.19.2.3 / (download) - annotate - [select for diffs], Mon May 19 22:30:41 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.19.2.2: +5 -59 lines
Diff to previous 1.19.2.2 (colored) to branchpoint 1.19 (colored) next main 1.20 (colored)

sync

Revision 1.9.2.10 / (download) - annotate - [select for diffs], Tue May 13 19:36:16 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.9.2.9: +1 -55 lines
Diff to previous 1.9.2.9 (colored) to branchpoint 1.9 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.27 / (download) - annotate - [select for diffs], Wed Apr 23 01:36:52 2003 UTC (21 years, 1 month ago) by jason
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.26: +1 -55 lines
Diff to previous 1.26 (colored)

Move m_copyback() to uipc_mbuf where it makes some kinda sense; ok dhartmei

Revision 1.9.2.9 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:29 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.9.2.8: +11 -9 lines
Diff to previous 1.9.2.8 (colored) to branchpoint 1.9 (colored)

Sync the SMP branch with 3.3

Revision 1.26 / (download) - annotate - [select for diffs], Sun Feb 16 21:30:13 2003 UTC (21 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

KNF

Revision 1.25 / (download) - annotate - [select for diffs], Tue Dec 31 02:30:10 2002 UTC (21 years, 5 months ago) by itojun
Branch: MAIN
Changes since 1.24: +4 -4 lines
Diff to previous 1.24 (colored)

don't overrun user-supplied buffer.  from jinmei@kame, deraadt ok

Revision 1.19.2.2 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:46 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.19.2.1: +8 -6 lines
Diff to previous 1.19.2.1 (colored) to branchpoint 1.19 (colored)

sync to -current

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jul 17 14:20:19 2002 UTC (21 years, 10 months ago) by art
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.23: +5 -5 lines
Diff to previous 1.23 (colored)

Don't dereference freed memory.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Jul 3 02:31:00 2002 UTC (21 years, 11 months ago) by mickey
Branch: MAIN
Changes since 1.22: +3 -1 lines
Diff to previous 1.22 (colored)

fix a null deref in sysctl_iflist()

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jul 2 19:38:55 2002 UTC (21 years, 11 months ago) by nate
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

inital -> initial

Revision 1.19.2.1 / (download) - annotate - [select for diffs], Tue Jun 11 03:30:46 2002 UTC (21 years, 11 months ago) by art
Branch: UBC
Changes since 1.19: +5 -11 lines
Diff to previous 1.19 (colored)

Sync UBC branch to -current

Revision 1.9.2.8 / (download) - annotate - [select for diffs], Thu Mar 28 14:57:37 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.9.2.7: +4 -10 lines
Diff to previous 1.9.2.7 (colored) to branchpoint 1.9 (colored)

Merge in -current from roughly a week ago

Revision 1.21 / (download) - annotate - [select for diffs], Fri Mar 15 18:19:52 2002 UTC (22 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.20: +1 -7 lines
Diff to previous 1.20 (colored)

Kill #if __STDC__ used to do K&R vs. ANSI varargs/stdarg; just do things
the ANSI way.

Revision 1.20 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:10 2002 UTC (22 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.19: +5 -5 lines
Diff to previous 1.19 (colored)

First round of __P removal in sys

Revision 1.9.2.7 / (download) - annotate - [select for diffs], Wed Mar 6 02:15:07 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.9.2.6: +8 -6 lines
Diff to previous 1.9.2.6 (colored) to branchpoint 1.9 (colored)

Merge in trunk

Revision 1.19 / (download) - annotate - [select for diffs], Mon Dec 10 06:10:53 2001 UTC (22 years, 5 months ago) by jason
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.18: +9 -7 lines
Diff to previous 1.18 (colored)

use queue.h macros for TAILQ operations

Revision 1.9.2.6 / (download) - annotate - [select for diffs], Tue Nov 13 22:59:58 2001 UTC (22 years, 6 months ago) by niklas
Branch: SMP
Changes since 1.9.2.5: +2 -2 lines
Diff to previous 1.9.2.5 (colored) to branchpoint 1.9 (colored)

merge in -current

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

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.9.2.5 / (download) - annotate - [select for diffs], Wed Oct 31 03:29:03 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.9.2.4: +5 -3 lines
Diff to previous 1.9.2.4 (colored) to branchpoint 1.9 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.17 / (download) - annotate - [select for diffs], Thu Sep 20 17:02:31 2001 UTC (22 years, 8 months ago) by mpech
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jul 21 12:22:57 2001 UTC (22 years, 10 months ago) by itojun
Branch: MAIN
Changes since 1.15: +4 -2 lines
Diff to previous 1.15 (colored)

repair validation on RTAX_GENMASK insertion.  has been broken since 44bsd.
(freebsd3 has a fix since 1999, but has insufficient validation on sa_len)

Revision 1.9.2.4 / (download) - annotate - [select for diffs], Wed Jul 4 10:54:20 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.9.2.3: +10 -5 lines
Diff to previous 1.9.2.3 (colored) to branchpoint 1.9 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jun 4 23:21:10 2001 UTC (23 years ago) by itojun
Branch: MAIN
Changes since 1.14: +8 -2 lines
Diff to previous 1.14 (colored)

adjust routing socket message (kernel -> user) to the right size.
with old code we may see junk at the end.  sync with kame, 4.4BSD bug.

Revision 1.14 / (download) - annotate - [select for diffs], Wed May 16 12:53:34 2001 UTC (23 years ago) by ho
Branch: MAIN
Changes since 1.13: +3 -4 lines
Diff to previous 1.13 (colored)

No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)

Revision 1.9.2.3 / (download) - annotate - [select for diffs], Mon May 14 22:40:04 2001 UTC (23 years ago) by niklas
Branch: SMP
Changes since 1.9.2.2: +28 -23 lines
Diff to previous 1.9.2.2 (colored) to branchpoint 1.9 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jan 19 06:37:37 2001 UTC (23 years, 4 months ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.12: +19 -14 lines
Diff to previous 1.12 (colored)

pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2 (UCB copyrighted).

have sys/net/route.c:rtrequest1(), which takes rt_addrinfo * as the argument.
pass rt_addrinfo all the way down to rtrequest, and ifa->ifa_rtrequest.
3rd arg of ifa->ifa_rtrequest is now rt_addrinfo * instead of sockaddr *
(almost noone is using it anyways).

benefit: the follwoing command now works.  previously we need two route(8)
invocations, "add" then "change".
# route add -inet6 default ::1 -ifp gif0

remove unsafe typecast in rtrequest(), from rtentry * to sockaddr *.  it was
introduced by 4.3BSD-reno and never corrected.

XXX is eon_rtrequest() change correct regarding to 3rd arg?
eon_rtrequest() and rtrequest() were incorrect since 4.3BSD-reno,
so i do not have correct answer in the source code.
someone with more clue about netiso-over-ip, please help.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Dec 13 21:58:11 2000 UTC (23 years, 5 months ago) by provos
Branch: MAIN
Changes since 1.11: +12 -12 lines
Diff to previous 1.11 (colored)

have add set locks, too. okay itojun@

Revision 1.9.2.2 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:33 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.9.2.1: +10 -6 lines
Diff to previous 1.9.2.1 (colored) to branchpoint 1.9 (colored)

Sync with -current

Revision 1.11 / (download) - annotate - [select for diffs], Sun Mar 12 01:27:11 2000 UTC (24 years, 2 months ago) by itojun
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.10: +10 -6 lines
Diff to previous 1.10 (colored)

don't touch root radix node on RTM_*.  this can panic system from
non-root userland process, under certain routing table setup.
http://orange.kame.net/dev/query-pr.cgi?pr=217

Revision 1.9.2.1 / (download) - annotate - [select for diffs], Sun Feb 20 11:57:21 2000 UTC (24 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.9: +2 -89 lines
Diff to previous 1.9 (colored)

Merge in recent code from the trunk

Revision 1.10 / (download) - annotate - [select for diffs], Thu Feb 17 04:15:29 2000 UTC (24 years, 3 months ago) by itojun
Branch: MAIN
Changes since 1.9: +2 -89 lines
Diff to previous 1.9 (colored)

backout incomplete hack from KAME codebase (originally from bbn).

the hack tries to respect ifa or ifp passed to RTM_ADD.  However, the change
broke certain link-layers.  They include:
- midway ethernet card (en*), which uses sockaddr_dl in gateway portion
  to pass PVC information.  with the patch, the gateway portion will be
  overwritten by empty sockaddr_dl and PVC initialization will fail.
- IPv6, which can't set static ND table with the patch (ndp -s) with the
  similar reason.

There may be improved hack coming soon, hope the new one does not break others.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Feb 7 06:08:04 2000 UTC (24 years, 4 months ago) by itojun
Branch: MAIN
CVS Tags: SMP_BASE
Branch point for: SMP
Changes since 1.8: +12 -5 lines
Diff to previous 1.8 (colored)

make more check about mbuf len before rolling message for routing header.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Dec 8 06:50:18 1999 UTC (24 years, 6 months ago) by itojun
Branch: MAIN
CVS Tags: kame_19991208
Changes since 1.7: +123 -3 lines
Diff to previous 1.7 (colored)

bring in KAME IPv6 code, dated 19991208.
replaces NRL IPv6 layer.  reuses NRL pcb layer.  no IPsec-on-v6 support.
see sys/netinet6/{TODO,IMPLEMENTATION} for more details.

GENERIC configuration should work fine as before.  GENERIC.v6 works fine
as well, but you'll need KAME userland tools to play with IPv6 (will be
bringed into soon).

Revision 1.7 / (download) - annotate - [select for diffs], Mon Aug 24 20:39:40 1998 UTC (25 years, 9 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Don't deref NULL.

Revision 1.6 / (download) - annotate - [select for diffs], Mon May 18 21:10:21 1998 UTC (26 years ago) by provos
Branch: MAIN
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

first step to the setsockopt/getsockopt interface as described in
draft-mcdonald-simple-ipsec-api, kernel notifies (EMT_REQUESTSA) signal
userland key management applications when security services are requested.
this is only for outgoing connections at the moment, incoming packets
are not yet checked against the selected socket policy.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Dec 15 10:13:03 1997 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

fix for route change crash; from freebsd

Revision 1.4 / (download) - annotate - [select for diffs], Fri Dec 12 09:04:17 1997 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +21 -1 lines
Diff to previous 1.3 (colored)

permit non-root to use RTM_GET, but no other calls; netbsd

Revision 1.3 / (download) - annotate - [select for diffs], Sun Apr 21 22:28:44 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1, OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

partial sync with netbsd 960418, more to come

Revision 1.2 / (download) - annotate - [select for diffs], Sun Mar 3 21:07:21 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.1: +48 -26 lines
Diff to previous 1.1 (colored)

From NetBSD: 960217 merge

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:53:07 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:53:07 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

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.