1.\" $OpenBSD: route.9,v 1.17 2017/01/11 15:09:52 rzalamena Exp $ 2.\" 3.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org> 4.\" All rights reserved. 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: January 11 2017 $ 19.Dt RT_SETGATE 9 20.Os 21.Sh NAME 22.Nm rt_setgate , 23.Nm rtredirect , 24.Nm rtdeletemsg 25.Nd kernel routing interface 26.Sh SYNOPSIS 27.In net/route.h 28.Ft int 29.Fn rt_setgate "struct rtentry *rt" "struct sockaddr *gate" "u_int tableid" 30.Ft void 31.Fn rtredirect "struct sockaddr *dst" "struct sockaddr *gateway" \ 32"struct sockaddr *src" "struct rtentry **rtp" "unsigned int rdomain" 33.Ft int 34.Fn rtdeletemsg "struct rtentry *rt" "struct ifnet *ifp" "u_int tableid" 35.Sh DESCRIPTION 36Routing entries describe the routes to be taken by packets in a router. 37.Bl -tag -width Ds 38.It Fn rt_setgate "struct rtentry *rt" "struct sockaddr *gate" "u_int tableid" 39Set the address of the gateway for routes described by 40.Fa rt 41to 42.Fa gate . 43If memory must be allocated to hold the gateway address, 44the address for which 45.Fa rt 46describes routes will be copied from 47.Fa gate . 48.It Fn rtredirect "struct sockaddr *dst" "struct sockaddr *gateway" \ 49"struct sockaddr *src" "struct rtentry **rtp" "unsigned int rdomain" 50Redirect routes to 51.Fa dst 52through 53.Fa gateway , 54such as in response to an ICMP redirect message. 55.Fa src 56should be the address from which the redirect message was received. 57If 58.Fa rtp 59is not NULL, 60it will be populated by the routing entry corresponding to 61.Fa dst . 62.It Fn rtdeletemsg "struct rtentry *rt" "struct ifnet *ifp" "u_int tableid" 63Delete routing table entry 64.Fa rt 65from table 66.Fa tableid 67and forward a notification message to all 68.Fa AF_ROUTE 69sockets. 70.El 71.Sh RETURN VALUES 72.Fn rt_setgate 73may fail with: 74.Pp 75.Bl -tag -width Er -compact 76.It Bq Er ENOBUFS 77Memory could not be allocated for the gateway. 78.El 79.Pp 80.Fn rtdeletemsg 81may fail with: 82.Pp 83.Bl -tag -width Er -compact 84.It Bq Er EAFNOSUPPORT 85The protocol used by 86.Fa rt 87is not supported by table with ID 88.Fa tableid . 89.It Bq Er ESRCH 90No routing entry for 91.Fa rt 92could be found. 93.It Bq Er ESRCH 94.Fa rt 95is a multipath routing entry that conflicts with an existing one. 96.El 97.Sh SEE ALSO 98.Xr route 4 , 99.Xr route 8 , 100.Xr rt_timer_add 9 , 101.Xr rtable_add 9 , 102.Xr rtlabel_id2name 9 , 103.Xr rtrequest 9 104