ip.h (77c67f2f) ip.h (c793af95)
1/*
2 * CDDL HEADER START
3 *
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

--- 40 unchanged lines hidden (view full) ---

49#ifdef _KERNEL
50#include <netinet/ip6.h>
51#include <sys/avl.h>
52#include <sys/vmem.h>
53#include <sys/squeue.h>
54#include <net/route.h>
55#include <sys/systm.h>
56#include <sys/multidata.h>
1/*
2 * CDDL HEADER START
3 *
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

--- 40 unchanged lines hidden (view full) ---

49#ifdef _KERNEL
50#include <netinet/ip6.h>
51#include <sys/avl.h>
52#include <sys/vmem.h>
53#include <sys/squeue.h>
54#include <net/route.h>
55#include <sys/systm.h>
56#include <sys/multidata.h>
57#include <net/radix.h>
57
58#ifdef DEBUG
59#define ILL_DEBUG
60#define IRE_DEBUG
61#define NCE_DEBUG
62#define CONN_DEBUG
63#endif
64

--- 71 unchanged lines hidden (view full) ---

136 * 2 files should be cleaned up to remove all redundant definitions.
137 */
138#define IP_MAXPACKET 65535
139#define IP_SIMPLE_HDR_VERSION \
140 ((IP_VERSION << 4) | IP_SIMPLE_HDR_LENGTH_IN_WORDS)
141
142#define UDPH_SIZE 8
143
58
59#ifdef DEBUG
60#define ILL_DEBUG
61#define IRE_DEBUG
62#define NCE_DEBUG
63#define CONN_DEBUG
64#endif
65

--- 71 unchanged lines hidden (view full) ---

137 * 2 files should be cleaned up to remove all redundant definitions.
138 */
139#define IP_MAXPACKET 65535
140#define IP_SIMPLE_HDR_VERSION \
141 ((IP_VERSION << 4) | IP_SIMPLE_HDR_LENGTH_IN_WORDS)
142
143#define UDPH_SIZE 8
144
145/* Leave room for ip_newroute to tack on the src and target addresses */
146#define OK_RESOLVER_MP(mp) \
147 ((mp) && ((mp)->b_wptr - (mp)->b_rptr) >= (2 * IP_ADDR_LEN))
148
144/*
145 * Constants and type definitions to support IP IOCTL commands
146 */
147#define IP_IOCTL (('i'<<8)|'p')
148#define IP_IOC_IRE_DELETE 4
149#define IP_IOC_IRE_DELETE_NO_REPLY 5
150#define IP_IOC_IRE_ADVISE_NO_REPLY 6
151#define IP_IOC_RTS_REQUEST 7

--- 172 unchanged lines hidden (view full) ---

324#ifndef IRE_DB_TYPE
325#define IRE_DB_TYPE M_SIG
326#endif
327
328#ifndef IRE_DB_REQ_TYPE
329#define IRE_DB_REQ_TYPE M_PCSIG
330#endif
331
149/*
150 * Constants and type definitions to support IP IOCTL commands
151 */
152#define IP_IOCTL (('i'<<8)|'p')
153#define IP_IOC_IRE_DELETE 4
154#define IP_IOC_IRE_DELETE_NO_REPLY 5
155#define IP_IOC_IRE_ADVISE_NO_REPLY 6
156#define IP_IOC_RTS_REQUEST 7

--- 172 unchanged lines hidden (view full) ---

329#ifndef IRE_DB_TYPE
330#define IRE_DB_TYPE M_SIG
331#endif
332
333#ifndef IRE_DB_REQ_TYPE
334#define IRE_DB_REQ_TYPE M_PCSIG
335#endif
336
337#ifndef IRE_ARPRESOLVE_TYPE
338#define IRE_ARPRESOLVE_TYPE M_EVENT
339#endif
340
332/*
333 * Values for squeue switch:
334 */
335
336#define IP_SQUEUE_ENTER_NODRAIN 1
337#define IP_SQUEUE_ENTER 2
338/*
339 * This is part of the interface between Transport provider and

--- 73 unchanged lines hidden (view full) ---

413 ip_udp_input(q, mp, ipha, ire, recv_ill); \
414 break; \
415 default: \
416 ip_proto_input(q, mp, ipha, ire, recv_ill); \
417 break; \
418 } \
419}
420
341/*
342 * Values for squeue switch:
343 */
344
345#define IP_SQUEUE_ENTER_NODRAIN 1
346#define IP_SQUEUE_ENTER 2
347/*
348 * This is part of the interface between Transport provider and

--- 73 unchanged lines hidden (view full) ---

422 ip_udp_input(q, mp, ipha, ire, recv_ill); \
423 break; \
424 default: \
425 ip_proto_input(q, mp, ipha, ire, recv_ill); \
426 break; \
427 } \
428}
429
430/*
431 * NCE_EXPIRED is TRUE when we have a non-permanent nce that was
432 * found to be REACHABLE more than ip_ire_arp_interval ms ago.
433 * This macro is used to trigger re-arp of existing nce_t entries
434 * so that they can be updated with the latest information.
435 * nce's will get cleaned up (or updated with new info) in the following
436 * circumstances:
437 * - ip_ire_trash_reclaim will free nce's using ndp_cache_reclaim
438 * when memory is low,
439 * - ip_arp_news, when updates are received.
440 * - if the nce is NCE_EXPIRED(), it will be re-initialized to ND_INITIAL,
441 * so that a new arp request will be triggered.
442 * nce_last is the timestamp that indicates when the nce_res_mp in the
443 * nce_t was last updated to a valid link-layer address. nce_last gets
444 * modified/updated :
445 * - when the nce is created or reinit-ed
446 * - every time we get a sane arp response for the nce.
447 */
448#define NCE_EXPIRED(nce) (nce->nce_last > 0 && \
449 ((nce->nce_flags & NCE_F_PERMANENT) == 0) && \
450 ((TICK_TO_MSEC(lbolt64) - nce->nce_last) > ip_ire_arp_interval))
421
422#endif /* _KERNEL */
423
424/* ICMP types */
425#define ICMP_ECHO_REPLY 0
426#define ICMP_DEST_UNREACHABLE 3
427#define ICMP_SOURCE_QUENCH 4
428#define ICMP_REDIRECT 5

