xref: /openbsd-src/share/man/man9/rt_ifa_add.9 (revision 0b7734b3d77bb9b21afec6f4621cae6c805dbd45)
1.\"	$OpenBSD: rt_ifa_add.9,v 1.5 2015/10/30 09:48:03 bluhm Exp $
2.\"
3.\" Copyright (c) 2014 Martin Pieuchot
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: October 30 2015 $
18.Dt RT_IFA_ADD 9
19.Os
20.Sh NAME
21.Nm rt_ifa_add ,
22.Nm rt_ifa_del ,
23.Nm rt_ifa_addlocal ,
24.Nm rt_ifa_dellocal
25.Nd add or delete routing entries associated with an address
26.Sh SYNOPSIS
27.In sys/types.h
28.In sys/socket.h
29.In net/if.h
30.In net/route.h
31.Ft int
32.Fn rt_ifa_add "struct ifaddr *ifa" "int flags" "struct sockaddr *dst"
33.Ft int
34.Fn rt_ifa_del "struct ifaddr *ifa" "int flags" "struct sockaddr *dst"
35.Ft int
36.Fn rt_ifa_addlocal "struct ifaddr *ifa"
37.Ft int
38.Fn rt_ifa_dellocal "struct ifaddr *ifa"
39.Sh DESCRIPTION
40These functions create and delete routing entries required by the network
41stack and managed by the kernel.
42.Bl -tag -width rt_ifa_addlocalxx
43.It Fn rt_ifa_add
44Creates and associates a connected routing entry with
45.Fa ifa .
46.Pp
47Connected routing entries represent routes to prefixes and should be created
48with
49.Dv RTF_CLONING
50in
51.Fa flags
52and the address of
53.Fa ifa
54in
55.Fa dst .
56But for Point-to-Point interfaces, connected routing entries represent routes
57to hosts and should be created
58with
59.Dv RTF_HOST
60in
61.Fa flags
62and the destination address in
63.Fa dst .
64Connected routing entries have a priority of
65.Dv RTP_CONNECTED .
66.It Fn rt_ifa_del
67Removes the connected routing entry associated with
68.Fa ifa .
69.It Fn rt_ifa_addlocal
70Creates and associates a local routing entry
71with
72.Fa ifa .
73.Pp
74Local routing entries are used to not send packets destined to a local
75address on the wire and instead redirect them to
76.Xr lo 4 .
77They have the lowest priority available,
78.Dv RTP_LOCAL ,
79and contain a special flag,
80.Dv RTF_LOCAL ,
81that can be checked to determine if the address is configured on the system.
82.It Fn rt_ifa_dellocal
83Removes the local routing entry associated with
84.Fa ifa .
85.El
86.Sh CONTEXT
87.Fn rt_ifa_add ,
88.Fn rt_ifa_del ,
89.Fn rt_ifa_addlocal ,
90and
91.Fn rt_ifa_dellocal
92can be called during autoconf, from process context, or from interrupt context.
93.Sh RETURN VALUES
94.Fn rt_ifa_add ,
95.Fn rt_ifa_del ,
96.Fn rt_ifa_addlocal ,
97and
98.Fn rt_ifa_dellocal
99will return
100.Dv 0
101on success and the return value of
102.Xr rtrequest 9
103otherwise.
104.Sh SEE ALSO
105.Xr lo 4 ,
106.Xr route 4 ,
107.Xr rtrequest 9
108