Print this page
dccp: reset packet


  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 #ifdef _KERNEL
  41 
  42 #include <sys/sdt.h>
  43 #include <sys/dld.h>
  44 #include <inet/tunables.h>
  45 
  46 #define IP_MOD_ID               5701
  47 
  48 #define INET_NAME       "ip"
  49 
  50 #ifdef  _BIG_ENDIAN
  51 #define IP_HDR_CSUM_TTL_ADJUST  256
  52 #define IP_TCP_CSUM_COMP        IPPROTO_TCP
  53 #define IP_UDP_CSUM_COMP        IPPROTO_UDP
  54 #define IP_ICMPV6_CSUM_COMP     IPPROTO_ICMPV6

  55 #else
  56 #define IP_HDR_CSUM_TTL_ADJUST  1
  57 #define IP_TCP_CSUM_COMP        (IPPROTO_TCP << 8)
  58 #define IP_UDP_CSUM_COMP        (IPPROTO_UDP << 8)
  59 #define IP_ICMPV6_CSUM_COMP     (IPPROTO_ICMPV6 << 8)

  60 #endif
  61 
  62 #define TCP_CHECKSUM_OFFSET     16
  63 #define TCP_CHECKSUM_SIZE       2
  64 
  65 #define UDP_CHECKSUM_OFFSET     6
  66 #define UDP_CHECKSUM_SIZE       2
  67 
  68 #define ICMPV6_CHECKSUM_OFFSET  2
  69 #define ICMPV6_CHECKSUM_SIZE    2
  70 



  71 #define IPH_TCPH_CHECKSUMP(ipha, hlen)  \
  72         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + TCP_CHECKSUM_OFFSET)))
  73 
  74 #define IPH_UDPH_CHECKSUMP(ipha, hlen)  \
  75         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + UDP_CHECKSUM_OFFSET)))
  76 
  77 #define IPH_ICMPV6_CHECKSUMP(ipha, hlen)        \
  78         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + ICMPV6_CHECKSUM_OFFSET)))
  79 



  80 #define ILL_HCKSUM_CAPABLE(ill)         \
  81         (((ill)->ill_capabilities & ILL_CAPAB_HCKSUM) != 0)
  82 
  83 /*
  84  * Macro to adjust a given checksum value depending on any prepended
  85  * or postpended data on the packet.  It expects the start offset to
  86  * begin at an even boundary and that the packet consists of at most
  87  * two mblks.
  88  */
  89 #define IP_ADJCKSUM_PARTIAL(cksum_start, mp, mp1, len, adj) {           \
  90         /*                                                              \
  91          * Prepended extraneous data; adjust checksum.                  \
  92          */                                                             \
  93         if ((len) > 0)                                                       \
  94                 (adj) = IP_BCSUM_PARTIAL(cksum_start, len, 0);          \
  95         else                                                            \
  96                 (adj) = 0;                                              \
  97         /*                                                              \
  98          * len is now the total length of mblk(s)                       \
  99          */                                                             \




  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 #ifdef _KERNEL
  41 
  42 #include <sys/sdt.h>
  43 #include <sys/dld.h>
  44 #include <inet/tunables.h>
  45 
  46 #define IP_MOD_ID               5701
  47 
  48 #define INET_NAME       "ip"
  49 
  50 #ifdef  _BIG_ENDIAN
  51 #define IP_HDR_CSUM_TTL_ADJUST  256
  52 #define IP_TCP_CSUM_COMP        IPPROTO_TCP
  53 #define IP_UDP_CSUM_COMP        IPPROTO_UDP
  54 #define IP_ICMPV6_CSUM_COMP     IPPROTO_ICMPV6
  55 #define IP_DCCP_CSUM_COMP       IPPROTO_DCCP
  56 #else
  57 #define IP_HDR_CSUM_TTL_ADJUST  1
  58 #define IP_TCP_CSUM_COMP        (IPPROTO_TCP << 8)
  59 #define IP_UDP_CSUM_COMP        (IPPROTO_UDP << 8)
  60 #define IP_ICMPV6_CSUM_COMP     (IPPROTO_ICMPV6 << 8)
  61 #define IP_DCCP_CSUM_COMP       (IPPROTO_DCCP << 8)
  62 #endif
  63 
  64 #define TCP_CHECKSUM_OFFSET     16
  65 #define TCP_CHECKSUM_SIZE       2
  66 
  67 #define UDP_CHECKSUM_OFFSET     6
  68 #define UDP_CHECKSUM_SIZE       2
  69 
  70 #define ICMPV6_CHECKSUM_OFFSET  2
  71 #define ICMPV6_CHECKSUM_SIZE    2
  72 
  73 #define DCCP_CHECKSUM_OFFSET    6
  74 #define DCCP_CHECKSUM_SIZE      2
  75 
  76 #define IPH_TCPH_CHECKSUMP(ipha, hlen)  \
  77         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + TCP_CHECKSUM_OFFSET)))
  78 
  79 #define IPH_UDPH_CHECKSUMP(ipha, hlen)  \
  80         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + UDP_CHECKSUM_OFFSET)))
  81 
  82 #define IPH_ICMPV6_CHECKSUMP(ipha, hlen)        \
  83         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + ICMPV6_CHECKSUM_OFFSET)))
  84 
  85 #define IPH_DCCPH_CHECKSUMP(ipha, hlen) \
  86         ((uint16_t *)(((uchar_t *)(ipha)) + ((hlen) + DCCP_CHECKSUM_OFFSET)))
  87 
  88 #define ILL_HCKSUM_CAPABLE(ill)         \
  89         (((ill)->ill_capabilities & ILL_CAPAB_HCKSUM) != 0)
  90 
  91 /*
  92  * Macro to adjust a given checksum value depending on any prepended
  93  * or postpended data on the packet.  It expects the start offset to
  94  * begin at an even boundary and that the packet consists of at most
  95  * two mblks.
  96  */
  97 #define IP_ADJCKSUM_PARTIAL(cksum_start, mp, mp1, len, adj) {           \
  98         /*                                                              \
  99          * Prepended extraneous data; adjust checksum.                  \
 100          */                                                             \
 101         if ((len) > 0)                                                       \
 102                 (adj) = IP_BCSUM_PARTIAL(cksum_start, len, 0);          \
 103         else                                                            \
 104                 (adj) = 0;                                              \
 105         /*                                                              \
 106          * len is now the total length of mblk(s)                       \
 107          */                                                             \