--- 200 unchanged lines hidden (view full) ---

629 * IRE_MARK_PRIVATE_ADDR is used for IP_NEXTHOP. When IP_NEXTHOP is set, the
630 * routing table lookup for the destination is bypassed and the packet is
631 * sent directly to the specified nexthop. The associated IRE_CACHE entries
632 * should be marked with IRE_MARK_PRIVATE_ADDR flag so that they don't show up
633 * in regular ire cache lookups.
634 */
635#define IRE_MARK_PRIVATE_ADDR 0x0040
636
451
452#endif /* _KERNEL */
453
454/* ICMP types */
455#define ICMP_ECHO_REPLY 0
456#define ICMP_DEST_UNREACHABLE 3
457#define ICMP_SOURCE_QUENCH 4
458#define ICMP_REDIRECT 5

--- 200 unchanged lines hidden (view full) ---

659 * IRE_MARK_PRIVATE_ADDR is used for IP_NEXTHOP. When IP_NEXTHOP is set, the
660 * routing table lookup for the destination is bypassed and the packet is
661 * sent directly to the specified nexthop. The associated IRE_CACHE entries
662 * should be marked with IRE_MARK_PRIVATE_ADDR flag so that they don't show up
663 * in regular ire cache lookups.
664 */
665#define IRE_MARK_PRIVATE_ADDR 0x0040
666
667/*
668 * When we send an ARP resolution query for the nexthop gateway's ire,
669 * we use esballoc to create the ire_t in the AR_ENTRY_QUERY mblk
670 * chain, and mark its ire_marks with IRE_MARK_UNCACHED. This flag
671 * indicates that information from ARP has not been transferred to a
672 * permanent IRE_CACHE entry. The flag is reset only when the
673 * information is successfully transferred to an ire_cache entry (in
674 * ire_add()). Attempting to free the AR_ENTRY_QUERY mblk chain prior
675 * to ire_add (e.g., from arp, or from ip`ip_wput_nondata) will
676 * require that the resources (incomplete ire_cache and/or nce) must
677 * be cleaned up. The free callback routine (ire_freemblk()) checks
678 * for IRE_MARK_UNCACHED to see if any resources that are pinned down
679 * will need to be cleaned up or not.
680 */
681
682#define IRE_MARK_UNCACHED 0x0080
683
637/* Flags with ire_expire routine */
638#define FLUSH_ARP_TIME 0x0001 /* ARP info potentially stale timer */
639#define FLUSH_REDIRECT_TIME 0x0002 /* Redirects potentially stale */
640#define FLUSH_MTU_TIME 0x0004 /* Include path MTU per RFC 1191 */
641
642/* Arguments to ire_flush_cache() */
643#define IRE_FLUSH_DELETE 0
644#define IRE_FLUSH_ADD 1

--- 858 unchanged lines hidden (view full) ---

1503
1504/*
1505 * IRE bucket structure. Usually there is an array of such structures,
1506 * each pointing to a linked list of ires. irb_refcnt counts the number
1507 * of walkers of a given hash bucket. Usually the reference count is
1508 * bumped up if the walker wants no IRES to be DELETED while walking the
1509 * list. Bumping up does not PREVENT ADDITION. This allows walking a given
1510 * hash bucket without stumbling up on a free pointer.
684/* Flags with ire_expire routine */
685#define FLUSH_ARP_TIME 0x0001 /* ARP info potentially stale timer */
686#define FLUSH_REDIRECT_TIME 0x0002 /* Redirects potentially stale */
687#define FLUSH_MTU_TIME 0x0004 /* Include path MTU per RFC 1191 */
688
689/* Arguments to ire_flush_cache() */
690#define IRE_FLUSH_DELETE 0
691#define IRE_FLUSH_ADD 1

--- 858 unchanged lines hidden (view full) ---

