Print this page
dccp: conn_t


  67 /* Unused                       0x00100000 */
  68 /* Unused                       0x00200000 */
  69 /* Unused                       0x00400000 */
  70 #define IPCL_CL_LISTENER        0x00800000      /* Cluster listener */
  71 /* Unused                       0x01000000 */
  72 /* Unused                       0x02000000 */
  73 /* Unused                       0x04000000 */
  74 /* Unused                       0x08000000 */
  75 /* Unused                       0x10000000 */
  76 /* Unused                       0x20000000 */
  77 #define IPCL_CONNECTED          0x40000000      /* Conn in connected table */
  78 #define IPCL_BOUND              0x80000000      /* Conn in bind table */
  79 
  80 /* Flags identifying the type of conn */
  81 #define IPCL_TCPCONN            0x00000001      /* From tcp_conn_cache */
  82 #define IPCL_SCTPCONN           0x00000002      /* From sctp_conn_cache */
  83 #define IPCL_IPCCONN            0x00000004      /* From ip_conn_cache */
  84 #define IPCL_UDPCONN            0x00000008      /* From udp_conn_cache */
  85 #define IPCL_RAWIPCONN          0x00000010      /* From rawip_conn_cache */
  86 #define IPCL_RTSCONN            0x00000020      /* From rts_conn_cache */
  87 /* Unused                       0x00000040 */
  88 #define IPCL_IPTUN              0x00000080      /* iptun module above us */
  89 
  90 #define IPCL_NONSTR             0x00001000      /* A non-STREAMS socket */
  91 /* Unused                       0x10000000 */
  92 
  93 #define IPCL_REMOVED            0x00000100
  94 #define IPCL_REUSED             0x00000200
  95 
  96 #define IPCL_IS_CONNECTED(connp)                                        \
  97         ((connp)->conn_flags & IPCL_CONNECTED)
  98 
  99 #define IPCL_IS_BOUND(connp)                                            \
 100         ((connp)->conn_flags & IPCL_BOUND)
 101 
 102 /*
 103  * Can't use conn_proto since we need to tell difference
 104  * between a real TCP socket and a SOCK_RAW, IPPROTO_TCP.
 105  */
 106 #define IPCL_IS_TCP(connp)                                              \
 107         ((connp)->conn_flags & IPCL_TCPCONN)
 108 
 109 #define IPCL_IS_SCTP(connp)                                             \
 110         ((connp)->conn_flags & IPCL_SCTPCONN)
 111 
 112 #define IPCL_IS_UDP(connp)                                              \
 113         ((connp)->conn_flags & IPCL_UDPCONN)
 114 
 115 #define IPCL_IS_RAWIP(connp)                                            \
 116         ((connp)->conn_flags & IPCL_RAWIPCONN)
 117 
 118 #define IPCL_IS_RTS(connp)                                              \
 119         ((connp)->conn_flags & IPCL_RTSCONN)
 120 
 121 #define IPCL_IS_IPTUN(connp)                                            \
 122         ((connp)->conn_flags & IPCL_IPTUN)
 123 



 124 #define IPCL_IS_NONSTR(connp)   ((connp)->conn_flags & IPCL_NONSTR)
 125 
 126 typedef struct connf_s connf_t;
 127 
 128 typedef struct
 129 {
 130         int     ctb_depth;
 131 #define CONN_STACK_DEPTH        15
 132         pc_t    ctb_stack[CONN_STACK_DEPTH];
 133 } conn_trace_t;
 134 
 135 typedef struct ip_helper_minor_info_s {
 136         dev_t   ip_minfo_dev;           /* Device */
 137         vmem_t  *ip_minfo_arena;        /* Arena */
 138 } ip_helper_minfo_t;
 139 
 140 /*
 141  * ip helper stream info
 142  */
 143 typedef struct ip_helper_stream_info_s {


 220  * and are preserved when it is freed. Fields after that are bzero'ed when
 221  * the conn_t is freed.
 222  *
 223  * Much of the conn_t is protected by conn_lock.
 224  *
 225  * conn_lock is also used by some ULPs (like UDP and RAWIP) to protect
 226  * their state.
 227  */
 228 struct conn_s {
 229         kmutex_t        conn_lock;
 230         uint32_t        conn_ref;               /* Reference counter */
 231         uint32_t        conn_flags;             /* Conn Flags */
 232 
 233         union {
 234                 tcp_t           *cp_tcp;        /* Pointer to the tcp struct */
 235                 struct udp_s    *cp_udp;        /* Pointer to the udp struct */
 236                 struct icmp_s   *cp_icmp;       /* Pointer to rawip struct */
 237                 struct rts_s    *cp_rts;        /* Pointer to rts struct */
 238                 struct iptun_s  *cp_iptun;      /* Pointer to iptun_t */
 239                 struct sctp_s   *cp_sctp;       /* For IPCL_SCTPCONN */

 240                 void            *cp_priv;
 241         } conn_proto_priv;
 242 #define conn_tcp        conn_proto_priv.cp_tcp
 243 #define conn_udp        conn_proto_priv.cp_udp
 244 #define conn_icmp       conn_proto_priv.cp_icmp
 245 #define conn_rts        conn_proto_priv.cp_rts
 246 #define conn_iptun      conn_proto_priv.cp_iptun
 247 #define conn_sctp       conn_proto_priv.cp_sctp

 248 #define conn_priv       conn_proto_priv.cp_priv
 249 
 250         kcondvar_t      conn_cv;
 251         uint8_t         conn_proto;             /* protocol type */
 252 
 253         edesc_rpf       conn_recv;              /* Pointer to recv routine */
 254         edesc_rpf       conn_recvicmp;          /* For ICMP error */
 255         edesc_vpf       conn_verifyicmp;        /* Verify ICMP error */
 256 
 257         ip_xmit_attr_t  *conn_ixa;              /* Options if no ancil data */
 258 
 259         /* Fields after this are bzero'ed when the conn_t is freed. */
 260 #define conn_start_clr  conn_recv_ancillary
 261 
 262         /* Options for receive-side ancillary data */
 263         crb_t           conn_recv_ancillary;
 264 
 265         squeue_t        *conn_sqp;              /* Squeue for processing */
 266         uint_t          conn_state_flags;       /* IP state flags */
 267 


 634         ((ntohl(laddr) ^ ((ntohl(faddr) << 24) | (ntohl(faddr) >> 8))) % \
 635         ipcl_iptun_fanout_size)
 636 
 637 #define IPCL_IPTUN_HASH_V6(laddr, faddr)                                \
 638         IPCL_IPTUN_HASH((laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^   \
 639             (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3],                \
 640             (faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^               \
 641             (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3])
 642 
 643 #define IPCL_IPTUN_MATCH(connp, laddr, faddr)                   \
 644         (_IPCL_V4_MATCH((connp)->conn_laddr_v6, (laddr)) &&  \
 645         _IPCL_V4_MATCH((connp)->conn_faddr_v6, (faddr)))
 646 
 647 #define IPCL_IPTUN_MATCH_V6(connp, laddr, faddr)                \
 648         (IN6_ARE_ADDR_EQUAL(&(connp)->conn_laddr_v6, (laddr)) && \
 649         IN6_ARE_ADDR_EQUAL(&(connp)->conn_faddr_v6, (faddr)))
 650 
 651 #define IPCL_UDP_HASH(lport, ipst)      \
 652         IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_udp_fanout_size)
 653 



 654 #define CONN_G_HASH_SIZE        1024
 655 
 656 /* Raw socket hash function. */
 657 #define IPCL_RAW_HASH(lport, ipst)      \
 658         IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_raw_fanout_size)
 659 
 660 /*
 661  * This is similar to IPCL_BIND_MATCH except that the local port check
 662  * is changed to a wildcard port check.
 663  * We compare conn_laddr since it captures both connected and a bind to
 664  * a multicast or broadcast address.
 665  */
 666 #define IPCL_RAW_MATCH(connp, proto, laddr)                     \
 667         ((connp)->conn_proto == (proto) &&                   \
 668         (connp)->conn_lport == 0 &&                          \
 669         (_IPCL_V4_MATCH_ANY((connp)->conn_laddr_v6) ||               \
 670         _IPCL_V4_MATCH((connp)->conn_laddr_v6, (laddr))))
 671 
 672 #define IPCL_RAW_MATCH_V6(connp, proto, laddr)                  \
 673         ((connp)->conn_proto == (proto) &&                   \




  67 /* Unused                       0x00100000 */
  68 /* Unused                       0x00200000 */
  69 /* Unused                       0x00400000 */
  70 #define IPCL_CL_LISTENER        0x00800000      /* Cluster listener */
  71 /* Unused                       0x01000000 */
  72 /* Unused                       0x02000000 */
  73 /* Unused                       0x04000000 */
  74 /* Unused                       0x08000000 */
  75 /* Unused                       0x10000000 */
  76 /* Unused                       0x20000000 */
  77 #define IPCL_CONNECTED          0x40000000      /* Conn in connected table */
  78 #define IPCL_BOUND              0x80000000      /* Conn in bind table */
  79 
  80 /* Flags identifying the type of conn */
  81 #define IPCL_TCPCONN            0x00000001      /* From tcp_conn_cache */
  82 #define IPCL_SCTPCONN           0x00000002      /* From sctp_conn_cache */
  83 #define IPCL_IPCCONN            0x00000004      /* From ip_conn_cache */
  84 #define IPCL_UDPCONN            0x00000008      /* From udp_conn_cache */
  85 #define IPCL_RAWIPCONN          0x00000010      /* From rawip_conn_cache */
  86 #define IPCL_RTSCONN            0x00000020      /* From rts_conn_cache */
  87 #define IPCL_DCCPCONN           0x00000040      /* From dccp_conn_cache */
  88 #define IPCL_IPTUN              0x00000080      /* iptun module above us */
  89 
  90 #define IPCL_NONSTR             0x00001000      /* A non-STREAMS socket */
  91 /* Unused                       0x10000000 */
  92 
  93 #define IPCL_REMOVED            0x00000100
  94 #define IPCL_REUSED             0x00000200
  95 
  96 #define IPCL_IS_CONNECTED(connp)                                        \
  97         ((connp)->conn_flags & IPCL_CONNECTED)
  98 
  99 #define IPCL_IS_BOUND(connp)                                            \
 100         ((connp)->conn_flags & IPCL_BOUND)
 101 
 102 /*
 103  * Can't use conn_proto since we need to tell difference
 104  * between a real TCP socket and a SOCK_RAW, IPPROTO_TCP.
 105  */
 106 #define IPCL_IS_TCP(connp)                                              \
 107         ((connp)->conn_flags & IPCL_TCPCONN)
 108 
 109 #define IPCL_IS_SCTP(connp)                                             \
 110         ((connp)->conn_flags & IPCL_SCTPCONN)
 111 
 112 #define IPCL_IS_UDP(connp)                                              \
 113         ((connp)->conn_flags & IPCL_UDPCONN)
 114 
 115 #define IPCL_IS_RAWIP(connp)                                            \
 116         ((connp)->conn_flags & IPCL_RAWIPCONN)
 117 
 118 #define IPCL_IS_RTS(connp)                                              \
 119         ((connp)->conn_flags & IPCL_RTSCONN)
 120 
 121 #define IPCL_IS_IPTUN(connp)                                            \
 122         ((connp)->conn_flags & IPCL_IPTUN)
 123 
 124 #define IPCL_IS_DCCP(connp)                                             \
 125         ((connp)->conn_flags & IPCL_DCCPCONN)
 126 
 127 #define IPCL_IS_NONSTR(connp)   ((connp)->conn_flags & IPCL_NONSTR)
 128 
 129 typedef struct connf_s connf_t;
 130 
 131 typedef struct
 132 {
 133         int     ctb_depth;
 134 #define CONN_STACK_DEPTH        15
 135         pc_t    ctb_stack[CONN_STACK_DEPTH];
 136 } conn_trace_t;
 137 
 138 typedef struct ip_helper_minor_info_s {
 139         dev_t   ip_minfo_dev;           /* Device */
 140         vmem_t  *ip_minfo_arena;        /* Arena */
 141 } ip_helper_minfo_t;
 142 
 143 /*
 144  * ip helper stream info
 145  */
 146 typedef struct ip_helper_stream_info_s {


 223  * and are preserved when it is freed. Fields after that are bzero'ed when
 224  * the conn_t is freed.
 225  *
 226  * Much of the conn_t is protected by conn_lock.
 227  *
 228  * conn_lock is also used by some ULPs (like UDP and RAWIP) to protect
 229  * their state.
 230  */
 231 struct conn_s {
 232         kmutex_t        conn_lock;
 233         uint32_t        conn_ref;               /* Reference counter */
 234         uint32_t        conn_flags;             /* Conn Flags */
 235 
 236         union {
 237                 tcp_t           *cp_tcp;        /* Pointer to the tcp struct */
 238                 struct udp_s    *cp_udp;        /* Pointer to the udp struct */
 239                 struct icmp_s   *cp_icmp;       /* Pointer to rawip struct */
 240                 struct rts_s    *cp_rts;        /* Pointer to rts struct */
 241                 struct iptun_s  *cp_iptun;      /* Pointer to iptun_t */
 242                 struct sctp_s   *cp_sctp;       /* For IPCL_SCTPCONN */
 243                 struct dccp_s   *cp_dccp;       /* Pointer to dccp struct */
 244                 void            *cp_priv;
 245         } conn_proto_priv;
 246 #define conn_tcp        conn_proto_priv.cp_tcp
 247 #define conn_udp        conn_proto_priv.cp_udp
 248 #define conn_icmp       conn_proto_priv.cp_icmp
 249 #define conn_rts        conn_proto_priv.cp_rts
 250 #define conn_iptun      conn_proto_priv.cp_iptun
 251 #define conn_sctp       conn_proto_priv.cp_sctp
 252 #define conn_dccp       conn_proto_priv.cp_dccp
 253 #define conn_priv       conn_proto_priv.cp_priv
 254 
 255         kcondvar_t      conn_cv;
 256         uint8_t         conn_proto;             /* protocol type */
 257 
 258         edesc_rpf       conn_recv;              /* Pointer to recv routine */
 259         edesc_rpf       conn_recvicmp;          /* For ICMP error */
 260         edesc_vpf       conn_verifyicmp;        /* Verify ICMP error */
 261 
 262         ip_xmit_attr_t  *conn_ixa;              /* Options if no ancil data */
 263 
 264         /* Fields after this are bzero'ed when the conn_t is freed. */
 265 #define conn_start_clr  conn_recv_ancillary
 266 
 267         /* Options for receive-side ancillary data */
 268         crb_t           conn_recv_ancillary;
 269 
 270         squeue_t        *conn_sqp;              /* Squeue for processing */
 271         uint_t          conn_state_flags;       /* IP state flags */
 272 


 639         ((ntohl(laddr) ^ ((ntohl(faddr) << 24) | (ntohl(faddr) >> 8))) % \
 640         ipcl_iptun_fanout_size)
 641 
 642 #define IPCL_IPTUN_HASH_V6(laddr, faddr)                                \
 643         IPCL_IPTUN_HASH((laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^   \
 644             (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3],                \
 645             (faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^               \
 646             (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3])
 647 
 648 #define IPCL_IPTUN_MATCH(connp, laddr, faddr)                   \
 649         (_IPCL_V4_MATCH((connp)->conn_laddr_v6, (laddr)) &&  \
 650         _IPCL_V4_MATCH((connp)->conn_faddr_v6, (faddr)))
 651 
 652 #define IPCL_IPTUN_MATCH_V6(connp, laddr, faddr)                \
 653         (IN6_ARE_ADDR_EQUAL(&(connp)->conn_laddr_v6, (laddr)) && \
 654         IN6_ARE_ADDR_EQUAL(&(connp)->conn_faddr_v6, (faddr)))
 655 
 656 #define IPCL_UDP_HASH(lport, ipst)      \
 657         IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_udp_fanout_size)
 658 
 659 #define IPCL_DCCP_HASH(lport, ipst)     \
 660         IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_dccp_fanout_size)
 661 
 662 #define CONN_G_HASH_SIZE        1024
 663 
 664 /* Raw socket hash function. */
 665 #define IPCL_RAW_HASH(lport, ipst)      \
 666         IPCL_PORT_HASH(lport, (ipst)->ips_ipcl_raw_fanout_size)
 667 
 668 /*
 669  * This is similar to IPCL_BIND_MATCH except that the local port check
 670  * is changed to a wildcard port check.
 671  * We compare conn_laddr since it captures both connected and a bind to
 672  * a multicast or broadcast address.
 673  */
 674 #define IPCL_RAW_MATCH(connp, proto, laddr)                     \
 675         ((connp)->conn_proto == (proto) &&                   \
 676         (connp)->conn_lport == 0 &&                          \
 677         (_IPCL_V4_MATCH_ANY((connp)->conn_laddr_v6) ||               \
 678         _IPCL_V4_MATCH((connp)->conn_laddr_v6, (laddr))))
 679 
 680 #define IPCL_RAW_MATCH_V6(connp, proto, laddr)                  \
 681         ((connp)->conn_proto == (proto) &&                   \