summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-10 13:47:22 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-10 13:47:22 +0000
commite11d6a96c6407cab89d8308023585638234b759e (patch)
tree98be7f3f4757d2deefa44b3784ff1327fb9cf4f5 /share
parentaf6cd88a028214570cecb5b78955e01dda5a9092 (diff)
Retire rtinit() an use rt_ifa_add(9) and rt_ifa_del(9) to manage
connected routes to prefixes/hosts. Since the introduction of rt_ifa_addloop(9) and rt_ifa_delloop(9), rtinit() was just a wrapper, so use the underlying functions directly and document them. Inputs from and ok mikeb@, manpage tweaks from jmc@
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile12
-rw-r--r--share/man/man9/rt_ifa_add.9103
2 files changed, 110 insertions, 5 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index dd0659ae6a6..247d2b61aff 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.207 2014/04/03 03:57:42 tedu Exp $
+# $OpenBSD: Makefile,v 1.208 2014/04/10 13:47:21 mpi Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -25,8 +25,8 @@ MAN= altq.9 aml_evalnode.9 atomic_add_int.9 atomic_cas_uint.9 \
panic.9 pci_conf_read.9 pci_intr_map.9 pfind.9 physio.9 pmap.9 \
pool.9 powerhook_establish.9 ppsratecheck.9 printf.9 psignal.9 \
radio.9 arc4random.9 rasops.9 ratecheck.9 resettodr.9 rssadapt.9 \
- route.9 rt_timer_add.9 rtable_add.9 rtlabel_id2name.9 rtrequest1.9 \
- rwlock.9 sensor_attach.9 \
+ rt_ifa_add.9 rt_timer_add.9 route.9 rtable_add.9 rtlabel_id2name.9 \
+ rtrequest1.9 rwlock.9 sensor_attach.9 \
shutdownhook_establish.9 tsleep.9 spl.9 startuphook_establish.9 \
socreate.9 sosplice.9 style.9 syscall.9 systrace.9 sysctl_int.9 \
task_add.9 tc_init.9 time.9 timeout.9 tvtohz.9 uiomove.9 uvm.9 \
@@ -310,13 +310,15 @@ MLINKS+=rssadapt.9 ieee80211_rssadapt_choose.9 \
MLINKS+=route.9 rt_lookup.9 route.9 rtalloc.9 route.9 rtalloc_noclone.9 \
route.9 rtalloc1.9 route.9 rtfree.9 route.9 rt_setgate.9 \
route.9 rtredirect.9 route.9 rtdeletemsg.9
-MLINKS+=rtable_add.9 rtable_exists.9 rtable_add.9 rtable_get.9 \
- rtable_add.9 rtable_l2.9 rtable_add.9 rtable_l2set.9
+MLINKS+=rt_ifa_add.9 rt_ifa_del.9 rt_ifa_add.9 rt_ifa_addloop.9 \
+ rt_ifa_add.9 rt_ifa_delloop.9
MLINKS+=rt_timer_add.9 rt_timer_queue_create.9 \
rt_timer_add.9 rt_timer_queue_count.9 \
rt_timer_add.9 rt_timer_queue_change.9 \
rt_timer_add.9 rt_timer_queue_destroy.9 \
rt_timer_add.9 rt_timer_remove_all.9
+MLINKS+=rtable_add.9 rtable_exists.9 rtable_add.9 rtable_get.9 \
+ rtable_add.9 rtable_l2.9 rtable_add.9 rtable_l2set.9
MLINKS+=rtlabel_id2name.9 rtlabel_name2id.9 \
rtlabel_id2name.9 rtlabel_id2sa.9 rtlabel_id2name.9 rtlabel_unref.9
MLINKS+=rwlock.9 rw_init.9 rwlock.9 rw_enter.9 rwlock.9 rw_exit.9 \
diff --git a/share/man/man9/rt_ifa_add.9 b/share/man/man9/rt_ifa_add.9
new file mode 100644
index 00000000000..8e13cb0c4f6
--- /dev/null
+++ b/share/man/man9/rt_ifa_add.9
@@ -0,0 +1,103 @@
+.\" $OpenBSD: rt_ifa_add.9,v 1.1 2014/04/10 13:47:21 mpi Exp $
+.\"
+.\" Copyright (c) 2014 Martin Pieuchot
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: April 10 2014 $
+.Dt RT_IFA_ADD 9
+.Os
+.Sh NAME
+.Nm rt_ifa_add ,
+.Nm rt_ifa_del ,
+.Nm rt_ifa_addloop ,
+.Nm rt_ifa_delloop
+.Nd add or delete routes associated with an address
+.Sh SYNOPSIS
+.In sys/socket.h
+.In net/if.h
+.In net/route.h
+.Ft int
+.Fn rt_ifa_add "struct ifaddr *ifa" "int flags" "struct sockaddr *dst"
+.Ft int
+.Fn rt_ifa_del "struct ifaddr *ifa" "int flags" "struct sockaddr *dst"
+.Ft void
+.Fn rt_ifa_addloop "struct ifaddr *ifa"
+.Ft void
+.Fn rt_ifa_delloop "struct ifaddr *ifa"
+.Sh DESCRIPTION
+These functions create and delete routes required by the network stack
+and managed by the kernel.
+.Bl -tag -width rt_ifa_addloopxx
+.It Fn rt_ifa_add
+Creates and associates a connected route with
+.Fa ifa .
+.Pp
+Connected routes are mostly routes to prefixes and should be created with
+.Dv RTF_CLONING
+in
+.Fa flags
+and the address of
+.Fa ifa
+in
+.Fa dst .
+But for Point-to-Point interfaces, connected routes are routes to hosts and
+should be created
+with
+.Dv RTF_HOST
+in
+.Fa flags
+and the destination address in
+.Fa dst .
+Connected routes have a priority of
+.Dv RTP_CONNECTED .
+.It Fn rt_ifa_del
+Removes the connected route associated with
+.Fa ifa .
+.It Fn rt_ifa_addloop
+Creates and associates a local route
+with
+.Fa ifa .
+.Pp
+Local routes are used to not send packets destined to a local address on the
+wire and instead redirect them to
+.Xr lo 4 .
+They have the lowest priority available,
+.Dv RTP_LOCAL ,
+and contain a special flag,
+.Dv RTF_LOCAL ,
+that can be checked to determine if the address is configured on the system.
+.It Fn rt_ifa_delloop
+Removes the local route associated with
+.Fa ifa .
+.El
+.Sh CONTEXT
+.Fn rt_ifa_add ,
+.Fn rt_ifa_del ,
+.Fn rt_ifa_addloop ,
+and
+.Fn rt_ifa_delloop
+can be called during autoconf, from process context, or from interrupt context.
+.Sh RETURN VALUES
+.Fn rt_ifa_add
+and
+.Fn rt_ifa_del
+will return
+.Dv 0
+on success and the return value of
+.Xr rtrequest1 9
+otherwise.
+.Sh SEE ALSO
+.Xr lo 4 ,
+.Xr route 4 ,
+.Xr rtrequest1 9