1550
1551/*
1552 * IRE bucket structure. Usually there is an array of such structures,
1553 * each pointing to a linked list of ires. irb_refcnt counts the number
1554 * of walkers of a given hash bucket. Usually the reference count is
1555 * bumped up if the walker wants no IRES to be DELETED while walking the
1556 * list. Bumping up does not PREVENT ADDITION. This allows walking a given
1557 * hash bucket without stumbling up on a free pointer.
1558 *
1559 * irb_t structures in ip_ftable are dynamically allocated and freed.
1560 * In order to identify the irb_t structures that cna be safely kmem_free'd
1561 * we need to ensure that
1562 * - the irb_refcnt is quiescent, indicating no other walkers,
1563 * - no other threads or ire's are holding references to the irb,
1564 * i.e., irb_nire == 0,
1565 * - there are no active ire's in the bucket, i.e., irb_ire_cnt == 0
1511 */
1512typedef struct irb {
1513 struct ire_s *irb_ire; /* First ire in this bucket */
1514 /* Should be first in this struct */
1515 krwlock_t irb_lock; /* Protect this bucket */
1516 uint_t irb_refcnt; /* Protected by irb_lock */
1517 uchar_t irb_marks; /* CONDEMNED ires in this bucket ? */
1566 */
1567typedef struct irb {
1568 struct ire_s *irb_ire; /* First ire in this bucket */
1569 /* Should be first in this struct */
1570 krwlock_t irb_lock; /* Protect this bucket */
1571 uint_t irb_refcnt; /* Protected by irb_lock */
1572 uchar_t irb_marks; /* CONDEMNED ires in this bucket ? */
1518 uint_t irb_ire_cnt; /* Num of IRE in this bucket */
1573#define IRB_MARK_CONDEMNED 0x0001
1574#define IRB_MARK_FTABLE 0x0002
1575 uint_t irb_ire_cnt; /* Num of active IRE in this bucket */
1519 uint_t irb_tmp_ire_cnt; /* Num of temporary IRE */
1576 uint_t irb_tmp_ire_cnt; /* Num of temporary IRE */
1577 struct ire_s *irb_rr_origin; /* origin for round-robin */
1578 int irb_nire; /* Num of ftable ire's that ref irb */
1520} irb_t;
1521
1579} irb_t;
1580
1581#define IRB2RT(irb) (rt_t *)((caddr_t)(irb) - offsetof(rt_t, rt_irb))
1582
1583/* The following are return values of ip_xmit_v4() */
1584typedef enum {
1585 SEND_PASSED = 0, /* sent packet out on wire */
1586 SEND_FAILED, /* sending of packet failed */
1587 LOOKUP_IN_PROGRESS, /* ire cache found, ARP resolution in progress */
1588 LLHDR_RESLV_FAILED /* macaddr resl of onlink dst or nexthop failed */
1589} ipxmit_state_t;
1590
1522#define IP_V4_G_HEAD 0
1523#define IP_V6_G_HEAD 1
1524
1525#define MAX_G_HEADS 2
1526
1527/*
1528 * unpadded ill_if structure
1529 */

--- 115 unchanged lines hidden (view full) ---

1645 ((ill)->ill_usesrc_grp_next != NULL))
1646
1647/* Is this a client/consumer of the usesrc ILL ? */
1648#define IS_USESRC_CLI_ILL(ill) \
1649 (((ill)->ill_usesrc_ifindex != 0) && \
1650 ((ill)->ill_usesrc_grp_next != NULL))
1651
1652/* Is this an virtual network interface (vni) ILL ? */
1591#define IP_V4_G_HEAD 0
1592#define IP_V6_G_HEAD 1
1593
1594#define MAX_G_HEADS 2
1595
1596/*
1597 * unpadded ill_if structure
1598 */

--- 115 unchanged lines hidden (view full) ---

1714 ((ill)->ill_usesrc_grp_next != NULL))
1715
1716/* Is this a client/consumer of the usesrc ILL ? */
1717#define IS_USESRC_CLI_ILL(ill) \
1718 (((ill)->ill_usesrc_ifindex != 0) && \
1719 ((ill)->ill_usesrc_grp_next != NULL))
1720
1721/* Is this an virtual network interface (vni) ILL ? */
1653#define IS_VNI(ill) \
1654 (((ill) != NULL) && !((ill)->ill_phyint->phyint_flags & \
1655 PHYI_LOOPBACK) && ((ill)->ill_phyint->phyint_flags & \
1722#define IS_VNI(ill) \
1723 (((ill) != NULL) && \
1724 (((ill)->ill_phyint->phyint_flags & (PHYI_LOOPBACK|PHYI_VIRTUAL)) == \
1656 PHYI_VIRTUAL))
1657
1658/*
1659 * IP Lower level Structure.
1660 * Instance data structure in ip_open when there is a device below us.
1661 */
1662typedef struct ill_s {
1663 ill_if_t *ill_ifptr; /* pointer to interface type */

--- 375 unchanged lines hidden (view full) ---

2039 \
2040 peer_ill = (ill)->ill_move_peer; \
2041 ASSERT(peer_ill != NULL); \
2042 (ill)->ill_move_in_progress = B_FALSE; \
2043 peer_ill->ill_move_in_progress = B_FALSE; \
2044 (ill)->ill_move_peer = NULL; \
2045 peer_ill->ill_move_peer = NULL; \
2046}
1725 PHYI_VIRTUAL))
1726
1727/*
1728 * IP Lower level Structure.
1729 * Instance data structure in ip_open when there is a device below us.
1730 */
1731typedef struct ill_s {
1732 ill_if_t *ill_ifptr; /* pointer to interface type */

--- 375 unchanged lines hidden (view full) ---

2108 \
2109 peer_ill = (ill)->ill_move_peer; \
2110 ASSERT(peer_ill != NULL); \
2111 (ill)->ill_move_in_progress = B_FALSE; \
2112 peer_ill->ill_move_in_progress = B_FALSE; \
2113 (ill)->ill_move_peer = NULL; \
2114 peer_ill->ill_move_peer = NULL; \
2115}
2116/* The 2 ill's are same or belong to the same IPMP group */
2117#define SAME_IPMP_GROUP(ill_1, ill_2) \
2118 (((ill_1)->ill_group != NULL) && \
2119 ((ill_1)->ill_group == (ill_2)->ill_group))
2047
2048/* Passed down by ARP to IP during I_PLINK/I_PUNLINK */
2049typedef struct ipmx_s {
2050 char ipmx_name[LIFNAMSIZ]; /* if name */
2051 uint_t
2052 ipmx_arpdev_stream : 1, /* This is the arp stream */
2053 ipmx_notused : 31;
2054} ipmx_t;

