1.\" $OpenBSD: rtalloc.9,v 1.3 2014/12/05 16:55:53 schwarze 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: December 5 2014 $ 18.Dt RTALLOC 9 19.Os 20.Sh NAME 21.Nm rtalloc , 22.Nm rtalloc_mpath , 23.Nm rtfree 24.Nd routing entry interface 25.Sh SYNOPSIS 26.In sys/types.h 27.In sys/socket.h 28.In net/route.h 29.Ft struct rtentry * 30.Fn rtalloc "struct sockaddr *dst" "int flags" "unsigned int rtableid" 31.Ft struct rtentry * 32.Fn rtalloc_mpath "struct sockaddr *dst" "uint32_t *src" "unsigned int rtableid" 33.Ft void 34.Fn rtfree "struct rtentry *rt" 35.Sh DESCRIPTION 36The 37.Fn rtalloc 38function looks in the routing table 39.Fa rtableid 40for an entry matching 41.Fa dst . 42The following 43.Fa flags 44can be specified: 45.Bl -tag -width RT_RESOLVE -offset indent 46.It Dv RT_REPORT 47Notify the routing sockets if the lookup fails. 48.It Dv RT_RESOLVE 49Allocate and return a cloned entry for 50.Fa dst 51if it does not exist and the lookup returned a cloning entry. 52.El 53.Pp 54The 55.Fn rtalloc_mpath 56function does the same as 57.Fn rtalloc 58with the 59.Dv RT_REPORT 60and 61.Dv RT_RESOLVE 62.Fa flags , 63but selects a multipath routing entry corresponding to 64.Fa src 65when possible. 66.Pp 67The 68.Fn rtfree 69function releases a reference to the routing entry 70.Fa rt , 71freeing it if the reference count drops to 0. 72.Sh CONTEXT 73.Fn rtalloc , 74.Fn rtalloc_mpath , 75and 76.Fn rtfree 77can be called during autoconf, from process context, or from interrupt context. 78.Sh SEE ALSO 79.Xr route 4 , 80.Xr rtrequest1 9 81