xref: /openbsd-src/share/man/man9/rt_ifa_add.9 (revision 8f960e22352b7ad1b6bb02e6c7de9ee6f54a819f)
1.\"	$OpenBSD: rt_ifa_add.9,v 1.6 2019/02/13 23:47:43 dlg 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: February 13 2019 $
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.Fo rt_ifa_add
33.Fa "struct ifaddr *ifa"
34.Fa "int flags"
35.Fa "struct sockaddr *dst"
36.Fa "unsigned int rdomain"
37.Fc
38.Ft int
39.Fo rt_ifa_del
40.Fa "struct ifaddr *ifa"
41.Fa "int flags"
42.Fa "struct sockaddr *dst"
43.Fa "unsigned int rdomain"
44.Fc
45.Ft int
46.Fn rt_ifa_addlocal "struct ifaddr *ifa"
47.Ft int
48.Fn rt_ifa_dellocal "struct ifaddr *ifa"
49.Sh DESCRIPTION
50These functions create and delete routing entries required by the network
51stack and managed by the kernel.
52.Bl -tag -width rt_ifa_addlocalxx
53.It Fn rt_ifa_add
54Creates and associates a connected routing entry with
55.Fa ifa
56in the routing domain specified by
57.Fa rdomain .
58.Pp
59Connected routing entries represent routes to prefixes and should be created
60with
61.Dv RTF_CLONING
62in
63.Fa flags
64and the address of
65.Fa ifa
66in
67.Fa dst .
68But for Point-to-Point interfaces, connected routing entries represent routes
69to hosts and should be created
70with
71.Dv RTF_HOST
72in
73.Fa flags
74and the destination address in
75.Fa dst .
76Connected routing entries have a priority of
77.Dv RTP_CONNECTED .
78.It Fn rt_ifa_del
79Removes the connected routing entry associated with
80.Fa ifa
81in the routing domain specified by
82.Fa rdomain .
83.It Fn rt_ifa_addlocal
84Creates and associates a local routing entry
85with
86.Fa ifa .
87.Pp
88Local routing entries are used to not send packets destined to a local
89address on the wire and instead redirect them to
90.Xr lo 4 .
91They have the lowest priority available,
92.Dv RTP_LOCAL ,
93and contain a special flag,
94.Dv RTF_LOCAL ,
95that can be checked to determine if the address is configured on the system.
96.It Fn rt_ifa_dellocal
97Removes the local routing entry associated with
98.Fa ifa .
99.El
100.Sh CONTEXT
101.Fn rt_ifa_add ,
102.Fn rt_ifa_del ,
103.Fn rt_ifa_addlocal ,
104and
105.Fn rt_ifa_dellocal
106can be called during autoconf, from process context, or from interrupt context.
107.Sh RETURN VALUES
108.Fn rt_ifa_add ,
109.Fn rt_ifa_del ,
110.Fn rt_ifa_addlocal ,
111and
112.Fn rt_ifa_dellocal
113will return
114.Dv 0
115on success and the return value of
116.Xr rtrequest 9
117otherwise.
118.Sh SEE ALSO
119.Xr lo 4 ,
120.Xr route 4 ,
121.Xr rtrequest 9
122