--- 242 unchanged lines hidden (view full) ---

2297 * prevent ires from being deleted in this bucket.
2298 */
2299#define IRB_REFHOLD(irb) { \
2300 rw_enter(&(irb)->irb_lock, RW_WRITER); \
2301 (irb)->irb_refcnt++; \
2302 ASSERT((irb)->irb_refcnt != 0); \
2303 rw_exit(&(irb)->irb_lock); \
2304}
2120
2121/* Passed down by ARP to IP during I_PLINK/I_PUNLINK */
2122typedef struct ipmx_s {
2123 char ipmx_name[LIFNAMSIZ]; /* if name */
2124 uint_t
2125 ipmx_arpdev_stream : 1, /* This is the arp stream */
2126 ipmx_notused : 31;
2127} ipmx_t;

--- 242 unchanged lines hidden (view full) ---

2370 * prevent ires from being deleted in this bucket.
2371 */
2372#define IRB_REFHOLD(irb) { \
2373 rw_enter(&(irb)->irb_lock, RW_WRITER); \
2374 (irb)->irb_refcnt++; \
2375 ASSERT((irb)->irb_refcnt != 0); \
2376 rw_exit(&(irb)->irb_lock); \
2377}
2378#define IRB_REFHOLD_LOCKED(irb) { \
2379 ASSERT(RW_WRITE_HELD(&(irb)->irb_lock)); \
2380 (irb)->irb_refcnt++; \
2381 ASSERT((irb)->irb_refcnt != 0); \
2382}
2305
2383
2384void irb_refrele_ftable(irb_t *);
2385/*
2386 * Note: when IRB_MARK_FTABLE (i.e., IRE_CACHETABLE entry), the irb_t
2387 * is statically allocated, so that when the irb_refcnt goes to 0,
2388 * we simply clean up the ire list and continue.
2389 */
2306#define IRB_REFRELE(irb) { \
2390#define IRB_REFRELE(irb) { \
2307 rw_enter(&(irb)->irb_lock, RW_WRITER); \
2308 ASSERT((irb)->irb_refcnt != 0); \
2309 if (--(irb)->irb_refcnt == 0 && \
2310 ((irb)->irb_marks & IRE_MARK_CONDEMNED)) { \
2311 ire_t *ire_list; \
2312 \
2313 ire_list = ire_unlink(irb); \
2314 rw_exit(&(irb)->irb_lock); \
2315 ASSERT(ire_list != NULL); \
2316 ire_cleanup(ire_list); \
2391 if ((irb)->irb_marks & IRB_MARK_FTABLE) { \
2392 irb_refrele_ftable((irb)); \
2317 } else { \
2393 } else { \
2318 rw_exit(&(irb)->irb_lock); \
2319 } \
2394 rw_enter(&(irb)->irb_lock, RW_WRITER); \
2395 ASSERT((irb)->irb_refcnt != 0); \
2396 if (--(irb)->irb_refcnt == 0 && \
2397 ((irb)->irb_marks & IRE_MARK_CONDEMNED)) { \
2398 ire_t *ire_list; \
2399 \
2400 ire_list = ire_unlink(irb); \
2401 rw_exit(&(irb)->irb_lock); \
2402 ASSERT(ire_list != NULL); \
2403 ire_cleanup(ire_list); \
2404 } else { \
2405 rw_exit(&(irb)->irb_lock); \
2406 } \
2407 } \
2320}
2321
2408}
2409
2410extern struct kmem_cache *rt_entry_cache;
2411
2322/*
2412/*
2323 * Lock the fast path mp for access, since the ire_fp_mp can be deleted
2413 * Lock the fast path mp for access, since the fp_mp can be deleted
2324 * due a DL_NOTE_FASTPATH_FLUSH in the case of IRE_BROADCAST and IRE_MIPRTUN
2325 */
2326
2327#define LOCK_IRE_FP_MP(ire) { \
2328 if ((ire)->ire_type == IRE_BROADCAST || \
2329 (ire)->ire_type == IRE_MIPRTUN) \
2414 * due a DL_NOTE_FASTPATH_FLUSH in the case of IRE_BROADCAST and IRE_MIPRTUN
2415 */
2416
2417#define LOCK_IRE_FP_MP(ire) { \
2418 if ((ire)->ire_type == IRE_BROADCAST || \
2419 (ire)->ire_type == IRE_MIPRTUN) \
2330 mutex_enter(&ire->ire_lock); \
2420 mutex_enter(&ire->ire_nce->nce_lock); \
2331 }
2332#define UNLOCK_IRE_FP_MP(ire) { \
2333 if ((ire)->ire_type == IRE_BROADCAST || \
2334 (ire)->ire_type == IRE_MIPRTUN) \
2421 }
2422#define UNLOCK_IRE_FP_MP(ire) { \
2423 if ((ire)->ire_type == IRE_BROADCAST || \
2424 (ire)->ire_type == IRE_MIPRTUN) \
2335 mutex_exit(&ire->ire_lock); \
2425 mutex_exit(&ire->ire_nce->nce_lock); \
2336 }
2337
2338typedef struct ire4 {
2339 ipaddr_t ire4_src_addr; /* Source address to use. */
2340 ipaddr_t ire4_mask; /* Mask for matching this IRE. */
2341 ipaddr_t ire4_addr; /* Address this IRE represents. */
2342 ipaddr_t ire4_gateway_addr; /* Gateway if IRE_CACHE/IRE_OFFSUBNET */
2343 ipaddr_t ire4_cmask; /* Mask from parent prefix route */

--- 13 unchanged lines hidden (view full) ---

2357} ire_addr_u_t;
2358
2359/* Internet Routing Entry */
2360typedef struct ire_s {
2361 struct ire_s *ire_next; /* The hash chain must be first. */
2362 struct ire_s **ire_ptpn; /* Pointer to previous next. */
2363 uint32_t ire_refcnt; /* Number of references */
2364 mblk_t *ire_mp; /* Non-null if allocated as mblk */
2426 }
2427
2428typedef struct ire4 {
2429 ipaddr_t ire4_src_addr; /* Source address to use. */
2430 ipaddr_t ire4_mask; /* Mask for matching this IRE. */
2431 ipaddr_t ire4_addr; /* Address this IRE represents. */
2432 ipaddr_t ire4_gateway_addr; /* Gateway if IRE_CACHE/IRE_OFFSUBNET */
2433 ipaddr_t ire4_cmask; /* Mask from parent prefix route */

--- 13 unchanged lines hidden (view full) ---

2447} ire_addr_u_t;
2448
2449/* Internet Routing Entry */
2450typedef struct ire_s {
2451 struct ire_s *ire_next; /* The hash chain must be first. */
2452 struct ire_s **ire_ptpn; /* Pointer to previous next. */
2453 uint32_t ire_refcnt; /* Number of references */
2454 mblk_t *ire_mp; /* Non-null if allocated as mblk */
2365 mblk_t *ire_fp_mp; /* Fast path header */
2366 queue_t *ire_rfq; /* recv from this queue */
2367 queue_t *ire_stq; /* send to this queue */
2368 union {
2369 uint_t *max_fragp; /* Used only during ire creation */
2370 uint_t max_frag; /* MTU (next hop or path). */
2371 } imf_u;
2372#define ire_max_frag imf_u.max_frag
2373#define ire_max_fragp imf_u.max_fragp
2374 uint32_t ire_frag_flag; /* IPH_DF or zero. */
2375 uint32_t ire_ident; /* Per IRE IP ident. */
2376 uint32_t ire_tire_mark; /* Used for reclaim of unused. */
2377 uchar_t ire_ipversion; /* IPv4/IPv6 version */
2378 uchar_t ire_marks; /* IRE_MARK_CONDEMNED etc. */
2379 ushort_t ire_type; /* Type of IRE */
2380 uint_t ire_ib_pkt_count; /* Inbound packets for ire_addr */
2381 uint_t ire_ob_pkt_count; /* Outbound packets to ire_addr */
2382 uint_t ire_ll_hdr_length; /* Non-zero if we do M_DATA prepends */
2383 time_t ire_create_time; /* Time (in secs) IRE was created. */
2455 queue_t *ire_rfq; /* recv from this queue */
2456 queue_t *ire_stq; /* send to this queue */
2457 union {
2458 uint_t *max_fragp; /* Used only during ire creation */
2459 uint_t max_frag; /* MTU (next hop or path). */
2460 } imf_u;
2461#define ire_max_frag imf_u.max_frag
2462#define ire_max_fragp imf_u.max_fragp
2463 uint32_t ire_frag_flag; /* IPH_DF or zero. */
2464 uint32_t ire_ident; /* Per IRE IP ident. */
2465 uint32_t ire_tire_mark; /* Used for reclaim of unused. */
2466 uchar_t ire_ipversion; /* IPv4/IPv6 version */
2467 uchar_t ire_marks; /* IRE_MARK_CONDEMNED etc. */
2468 ushort_t ire_type; /* Type of IRE */
2469 uint_t ire_ib_pkt_count; /* Inbound packets for ire_addr */
2470 uint_t ire_ob_pkt_count; /* Outbound packets to ire_addr */
2471 uint_t ire_ll_hdr_length; /* Non-zero if we do M_DATA prepends */
2472 time_t ire_create_time; /* Time (in secs) IRE was created. */
2384 mblk_t *ire_dlureq_mp; /* DL_UNIT_DATA_REQ/RESOLVER mp */
2385 uint32_t ire_phandle; /* Associate prefix IREs to cache */
2386 uint32_t ire_ihandle; /* Associate interface IREs to cache */
2387 ipif_t *ire_ipif; /* the interface that this ire uses */
2388 uint32_t ire_flags; /* flags related to route (RTF_*) */
2389 uint_t ire_ipsec_overhead; /* IPSEC overhead */
2473 uint32_t ire_phandle; /* Associate prefix IREs to cache */
2474 uint32_t ire_ihandle; /* Associate interface IREs to cache */
2475 ipif_t *ire_ipif; /* the interface that this ire uses */
2476 uint32_t ire_flags; /* flags related to route (RTF_*) */
2477 uint_t ire_ipsec_overhead; /* IPSEC overhead */
2390 struct nce_s *ire_nce; /* Neighbor Cache Entry for IPv6 */
2478 /*
2479 * Neighbor Cache Entry for IPv6; arp info for IPv4
2480 */
2481 struct nce_s *ire_nce;
2391 uint_t ire_masklen; /* # bits in ire_mask{,_v6} */
2392 ire_addr_u_t ire_u; /* IPv4/IPv6 address info. */
2393
2394 irb_t *ire_bucket; /* Hash bucket when ire_ptphn is set */
2395 iulp_t ire_uinfo; /* Upper layer protocol info. */
2396 /*
2397 * Protects ire_uinfo, ire_max_frag, and ire_frag_flag.
2398 */

--- 12 unchanged lines hidden (view full) ---

2411 clock_t ire_last_used_time; /* Last used time */
2412 struct ire_s *ire_fastpath; /* Pointer to next ire in fastpath */
2413 zoneid_t ire_zoneid; /* for local address discrimination */
2414 tsol_ire_gw_secattr_t *ire_gw_secattr; /* gateway security attributes */
2415#ifdef IRE_DEBUG
2416 th_trace_t *ire_trace[IP_TR_HASH_MAX];
2417 boolean_t ire_trace_disable; /* True when alloc fails */
2418#endif
2482 uint_t ire_masklen; /* # bits in ire_mask{,_v6} */
2483 ire_addr_u_t ire_u; /* IPv4/IPv6 address info. */
2484
2485 irb_t *ire_bucket; /* Hash bucket when ire_ptphn is set */
2486 iulp_t ire_uinfo; /* Upper layer protocol info. */
2487 /*
2488 * Protects ire_uinfo, ire_max_frag, and ire_frag_flag.
2489 */

--- 12 unchanged lines hidden (view full) ---

2502 clock_t ire_last_used_time; /* Last used time */
2503 struct ire_s *ire_fastpath; /* Pointer to next ire in fastpath */
2504 zoneid_t ire_zoneid; /* for local address discrimination */
2505 tsol_ire_gw_secattr_t *ire_gw_secattr; /* gateway security attributes */
2506#ifdef IRE_DEBUG
2507 th_trace_t *ire_trace[IP_TR_HASH_MAX];
2508 boolean_t ire_trace_disable; /* True when alloc fails */
2509#endif
2510 /*
2511 * ire's that are embedded inside mblk_t and sent to the external
2512 * resolver use the ire_stq_ifindex to track the ifindex of the
2513 * ire_stq, so that the ill (if it exists) can be correctly recovered
2514 * for cleanup in the esbfree routine when arp failure occurs
2515 */
2516 uint_t ire_stq_ifindex;
2419} ire_t;
2420
2421/* IPv4 compatiblity macros */
2422#define ire_src_addr ire_u.ire4_u.ire4_src_addr
2423#define ire_mask ire_u.ire4_u.ire4_mask
2424#define ire_addr ire_u.ire4_u.ire4_addr
2425#define ire_gateway_addr ire_u.ire4_u.ire4_gateway_addr
2426#define ire_cmask ire_u.ire4_u.ire4_cmask

