/*
*/
/*
* Copyright (c) 1988, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)rtsock.c 8.6 (Berkeley) 2/11/95
*/
/*
* This file contains routines that processes routing socket requests.
*/
#include <inet/ip_ftable.h>
#include <inet/ipclassifier.h>
const tsol_gc_t *);
/*
* Send `mp' to all eligible routing queues. A queue is ineligible if:
*
* 1. SO_USELOOPBACK is off and it is not the originating queue.
* 2. RTA_UNDER_IPMP is on and RTSQ_UNDER_IPMP is not set in `flags'.
* 3. RTA_UNDER_IPMP is off and RTSQ_NORMAL is not set in `flags'.
* 4. It is not the same address family as `af', and `af' isn't AF_UNSPEC.
*/
void
{
/*
* Since we don't have an ill_t here, RTSQ_DEFAULT must already be
* resolved to one or more of RTSQ_NORMAL|RTSQ_UNDER_IPMP at this point.
*/
/*
* If there was a family specified when this routing socket was
* created and it doesn't match the family of the message to
* copy, then continue.
*/
continue;
/*
* Queue the message only if the conn_t and flags match.
*/
if (!(flags & RTSQ_UNDER_IPMP))
continue;
} else {
if (!(flags & RTSQ_NORMAL))
continue;
}
/*
* For the originating queue, we only copy the message upstream
* if loopback is set. For others reading on the routing
* socket, we check if there is room upstream for a copy of the
* message.
*/
continue;
}
/* Pass to rts_input */
/* Note that we pass a NULL ira to rts_input */
}
/* reload next_connp since conn_next may have changed */
}
}
/*
* Takes an ire and sends an ack to all the routing sockets. This
* routine is used
* - when a stale redirect is deleted
*/
void
{
return;
switch (ire->ire_ipversion) {
case IPV4_VERSION:
return;
break;
case IPV6_VERSION:
return;
break;
}
if (error != 0)
else
}
/*
* This is a call from the RTS module
* indicating that this is a Routing Socket
* Stream. Insert this conn_t in routing
* socket client list.
*/
void
{
}
/*
* This is a call from the RTS module indicating that it is closing.
*/
void
{
}
/*
* Processes requests received on a routing socket. It extracts all the
* arguments and calls the appropriate function to process the request.
*
* RTA_SRC bit flag requests are sent by 'route -setsrc'.
*
* In general, this function does not consume the message supplied but rather
* sends the message upstream with an appropriate UNIX errno.
*/
int
{
int error = 0;
int found_addrs;
goto done;
}
goto done;
}
/*
* Check the routing message for basic consistency including the
* version number and that the number of octets written is the same
* as specified by the rtm_msglen field.
*
* At this point, an error can be delivered back via rtm_errno.
*/
goto done;
}
goto done;
}
/* Only allow RTM_GET or RTM_RESOLVE for unprivileged process */
goto done;
}
&error);
if (error != 0)
goto done;
if ((found_addrs & RTA_DST) == 0) {
goto done;
}
/*
* Based on the address family of the destination address, determine
* the destination, gateway and netmask and return the appropriate error
* if an unknown address family was specified (following the errno
* values that 4.4BSD-Lite2 returns.)
*/
switch (af) {
case AF_INET:
if (((found_addrs & RTA_NETMASK) == 0) ||
else
break;
case AF_INET6:
if (((found_addrs & RTA_NETMASK) == 0) ||
break;
default:
/*
* These errno values are meant to be compatible with
* 4.4BSD-Lite2 for the given message types.
*/
case RTM_ADD:
case RTM_DELETE:
goto done;
case RTM_GET:
case RTM_CHANGE:
goto done;
default:
error = EOPNOTSUPP;
goto done;
}
}
/*
* At this point, the address family must be something known.
*/
/* Handle RTA_IFP */
if (index != 0) {
goto done;
}
/*
* Since all interfaces in an IPMP group must be equivalent,
* we prevent changes to a specific underlying interface's
* routing configuration. However, for backward compatibility,
* we intepret a request to add a route on an underlying
* interface as a request to add a route on its IPMP interface.
*/
if (IS_UNDER_IPMP(ill)) {
case RTM_CHANGE:
case RTM_DELETE:
goto done;
case RTM_ADD:
if (index == 0) {
goto done;
}
goto lookup;
}
}
/*
* This provides the same zoneid as in Solaris 10
* that -ifp picks the zoneid from the first ipif on the ill.
* But it might not be useful since the first ipif will always
* have the same zoneid as the ill.
*/
}
}
/*
* If a netmask was supplied in the message, then subsequent route
* lookups will attempt to match on the netmask as well.
*/
if ((found_addrs & RTA_NETMASK) != 0)
/*
* We only process any passed-in route security attributes for
* either RTM_ADD or RTM_CHANGE message; We overload them
* to do an RTM_GET as a different label; ignore otherwise.
*/
}
case RTM_ADD:
/* if we are adding a route, gateway is a must */
if ((found_addrs & RTA_GATEWAY) == 0) {
goto done;
}
/* Multirouting does not support net routes. */
RTF_MULTIRT) {
goto done;
}
/*
* Multirouting and user-specified source addresses
* do not support interface based routing.
* Assigning a source address to an interface based
* route is achievable by plumbing a new ipif and
* setting up the interface route via this ipif,
* though.
*/
goto done;
}
}
switch (af) {
case AF_INET:
if (src_addr != INADDR_ANY) {
/*
* The RTF_SETSRC flag is present, check that
* the supplied src address is not the loopback
* address. This would produce martian packets.
*/
goto done;
}
/*
* Also check that the supplied address is a
* valid, local one. Only allow IFF_UP ones
*/
goto done;
}
} else {
/*
* The RTF_SETSRC modifier must be associated
* to a non-null source address.
*/
goto done;
}
}
break;
case AF_INET6:
if (!IN6_IS_ADDR_UNSPECIFIED(&src_addr_v6)) {
/*
* The RTF_SETSRC flag is present, check that
* the supplied src address is not the loopback
* address. This would produce martian packets.
*/
if (IN6_IS_ADDR_LOOPBACK(&src_addr_v6)) {
goto done;
}
/*
* Also check that the supplied address is a
* valid, local one. Only allow UP ones.
*/
goto done;
}
break;
}
/*
* The RTF_SETSRC modifier must be associated
* to a non-null source address.
*/
goto done;
}
break;
}
if (error != 0)
goto done;
break;
case RTM_DELETE:
/* if we are deleting a route, gateway is a must */
if ((found_addrs & RTA_GATEWAY) == 0) {
goto done;
}
/*
* The RTF_SETSRC modifier does not make sense
* when deleting a route.
*/
goto done;
}
switch (af) {
case AF_INET:
break;
case AF_INET6:
break;
}
break;
case RTM_GET:
case RTM_CHANGE:
/*
* In the case of RTM_GET, the forwarding table should be
* searched recursively. Also, if a gateway was
* specified then the gateway address must also be matched.
*
* In the case of RTM_CHANGE, the gateway address (if supplied)
* is the new gateway address so matching on the gateway address
* is not done. This can lead to ambiguity when looking up the
* route to change as usually only the destination (and netmask,
* if supplied) is used for the lookup. However if a RTA_IFP
* sockaddr is also supplied, it can disambiguate which route to
* change provided the ambigous routes are tied to distinct
* ill's (or interface indices). If the routes are not tied to
* any particular interfaces (for example, with traditional
* gateway routes), then a RTA_IFP sockaddr will be of no use as
* it won't match any such routes.
* RTA_SRC is not supported for RTM_GET and RTM_CHANGE,
* except when RTM_CHANGE is combined to RTF_SETSRC.
*/
if (((found_addrs & RTA_SRC) != 0) &&
error = EOPNOTSUPP;
goto done;
}
if ((found_addrs & RTA_GATEWAY) != 0)
if (ioc_cr)
if (rtsa_validate(rtsap) != 0) {
goto done;
}
goto done;
}
tsl = labelalloc(
}
}
if ((found_addrs & RTA_GATEWAY) &&
/*
* Do not want to change the gateway,
* but rather the source address.
*/
}
}
/*
* If the netmask is all ones (either as supplied or as derived
* above), then first check for an IRE_LOOPBACK or
* IRE_LOCAL entry.
*
* If we didn't check for or find an IRE_LOOPBACK or IRE_LOCAL
* entry, then look for any other type of IRE.
*/
switch (af) {
case AF_INET:
if (net_mask == IP_HOST_MASK) {
}
}
break;
case AF_INET6:
NULL);
}
&gwattr);
}
break;
}
goto done;
}
/*
* Want to return failure if we get an IRE_NOROUTE from
* ire_route_recursive
*/
goto done;
}
/* we know the IRE before we come here */
case RTM_GET:
goto done;
}
break;
case RTM_CHANGE:
/*
* Do not allow to the multirouting state of a route
* to be changed. This aims to prevent undesirable
* stages where both multirt and non-multirt routes
* for the same destination are declared.
*/
goto done;
}
/*
* Note that we do not need to do
* ire_flush_cache_*(IRE_FLUSH_ADD) as a change
* in metrics or gateway will not affect existing
* routes since it does not create a more specific
* route.
*/
switch (af) {
case AF_INET:
if ((found_addrs & RTA_GATEWAY) != 0 &&
}
goto done;
}
}
if ((found_addrs & RTA_SRC) != 0 &&
if (src_addr != INADDR_ANY) {
/*
* The RTF_SETSRC flag is
* present, check that the
* supplied src address is not
* the loopback address. This
* would produce martian
* packets.
*/
if (src_addr ==
htonl(INADDR_LOOPBACK)) {
goto done;
}
/*
* Also check that the
* supplied addr is a valid
* local address.
*/
ipst);
if (!(type &
(IRE_LOCAL|IRE_LOOPBACK))) {
goto done;
}
} else {
}
/*
* Let conn_ixa caching know that
* source address selection changed
*/
}
break;
case AF_INET6:
if ((found_addrs & RTA_GATEWAY) != 0 &&
}
goto done;
}
}
if ((found_addrs & RTA_SRC) != 0 &&
if (!IN6_IS_ADDR_UNSPECIFIED(
&src_addr_v6)) {
/*
* The RTF_SETSRC flag is
* present, check that the
* supplied src address is not
* the loopback address. This
* would produce martian
* packets.
*/
if (IN6_IS_ADDR_LOOPBACK(
&src_addr_v6)) {
goto done;
}
/*
* Also check that the
* supplied addr is a valid
* local address.
*/
ipst);
if (!(type &
(IRE_LOCAL|IRE_LOOPBACK))) {
goto done;
}
} else {
}
/*
* Let conn_ixa caching know that
* source address selection changed
*/
}
break;
}
/*
* Create and add the security attribute to
* prefix IRE; it will add a reference to the
* group upon allocating a new entry. If it
* finds an already-existing entry for the
* security attribute, it simply returns it
* and no new group reference is made.
*/
GC_REFRELE(gc);
} else {
/* gc_create failed */
}
goto done;
}
}
break;
}
break;
default:
error = EOPNOTSUPP;
break;
}
done:
if (gcgrp_xtraref)
if (error != 0) {
/* Send error ACK */
} else {
/* OK ACK already set up by caller except this */
ip2dbg(("ip_rts_request: OK ACK\n"));
}
}
return (error);
}
/*
* Helper function that can do recursive lookups including when
*/
static ire_t *
{
*v4setsrcp = INADDR_ANY;
/* Skip IRE_IF_CLONE */
/*
* ire_route_recursive can't match gateway or mask thus if they are
* set we have to do two steps of lookups
*/
return (ire);
return (ire);
}
/* The first ire_gw_secattr is passed back */
}
/* Look for an interface ire recursively based on the gateway */
/*
* Don't allow anything unusual past the first iteration.
* After the first lookup, we should no longer look for
* (IRE_LOCAL|IRE_LOOPBACK|IRE_BROADCAST) or RTF_INDIRECT
* routes.
*
* In addition, after we have found a direct IRE_OFFLINK,
* we should only look for interface or clone routes.
*/
} else {
/*
* no more local, loopback, broadcast routes
*/
if (!(match_flags & MATCH_IRE_TYPE))
}
} else {
}
return (ire);
}
static ire_t *
{
/* Skip IRE_IF_CLONE */
/*
* ire_route_recursive can't match gateway or mask thus if they are
* set we have to do two steps of lookups
*/
return (ire);
return (ire);
&ire->ire_setsrc_addr_v6));
}
/* The first ire_gw_secattr is passed back */
}
/*
* Don't allow anything unusual past the first iteration.
* After the first lookup, we should no longer look for
* (IRE_LOCAL|IRE_LOOPBACK|IRE_BROADCAST) or RTF_INDIRECT
* routes.
*
* In addition, after we have found a direct IRE_OFFLINK,
* we should only look for interface or clone routes.
*/
} else {
/*
* no more local, loopback routes
*/
if (!(match_flags & MATCH_IRE_TYPE))
}
NULL);
} else {
}
return (ire);
}
/*
* Handle IP_IOC_RTS_REQUEST ioctls
*/
int
{
int error = 0;
/* ioc_mp holds mp */
/*
* The Routing Socket data starts on
* next block. If there is no next block
* this is an indication from routing module
* that it is a routing socket stream queue.
* We need to support that for compatibility with SDP since
* it has a contract private interface to use IP_IOC_RTS_REQUEST.
* Note: SDP no longer uses IP_IOC_RTS_REQUEST - we can remove this.
*/
/*
* This is a message from SDP
* indicating that this is a Routing Socket
* Stream. Insert this conn_t in routing
* socket client list.
*/
goto done;
}
goto done;
}
done:
/* Note that we pass a NULL ira to rts_input */
/* conn was refheld in ip_wput_ioctl. */
return (error);
}
/*
* Build a reply to the RTM_GET request contained in the given message block
* using the retrieved IRE of the destination address, the parent IRE (if it
* exists) and the address family.
*
* Returns a pointer to a message block containing the reply if successful,
* otherwise NULL is returned.
*/
static mblk_t *
{
int rtm_addrs;
int rtm_flags;
/*
* Find the ill used to send packets. This will be NULL in case
* of a reject or blackhole.
*/
else
}
}
/*
* Always return RTA_DST, RTA_GATEWAY and RTA_NETMASK.
*
* RTA_IFP and RTA_IFA if either is defined, and also
* returns RTA_BRD if the appropriate interface is
* point-to-point.
*/
/*
* We associate an IRE with an ILL, hence we don't exactly
* know what might make sense for RTA_IFA and RTA_BRD. We
* pick the first ipif on the ill.
*/
else
else
}
}
}
return (NULL);
}
/*
* We set the destination address, gateway address,
* netmask and flags in the RTM_GET response depending
* on whether we found a parent IRE or not.
* In particular, if we did find a parent IRE during the
* recursive search, use that IRE's gateway address.
* Otherwise, we use the IRE's source address for the
* gateway address.
*/
switch (af) {
case AF_INET:
if (v4setsrc != INADDR_ANY)
break;
case AF_INET6:
if (!IN6_IS_ADDR_UNSPECIFIED(setsrc))
break;
}
/*
* The rtm_msglen, rtm_version and rtm_type fields in
* RTM_GET response are filled in by rts_fill_msg.
*
* rtm_addrs and rtm_flags are filled in based on what
* was requested and the state of the IREs looked up
* above.
*
* rtm_inits and rtm_rmx are filled in with metrics
* based on whether a parent IRE was found or not.
*
* TODO: rtm_index and rtm_use should probably be
* filled in with something resonable here and not just
* copied from the request.
*/
return (new_mp);
}
/*
* Fill the given if_data_t with interface statistics.
*/
static void
{
/* ethernet, tokenring, etc */
/* metric (external only) */
/* protocol. */
}
/*
* Set the metrics on a forwarding table route.
*/
static void
{
/* Need to add back some metrics to the IRE? */
/*
* Bypass obtaining the lock and searching ill_saved_ire_mp in the
* common case of no metrics.
*/
if (which == 0)
return;
/*
* iulp_rtt and iulp_rtt_sd are in milliseconds, but 4.4BSD-Lite2's
* microseconds.
*/
if (which & RTV_RTTVAR)
/*
* Update the metrics in the IRE itself.
*/
if (which & RTV_SSTHRESH)
if (which & RTV_RTTVAR)
/*
* Search through the ifrt_t chain hanging off the ILL in order to
* reflect the metric change there.
*/
return;
}
/*
* On a given ill, the tuple of address, gateway, mask,
* ire_type and zoneid unique for each saved IRE.
*/
&ire->ire_addr_v6) ||
&gw_addr_v6) ||
&ire->ire_mask_v6))
continue;
} else {
continue;
}
continue;
if (which & RTV_SSTHRESH) {
}
if (which & RTV_RTTVAR)
break;
}
/*
* Update any IRE_IF_CLONE hanging created from this IRE_IF so they
* get any new iulp_mtu.
* We do that by deleting them; ire_create_if_clone will pick
* up the new metrics.
*/
}
/*
* Get the metrics from a forwarding table route.
*/
static int
{
int metrics_set = 0;
/*
* iulp_rtt and iulp_rtt_sd are in milliseconds, but 4.4BSD-Lite2's
* microseconds.
*/
metrics_set |= RTV_RTT;
metrics_set |= RTV_MTU;
metrics_set |= RTV_MTU;
}
metrics_set |= RTV_SPIPE;
metrics_set |= RTV_RPIPE;
return (metrics_set);
}
/*
* Given two sets of metrics (src and dst), use the dst values if they are
* set. If a dst value is not set but the src value is set, then we use
* the src value.
* dst is updated with the new values.
* This is used to merge information from a dce_t and ire_metrics, where the
* dce values takes precedence.
*/
void
{
return;
if (dst->iulp_ssthresh == 0)
if (dst->iulp_rtt_sd == 0)
if (dst->iulp_spipe == 0)
if (dst->iulp_rpipe == 0)
if (dst->iulp_rtomax == 0)
if (dst->iulp_tstamp_ok == 0)
if (dst->iulp_wscale_ok == 0)
if (dst->iulp_ecn_ok == 0)
if (dst->iulp_pmtud_ok == 0)
}
/*
* Takes a pointer to a routing message and extracts necessary info by looking
* at the rtm->rtm_addrs bits and store the requested sockaddrs in the pointers
* passed (all of which must be valid).
*
* The bitmask of sockaddrs actually found in the message is returned, or zero
* is returned in the case of an error.
*/
static int
{
int i;
int addr_bits;
int length;
int found_addrs = 0;
*indexp = 0;
*error = 0;
/*
* At present we handle only RTA_DST, RTA_GATEWAY, RTA_NETMASK, RTA_IFP,
* RTA_IFA and RTA_AUTHOR. The rest will be added as we need them.
*/
/*
* The address family we are working with starts out as
* AF_UNSPEC, but is set to the one specified with the
* destination address.
*
* If the "working" address family that has been set to
* something other than AF_UNSPEC, then the address family of
* subsequent sockaddrs must either be AF_UNSPEC (for
* compatibility with older programs) or must be the same as our
* "working" one.
*
* This code assumes that RTA_DST (1) comes first in the loop.
*/
if (addr_bits == 0)
continue;
switch (addr_bits) {
case RTA_DST:
break;
case RTA_GATEWAY:
return (0);
break;
case RTA_NETMASK:
return (0);
break;
case RTA_IFP:
return (0);
size = sizeof (struct sockaddr_dl);
break;
case RTA_SRC:
/* Source address of the incoming packet */
break;
case RTA_IFA:
return (0);
break;
case RTA_AUTHOR:
return (0);
break;
default:
return (0);
}
if (size == 0)
return (0);
found_addrs |= addr_bits;
}
/*
* Parse the routing message and look for any security-
* related attributes for the route. For each valid
* route security attributes.
*/
}
return (found_addrs);
}
/*
* Fills the message with the given info.
*/
static void
{
int i;
/*
* First find the type of the message
* and its length.
*/
/*
* Now find the size of the data
* that follows the message header.
*/
for (i = 0; i < RTA_NUMBITS; i++) {
switch (rtm_addrs & (1 << i)) {
case RTA_DST:
break;
case RTA_GATEWAY:
break;
case RTA_NETMASK:
break;
case RTA_IFP:
break;
case RTA_IFA:
break;
case RTA_SRC:
break;
case RTA_AUTHOR:
break;
case RTA_BRD:
/*
* RTA_BRD is used typically to specify a point-to-point
* destination address.
*/
break;
}
}
}
/*
* set the fields that are common to
* to different messages.
*/
}
/*
* Allocates and initializes a routing socket message.
* Note that sacnt is either zero or one.
*/
mblk_t *
{
return (mp);
return (mp);
}
/*
* Returns the size of the routing
* socket message header size.
*/
{
switch (type) {
case RTM_DELADDR:
case RTM_NEWADDR:
case RTM_CHGADDR:
case RTM_FREEADDR:
return (sizeof (ifa_msghdr_t));
case RTM_IFINFO:
return (sizeof (if_msghdr_t));
default:
return (sizeof (rt_msghdr_t));
}
}
/*
* Returns the size of the message needed with the given rtm_addrs and family.
*
* It is assumed that all of the sockaddrs (with the exception of RTA_IFP) are
* of the same family (currently either AF_INET or AF_INET6).
*/
{
int i;
for (i = 0; i < RTA_NUMBITS; i++) {
switch (rtm_addrs & (1 << i)) {
case RTA_IFP:
length += sizeof (struct sockaddr_dl);
break;
case RTA_DST:
case RTA_GATEWAY:
case RTA_NETMASK:
case RTA_SRC:
case RTA_IFA:
case RTA_AUTHOR:
case RTA_BRD:
switch (af) {
case AF_INET:
break;
case AF_INET6:
break;
}
break;
}
}
if (sacnt > 0)
return (length);
}
/*
* This routine is called to generate a message to the routing
* socket indicating that a redirect has occured, a routing lookup
* has failed, or that a protocol has detected timeouts to a particular
* destination. This routine is called for message types RTM_LOSING,
* RTM_REDIRECT, and RTM_MISS.
*/
void
{
if (rtm_addrs == 0)
return;
return;
}
/*
* This routine is called to generate a message to the routing
* socket indicating that the status of a network interface has changed.
* Message type generated RTM_IFINFO.
*/
void
{
}
void
{
/*
* This message should be generated only
* when the physical device is changing
* state.
*/
return;
return;
} else {
return;
}
if (flags & RTSQ_DEFAULT) {
/*
* If this message is for an underlying interface, prevent
* "normal" (IPMP-unaware) routing sockets from seeing it.
*/
flags &= ~RTSQ_NORMAL;
}
}
/*
* If cmd is RTM_ADD or RTM_DELETE, generate the rt_msghdr_t message;
* otherwise (RTM_NEWADDR, RTM_DELADDR, RTM_CHGADDR and RTM_FREEADDR)
* generate the ifa_msghdr_t message.
*/
static void
{
int rtm_addrs;
/*
* Do not report unspecified address if this is the RTM_CHGADDR or
* RTM_FREEADDR message.
*/
return;
return;
}
}
else
else
return;
switch (af) {
case AF_INET:
ipif->ipif_pp_dst_addr, 0,
break;
case AF_INET6:
break;
}
ifam->ifam_index =
} else {
switch (af) {
case AF_INET:
break;
case AF_INET6:
break;
}
if (error == 0)
}
}
/*
* This is called to generate messages to the routing socket
* indicating a network interface has had addresses associated with it.
*/
void
{
if (flags & RTSQ_DEFAULT) {
/*
* If this message is for an underlying interface, prevent
* "normal" (IPMP-unaware) routing sockets from seeing it.
*/
flags &= ~RTSQ_NORMAL;
}
/*
* Let conn_ixa caching know that source address selection
* changed
*/
/*
* If the request is DELETE, send RTM_DELETE and RTM_DELADDR.
* if the request is ADD, send RTM_NEWADDR and RTM_ADD.
* otherwise simply send the request.
*/
switch (cmd) {
case RTM_ADD:
break;
case RTM_DELETE:
break;
default:
break;
}
}
/*
* Based on the address family specified in a sockaddr, copy the address field
* into an in6_addr_t.
*
* In the case of AF_UNSPEC, we assume the family is actually AF_INET for
* compatibility with programs that leave the family cleared in the sockaddr.
* Callers of rts_copyfromsockaddr should check the family themselves if they
* wish to verify its value.
*
* In the case of AF_INET6, a check is made to ensure that address is not an
* IPv4-mapped address.
*/
{
case AF_INET:
case AF_UNSPEC:
return (sizeof (sin_t));
case AF_INET6:
if (IN6_IS_ADDR_V4MAPPED(addrp))
return (0);
return (sizeof (sin6_t));
default:
return (0);
}
}