4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 /* Copyright (c) 1990 Mentat Inc. */
  26 
  27 #include <sys/types.h>
  28 #include <sys/stream.h>
  29 #include <sys/dlpi.h>
  30 #include <sys/stropts.h>
  31 #include <sys/sysmacros.h>
  32 #include <sys/strsubr.h>
  33 #include <sys/strlog.h>
  34 #include <sys/strsun.h>
  35 #include <sys/zone.h>
  36 #define _SUN_TPI_VERSION 2
  37 #include <sys/tihdr.h>
  38 #include <sys/xti_inet.h>
  39 #include <sys/ddi.h>
  40 #include <sys/sunddi.h>
  41 #include <sys/cmn_err.h>
  42 #include <sys/debug.h>
  43 #include <sys/kobj.h>
 
 
 775         else
 776                 irr_flags = IRR_NONE;
 777 
 778         /* Can not use route cache with TX since the labels can differ */
 779         if (ira->ira_flags & IRAF_SYSTEM_LABELED) {
 780                 if (CLASSD(nexthop)) {
 781                         ire = ire_multicast(ill);
 782                 } else {
 783                         /* Match destination and label */
 784                         ire = ire_route_recursive_v4(nexthop, 0, NULL,
 785                             ALL_ZONES, ira->ira_tsl, MATCH_IRE_SECATTR,
 786                             irr_flags, ira->ira_xmit_hint, ipst, NULL, NULL,
 787                             NULL);
 788                 }
 789                 /* Update the route cache so we do the ire_refrele */
 790                 ASSERT(ire != NULL);
 791                 if (rtc->rtc_ire != NULL)
 792                         ire_refrele(rtc->rtc_ire);
 793                 rtc->rtc_ire = ire;
 794                 rtc->rtc_ipaddr = nexthop;
 795         } else if (nexthop == rtc->rtc_ipaddr) {
 796                 /* Use the route cache */
 797                 ASSERT(rtc->rtc_ire != NULL);
 798                 ire = rtc->rtc_ire;
 799         } else {
 800                 /* Update the route cache */
 801                 if (CLASSD(nexthop)) {
 802                         ire = ire_multicast(ill);
 803                 } else {
 804                         /* Just match the destination */
 805                         ire = ire_route_recursive_dstonly_v4(nexthop, irr_flags,
 806                             ira->ira_xmit_hint, ipst);
 807                 }
 808                 ASSERT(ire != NULL);
 809                 if (rtc->rtc_ire != NULL)
 810                         ire_refrele(rtc->rtc_ire);
 811                 rtc->rtc_ire = ire;
 812                 rtc->rtc_ipaddr = nexthop;
 813         }
 814 
 815         ire->ire_ib_pkt_count++;
 816 
 817         /*
 
 | 
 
 
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  *
  25  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  26  */
  27 /* Copyright (c) 1990 Mentat Inc. */
  28 
  29 #include <sys/types.h>
  30 #include <sys/stream.h>
  31 #include <sys/dlpi.h>
  32 #include <sys/stropts.h>
  33 #include <sys/sysmacros.h>
  34 #include <sys/strsubr.h>
  35 #include <sys/strlog.h>
  36 #include <sys/strsun.h>
  37 #include <sys/zone.h>
  38 #define _SUN_TPI_VERSION 2
  39 #include <sys/tihdr.h>
  40 #include <sys/xti_inet.h>
  41 #include <sys/ddi.h>
  42 #include <sys/sunddi.h>
  43 #include <sys/cmn_err.h>
  44 #include <sys/debug.h>
  45 #include <sys/kobj.h>
 
 
 777         else
 778                 irr_flags = IRR_NONE;
 779 
 780         /* Can not use route cache with TX since the labels can differ */
 781         if (ira->ira_flags & IRAF_SYSTEM_LABELED) {
 782                 if (CLASSD(nexthop)) {
 783                         ire = ire_multicast(ill);
 784                 } else {
 785                         /* Match destination and label */
 786                         ire = ire_route_recursive_v4(nexthop, 0, NULL,
 787                             ALL_ZONES, ira->ira_tsl, MATCH_IRE_SECATTR,
 788                             irr_flags, ira->ira_xmit_hint, ipst, NULL, NULL,
 789                             NULL);
 790                 }
 791                 /* Update the route cache so we do the ire_refrele */
 792                 ASSERT(ire != NULL);
 793                 if (rtc->rtc_ire != NULL)
 794                         ire_refrele(rtc->rtc_ire);
 795                 rtc->rtc_ire = ire;
 796                 rtc->rtc_ipaddr = nexthop;
 797         } else if (nexthop == rtc->rtc_ipaddr && rtc->rtc_ire != NULL) {
 798                 /* Use the route cache */
 799                 ire = rtc->rtc_ire;
 800         } else {
 801                 /* Update the route cache */
 802                 if (CLASSD(nexthop)) {
 803                         ire = ire_multicast(ill);
 804                 } else {
 805                         /* Just match the destination */
 806                         ire = ire_route_recursive_dstonly_v4(nexthop, irr_flags,
 807                             ira->ira_xmit_hint, ipst);
 808                 }
 809                 ASSERT(ire != NULL);
 810                 if (rtc->rtc_ire != NULL)
 811                         ire_refrele(rtc->rtc_ire);
 812                 rtc->rtc_ire = ire;
 813                 rtc->rtc_ipaddr = nexthop;
 814         }
 815 
 816         ire->ire_ib_pkt_count++;
 817 
 818         /*
 
 |