--- 278 unchanged lines hidden (view full) ---

2705
2706extern kmutex_t igmp_timer_lock; /* Protects the igmp timer */
2707extern kmutex_t mld_timer_lock; /* Protects the mld timer */
2708
2709extern krwlock_t ill_g_usesrc_lock; /* Protects usesrc related fields */
2710
2711extern struct kmem_cache *ire_cache;
2712
2517} ire_t;
2518
2519/* IPv4 compatiblity macros */
2520#define ire_src_addr ire_u.ire4_u.ire4_src_addr
2521#define ire_mask ire_u.ire4_u.ire4_mask
2522#define ire_addr ire_u.ire4_u.ire4_addr
2523#define ire_gateway_addr ire_u.ire4_u.ire4_gateway_addr
2524#define ire_cmask ire_u.ire4_u.ire4_cmask

--- 278 unchanged lines hidden (view full) ---

2803
2804extern kmutex_t igmp_timer_lock; /* Protects the igmp timer */
2805extern kmutex_t mld_timer_lock; /* Protects the mld timer */
2806
2807extern krwlock_t ill_g_usesrc_lock; /* Protects usesrc related fields */
2808
2809extern struct kmem_cache *ire_cache;
2810
2713extern uint_t ip_ire_default_count; /* Number of IPv4 IRE_DEFAULT entries */
2714extern uint_t ip_ire_default_index; /* Walking index used to mod in */
2811extern uint_t ip_redirect_cnt; /* Num of redirect routes in ftable */
2715
2716extern ipaddr_t ip_g_all_ones;
2717extern caddr_t ip_g_nd; /* Named Dispatch List Head */
2718
2719extern uint_t ip_loopback_mtu;
2720
2721extern ipparam_t *ip_param_arr;
2722

--- 73 unchanged lines hidden (view full) ---

2796#define N_IN_CLASSD_NET IN_CLASSD_NET
2797#define N_INADDR_UNSPEC_GROUP INADDR_UNSPEC_GROUP
2798#else /* _BIG_ENDIAN */
2799#define N_IN_CLASSD_NET (ipaddr_t)0x000000f0U
2800#define N_INADDR_UNSPEC_GROUP (ipaddr_t)0x000000e0U
2801#endif /* _BIG_ENDIAN */
2802#define CLASSD(addr) (((addr) & N_IN_CLASSD_NET) == N_INADDR_UNSPEC_GROUP)
2803
2812
2813extern ipaddr_t ip_g_all_ones;
2814extern caddr_t ip_g_nd; /* Named Dispatch List Head */
2815
2816extern uint_t ip_loopback_mtu;
2817
2818extern ipparam_t *ip_param_arr;
2819

--- 73 unchanged lines hidden (view full) ---

2893#define N_IN_CLASSD_NET IN_CLASSD_NET
2894#define N_INADDR_UNSPEC_GROUP INADDR_UNSPEC_GROUP
2895#else /* _BIG_ENDIAN */
2896#define N_IN_CLASSD_NET (ipaddr_t)0x000000f0U
2897#define N_INADDR_UNSPEC_GROUP (ipaddr_t)0x000000e0U
2898#endif /* _BIG_ENDIAN */
2899#define CLASSD(addr) (((addr) & N_IN_CLASSD_NET) == N_INADDR_UNSPEC_GROUP)
2900
2901#define IP_LOOPBACK_ADDR(addr) \
2902 ((ntohl(addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
2903
2804#ifdef DEBUG
2805/* IPsec HW acceleration debugging support */
2806
2807#define IPSECHW_CAPAB 0x0001 /* capability negotiation */
2808#define IPSECHW_SADB 0x0002 /* SADB exchange */
2809#define IPSECHW_PKT 0x0004 /* general packet flow */
2810#define IPSECHW_PKTIN 0x0008 /* driver in pkt processing details */
2811#define IPSECHW_PKTOUT 0x0010 /* driver out pkt processing details */

--- 17 unchanged lines hidden (view full) ---

2829#define ip3dbg(a) if (ip_debug > 4) printf a
2830#else
2831#define ip0dbg(a) /* */
2832#define ip1dbg(a) /* */
2833#define ip2dbg(a) /* */
2834#define ip3dbg(a) /* */
2835#endif /* IP_DEBUG */
2836
2904#ifdef DEBUG
2905/* IPsec HW acceleration debugging support */
2906
2907#define IPSECHW_CAPAB 0x0001 /* capability negotiation */
2908#define IPSECHW_SADB 0x0002 /* SADB exchange */
2909#define IPSECHW_PKT 0x0004 /* general packet flow */
2910#define IPSECHW_PKTIN 0x0008 /* driver in pkt processing details */
2911#define IPSECHW_PKTOUT 0x0010 /* driver out pkt processing details */

--- 17 unchanged lines hidden (view full) ---

2929#define ip3dbg(a) if (ip_debug > 4) printf a
2930#else
2931#define ip0dbg(a) /* */
2932#define ip1dbg(a) /* */
2933#define ip2dbg(a) /* */
2934#define ip3dbg(a) /* */
2935#endif /* IP_DEBUG */
2936
2937struct ipsec_out_s;
2938
2837extern const char *dlpi_prim_str(int);
2838extern const char *dlpi_err_str(int);
2839extern void ill_frag_timer(void *);
2840extern ill_t *ill_first(int, int, ill_walk_context_t *);
2841extern ill_t *ill_next(ill_walk_context_t *, ill_t *);
2842extern void ill_frag_timer_start(ill_t *);
2843extern mblk_t *ip_carve_mp(mblk_t **, ssize_t);
2844extern mblk_t *ip_dlpi_alloc(size_t, t_uscalar_t);

--- 46 unchanged lines hidden (view full) ---

2891extern void ip_wput_nondata(ipsq_t *, queue_t *, mblk_t *, void *);
2892extern void ip_wsrv(queue_t *);
2893extern char *ip_nv_lookup(nv_t *, int);
2894extern boolean_t ip_local_addr_ok_v6(const in6_addr_t *, const in6_addr_t *);
2895extern boolean_t ip_remote_addr_ok_v6(const in6_addr_t *, const in6_addr_t *);
2896extern ipaddr_t ip_massage_options(ipha_t *);
2897extern ipaddr_t ip_net_mask(ipaddr_t);
2898extern void ip_newroute(queue_t *, mblk_t *, ipaddr_t, ill_t *, conn_t *);
2939extern const char *dlpi_prim_str(int);
2940extern const char *dlpi_err_str(int);
2941extern void ill_frag_timer(void *);
2942extern ill_t *ill_first(int, int, ill_walk_context_t *);
2943extern ill_t *ill_next(ill_walk_context_t *, ill_t *);
2944extern void ill_frag_timer_start(ill_t *);
2945extern mblk_t *ip_carve_mp(mblk_t **, ssize_t);
2946extern mblk_t *ip_dlpi_alloc(size_t, t_uscalar_t);

--- 46 unchanged lines hidden (view full) ---

2993extern void ip_wput_nondata(ipsq_t *, queue_t *, mblk_t *, void *);
2994extern void ip_wsrv(queue_t *);
2995extern char *ip_nv_lookup(nv_t *, int);
2996extern boolean_t ip_local_addr_ok_v6(const in6_addr_t *, const in6_addr_t *);
2997extern boolean_t ip_remote_addr_ok_v6(const in6_addr_t *, const in6_addr_t *);
2998extern ipaddr_t ip_massage_options(ipha_t *);
2999extern ipaddr_t ip_net_mask(ipaddr_t);
3000extern void ip_newroute(queue_t *, mblk_t *, ipaddr_t, ill_t *, conn_t *);
3001extern ipxmit_state_t ip_xmit_v4(mblk_t *, ire_t *, struct ipsec_out_s *,
3002 boolean_t);
3003extern int ip_hdr_complete(ipha_t *, zoneid_t);
2899
2900extern struct qinit rinit_ipv6;
2901extern struct qinit winit_ipv6;
2902extern struct qinit rinit_tcp;
2903extern struct qinit rinit_tcp6;
2904extern struct qinit winit_tcp;
2905extern struct qinit rinit_acceptor_tcp;
2906extern struct qinit winit_acceptor_tcp;

--- 9 unchanged lines hidden (view full) ---

2916extern boolean_t ipsec_in_is_secure(mblk_t *);
2917extern void ipsec_out_process(queue_t *, mblk_t *, ire_t *, uint_t);
2918extern void ipsec_out_to_in(mblk_t *);
2919extern int ill_forward_set(queue_t *, mblk_t *, boolean_t, caddr_t);
2920extern void ip_fanout_proto_again(mblk_t *, ill_t *, ill_t *, ire_t *);
2921
2922extern void ire_cleanup(ire_t *);
2923extern void ire_inactive(ire_t *);
3004
3005extern struct qinit rinit_ipv6;
3006extern struct qinit winit_ipv6;
3007extern struct qinit rinit_tcp;
3008extern struct qinit rinit_tcp6;
3009extern struct qinit winit_tcp;
3010extern struct qinit rinit_acceptor_tcp;
3011extern struct qinit winit_acceptor_tcp;

--- 9 unchanged lines hidden (view full) ---

3021extern boolean_t ipsec_in_is_secure(mblk_t *);
3022extern void ipsec_out_process(queue_t *, mblk_t *, ire_t *, uint_t);
3023extern void ipsec_out_to_in(mblk_t *);
3024extern int ill_forward_set(queue_t *, mblk_t *, boolean_t, caddr_t);
3025extern void ip_fanout_proto_again(mblk_t *, ill_t *, ill_t *, ire_t *);
3026
3027extern void ire_cleanup(ire_t *);
3028extern void ire_inactive(ire_t *);
3029extern boolean_t irb_inactive(irb_t *);
2924extern ire_t *ire_unlink(irb_t *);
2925#ifdef IRE_DEBUG
2926extern void ire_trace_ref(ire_t *ire);
2927extern void ire_untrace_ref(ire_t *ire);
2928extern void ire_thread_exit(ire_t *ire, caddr_t);
2929#endif
2930#ifdef ILL_DEBUG
2931extern void ill_trace_cleanup(ill_t *);

--- 25 unchanged lines hidden (view full) ---

2957 uint_t);
2958extern boolean_t ip_allocbuf(void **, uint_t *, boolean_t, const void *,
2959 uint_t);
2960extern void ip_savebuf(void **, uint_t *, boolean_t, const void *, uint_t);
2961
2962extern boolean_t ipsq_pending_mp_cleanup(ill_t *, conn_t *);
2963extern void conn_ioctl_cleanup(conn_t *);
2964extern ill_t *conn_get_held_ill(conn_t *, ill_t **, int *);
3030extern ire_t *ire_unlink(irb_t *);
3031#ifdef IRE_DEBUG
3032extern void ire_trace_ref(ire_t *ire);
3033extern void ire_untrace_ref(ire_t *ire);
3034extern void ire_thread_exit(ire_t *ire, caddr_t);
3035#endif
3036#ifdef ILL_DEBUG
3037extern void ill_trace_cleanup(ill_t *);

--- 25 unchanged lines hidden (view full) ---

3063 uint_t);
3064extern boolean_t ip_allocbuf(void **, uint_t *, boolean_t, const void *,
3065 uint_t);
3066extern void ip_savebuf(void **, uint_t *, boolean_t, const void *, uint_t);
3067
3068extern boolean_t ipsq_pending_mp_cleanup(ill_t *, conn_t *);
3069extern void conn_ioctl_cleanup(conn_t *);
3070extern ill_t *conn_get_held_ill(conn_t *, ill_t **, int *);
3071extern ill_t *ip_newroute_get_dst_ill(ill_t *);
2965
2966struct multidata_s;
2967struct pdesc_s;
2968
2969extern mblk_t *ip_mdinfo_alloc(ill_mdt_capab_t *);
2970extern mblk_t *ip_mdinfo_return(ire_t *, conn_t *, char *, ill_mdt_capab_t *);
2971extern uint_t ip_md_cksum(struct pdesc_s *, int, uint_t);
2972extern boolean_t ip_md_addr_attr(struct multidata_s *, struct pdesc_s *,

--- 255 unchanged lines hidden ---
3072
3073struct multidata_s;
3074struct pdesc_s;
3075
3076extern mblk_t *ip_mdinfo_alloc(ill_mdt_capab_t *);
3077extern mblk_t *ip_mdinfo_return(ire_t *, conn_t *, char *, ill_mdt_capab_t *);
3078extern uint_t ip_md_cksum(struct pdesc_s *, int, uint_t);
3079extern boolean_t ip_md_addr_attr(struct multidata_s *, struct pdesc_s *,

--- 255 unchanged lines hidden ---