Navigation


Changeset 1174:b72836fb814b in freeDiameter for libfdcore


Ignore:
Timestamp:
Jun 3, 2013, 1:05:37 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Add some compliancy to RFC6458. Not tested however as Ubuntu does not support this yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/sctp.c

    r1107 r1174  
    4545#endif /* CMSG_BUF_LEN */
    4646
    47 /* Level of SCTP-specific traces */
    48 #ifdef DEBUG_SCTP
    49 #define SCTP_LEVEL      FULL
    50 #else /* DEBUG_SCTP */
    51 #define SCTP_LEVEL      (FCTS + 1)
    52 #endif /* DEBUG_SCTP */
     47/* Use old draft-ietf-tsvwg-sctpsocket-17 API ? If not defined, RFC6458 API will be used */
     48/* #define OLD_SCTP_SOCKET_API */
     49
     50/* Automatically fallback to old API if some of the new symbols are not defined */
     51#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
     52# define OLD_SCTP_SOCKET_API
     53#endif
     54
    5355
    5456/* Temper with the retransmission timers to try and improve disconnection detection response? Undef this to keep the defaults of SCTP stack */
     
    5860
    5961/* Pre-binding socket options -- # streams read in config */
    60 /* The code of this file is based on draft-ietf-tsvwg-sctpsocket, versions 17 to 21 */
    6162static int fd_setsockopt_prebind(int sk)
    6263{
     
    7980                memset(&rtoinfo, 0, sizeof(rtoinfo));
    8081
    81                 if (TRACE_BOOL(SCTP_LEVEL)) {
     82                if (TRACE_BOOL(ANNOYING)) {
    8283                        sz = sizeof(rtoinfo);
    8384                        /* Read socket defaults */
     
    100101                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_RTOINFO, &rtoinfo, sizeof(rtoinfo))  );
    101102               
    102                 if (TRACE_BOOL(SCTP_LEVEL)) {
     103                if (TRACE_BOOL(ANNOYING)) {
    103104                        /* Check new values */
    104105                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_RTOINFO, &rtoinfo, &sz)  );
     
    109110        }
    110111        #else /* SCTP_RTOINFO */
    111         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_RTOINFO");
     112        TRACE_DEBUG(ANNOYING, "Skipping SCTP_RTOINFO");
    112113        #endif /* SCTP_RTOINFO */
    113114       
     
    118119                memset(&assoc, 0, sizeof(assoc));
    119120
    120                 if (TRACE_BOOL(SCTP_LEVEL)) {
     121                if (TRACE_BOOL(ANNOYING)) {
    121122                        sz = sizeof(assoc);
    122123                        /* Read socket defaults */
     
    140141                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_ASSOCINFO, &assoc, sizeof(assoc))  );
    141142               
    142                 if (TRACE_BOOL(SCTP_LEVEL)) {
     143                if (TRACE_BOOL(ANNOYING)) {
    143144                        /* Check new values */
    144145                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_ASSOCINFO, &assoc, &sz)  );
     
    151152        }
    152153        #else /* SCTP_ASSOCINFO */
    153         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_ASSOCINFO");
     154        TRACE_DEBUG(ANNOYING, "Skipping SCTP_ASSOCINFO");
    154155        #endif /* SCTP_ASSOCINFO */
    155156#endif /* ADJUST_RTX_PARAMS */
     
    161162                memset(&init, 0, sizeof(init));
    162163               
    163                 if (TRACE_BOOL(SCTP_LEVEL)) {
     164                if (TRACE_BOOL(ANNOYING)) {
    164165                        sz = sizeof(init);
    165166
     
    184185                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_INITMSG, &init, sizeof(init))  );
    185186               
    186                 if (TRACE_BOOL(SCTP_LEVEL)) {
     187                if (TRACE_BOOL(ANNOYING)) {
    187188                        /* Check new values */
    188189                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_INITMSG, &init, &sz)  );
     
    194195        }
    195196        #else /* SCTP_INITMSG */
    196         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_INITMSG");
     197        TRACE_DEBUG(ANNOYING, "Skipping SCTP_INITMSG");
    197198        #endif /* SCTP_INITMSG */
    198199       
     
    203204                memset(&linger, 0, sizeof(linger));
    204205               
    205                 if (TRACE_BOOL(SCTP_LEVEL)) {
     206                if (TRACE_BOOL(ANNOYING)) {
    206207                        sz = sizeof(linger);
    207208                        /* Read socket defaults */
     
    222223                CHECK_SYS(  setsockopt(sk, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger))  );
    223224               
    224                 if (TRACE_BOOL(SCTP_LEVEL)) {
     225                if (TRACE_BOOL(ANNOYING)) {
    225226                        /* Check new values */
    226227                        CHECK_SYS(  getsockopt(sk, SOL_SOCKET, SO_LINGER, &linger, &sz)  );
     
    230231        }
    231232        #else /* SO_LINGER */
    232         TRACE_DEBUG(SCTP_LEVEL, "Skipping SO_LINGER");
     233        TRACE_DEBUG(ANNOYING, "Skipping SO_LINGER");
    233234        #endif /* SO_LINGER */
    234235       
     
    238239                int nodelay;
    239240               
    240                 if (TRACE_BOOL(SCTP_LEVEL)) {
     241                if (TRACE_BOOL(ANNOYING)) {
    241242                        sz = sizeof(nodelay);
    242243                        /* Read socket defaults */
     
    255256                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_NODELAY, &nodelay, sizeof(nodelay))  );
    256257               
    257                 if (TRACE_BOOL(SCTP_LEVEL)) {
     258                if (TRACE_BOOL(ANNOYING)) {
    258259                        /* Check new values */
    259260                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_NODELAY, &nodelay, &sz)  );
     
    262263        }
    263264        #else /* SCTP_NODELAY */
    264         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_NODELAY");
     265        TRACE_DEBUG(ANNOYING, "Skipping SCTP_NODELAY");
    265266        #endif /* SCTP_NODELAY */
    266267       
     
    278279                int nofrag;
    279280               
    280                 if (TRACE_BOOL(SCTP_LEVEL)) {
     281                if (TRACE_BOOL(ANNOYING)) {
    281282                        sz = sizeof(nofrag);
    282283                        /* Read socket defaults */
     
    295296                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS, &nofrag, sizeof(nofrag))  );
    296297               
    297                 if (TRACE_BOOL(SCTP_LEVEL)) {
     298                if (TRACE_BOOL(ANNOYING)) {
    298299                        /* Check new values */
    299300                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS, &nofrag, &sz)  );
     
    314315                parms.spp_address.ss_family = AF_INET;
    315316               
    316                 if (TRACE_BOOL(SCTP_LEVEL)) {
     317                if (TRACE_BOOL(ANNOYING)) {
    317318                        sz = sizeof(parms);
    318319
     
    345346                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, &parms, sizeof(parms)) );
    346347               
    347                 if (TRACE_BOOL(SCTP_LEVEL)) {
     348                if (TRACE_BOOL(ANNOYING)) {
    348349                        /* Check new values */
    349350                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, &parms, &sz)  );
     
    357358        }
    358359        #else /* SCTP_PEER_ADDR_PARAMS */
    359         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_PEER_ADDR_PARAMS");
     360        TRACE_DEBUG(ANNOYING, "Skipping SCTP_PEER_ADDR_PARAMS");
    360361        #endif /* SCTP_PEER_ADDR_PARAMS */
    361362       
    362363        /*
    363            SCTP_DEFAULT_SEND_PARAM      parameters for the sendto() call, we don't use it.
     364           SCTP_DEFAULT_SEND_PARAM - DEPRECATED // parameters for the sendto() call, we don't use it.
    364365        */
    365366
    366367        /* Subscribe to some notifications */
    367         #ifdef SCTP_EVENTS
     368#ifdef OLD_SCTP_SOCKET_API
     369        #ifdef SCTP_EVENTS /* DEPRECATED */
    368370        {
    369371                struct sctp_event_subscribe event;
     
    383385                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(event)) );
    384386               
    385                 if (TRACE_BOOL(SCTP_LEVEL)) {
     387                if (TRACE_BOOL(ANNOYING)) {
    386388                        sz = sizeof(event);
    387389                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_EVENTS, &event, &sz) );
     
    404406        }
    405407        #else /* SCTP_EVENTS */
    406         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_EVENTS");
     408        TRACE_DEBUG(ANNOYING, "Skipping SCTP_EVENTS");
    407409        #endif /* SCTP_EVENTS */
     410#endif /*  OLD_SCTP_SOCKET_API */
    408411       
    409412        /* Set the v4 mapped addresses option */
     
    412415                int v4mapped;
    413416               
    414                 if (TRACE_BOOL(SCTP_LEVEL)) {
     417                if (TRACE_BOOL(ANNOYING)) {
    415418                        sz = sizeof(v4mapped);
    416419                        /* Read socket defaults */
     
    433436                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_I_WANT_MAPPED_V4_ADDR, &v4mapped, sizeof(v4mapped))  );
    434437               
    435                 if (TRACE_BOOL(SCTP_LEVEL)) {
     438                if (TRACE_BOOL(ANNOYING)) {
    436439                        /* Check new values */
    437440                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_I_WANT_MAPPED_V4_ADDR, &v4mapped, &sz)  );
     
    439442                }
    440443        } else {
    441                 TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_I_WANT_MAPPED_V4_ADDR, since IPv6 disabled.");
     444                TRACE_DEBUG(ANNOYING, "Skipping SCTP_I_WANT_MAPPED_V4_ADDR, since IPv6 disabled.");
    442445        }
    443446        #else /* SCTP_I_WANT_MAPPED_V4_ADDR */
    444         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_I_WANT_MAPPED_V4_ADDR");
     447        TRACE_DEBUG(ANNOYING, "Skipping SCTP_I_WANT_MAPPED_V4_ADDR");
    445448        #endif /* SCTP_I_WANT_MAPPED_V4_ADDR */
    446449       
     
    458461                int interleave;
    459462               
    460                 if (TRACE_BOOL(SCTP_LEVEL)) {
     463                if (TRACE_BOOL(ANNOYING)) {
    461464                        sz = sizeof(interleave);
    462465                        /* Read socket defaults */
     
    479482                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE, &interleave, sizeof(interleave))  );
    480483               
    481                 if (TRACE_BOOL(SCTP_LEVEL)) {
     484                if (TRACE_BOOL(ANNOYING)) {
    482485                        /* Check new values */
    483486                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE, &interleave, &sz)  );
     
    486489        }
    487490        #else /* SCTP_FRAGMENT_INTERLEAVE */
    488         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_FRAGMENT_INTERLEAVE");
     491        TRACE_DEBUG(ANNOYING, "Skipping SCTP_FRAGMENT_INTERLEAVE");
    489492        #endif /* SCTP_FRAGMENT_INTERLEAVE */
    490493       
    491494        /*
    492495           SCTP_PARTIAL_DELIVERY_POINT  control partial delivery size
    493            SCTP_USE_EXT_RCVINFO         use extended receive info structure (information about the next message if available)
     496           SCTP_USE_EXT_RCVINFO - DEPRECATED    use extended receive info structure (information about the next message if available)
    494497         */
    495498        /* SCTP_AUTO_ASCONF is set by the postbind function */
     
    504507                int bool;
    505508               
    506                 if (TRACE_BOOL(SCTP_LEVEL)) {
     509                if (TRACE_BOOL(ANNOYING)) {
    507510                        sz = sizeof(bool);
    508511                        /* Read socket defaults */
     
    521524                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_EXPLICIT_EOR, &bool, sizeof(bool))  );
    522525               
    523                 if (TRACE_BOOL(SCTP_LEVEL)) {
     526                if (TRACE_BOOL(ANNOYING)) {
    524527                        /* Check new values */
    525528                        CHECK_SYS(  getsockopt(sk, IPPROTO_SCTP, SCTP_EXPLICIT_EOR, &bool, &sz)  );
     
    528531        }
    529532        #else /* SCTP_EXPLICIT_EOR */
    530         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_EXPLICIT_EOR");
     533        TRACE_DEBUG(ANNOYING, "Skipping SCTP_EXPLICIT_EOR");
    531534        #endif /* SCTP_EXPLICIT_EOR */
    532535       
    533536        /*
    534537           SCTP_REUSE_PORT              share one listening port with several sockets
    535            SCTP_EVENT                   same as EVENTS ?
    536538        */
    537539       
     540#ifndef OLD_SCTP_SOCKET_API
     541        #ifdef SCTP_EVENT
     542        {
     543                /* Subscribe to the following events */
     544                int events_I_want[] = {
     545                #ifdef SCTP_ASSOC_CHANGE
     546                        /* SCTP_ASSOC_CHANGE, */
     547                #endif
     548                #ifdef SCTP_PEER_ADDR_CHANGE
     549                        SCTP_PEER_ADDR_CHANGE,
     550                #endif
     551                #ifdef SCTP_REMOTE_ERROR
     552                        SCTP_REMOTE_ERROR,
     553                #endif
     554                #ifdef SCTP_SEND_FAILED_EVENT
     555                        SCTP_SEND_FAILED_EVENT,
     556                #endif
     557                #ifdef SCTP_SHUTDOWN_EVENT
     558                        SCTP_SHUTDOWN_EVENT,
     559                #endif
     560                #ifdef SCTP_ADAPTATION_INDICATION
     561                        /* SCTP_ADAPTATION_INDICATION, */
     562                #endif
     563                #ifdef SCTP_PARTIAL_DELIVERY_EVENT
     564                        /* SCTP_PARTIAL_DELIVERY_EVENT, */
     565                #endif
     566                #ifdef SCTP_AUTHENTICATION_EVENT
     567                        /* SCTP_AUTHENTICATION_EVENT, */
     568                #endif
     569                #ifdef SCTP_SENDER_DRY_EVENT
     570                        /* SCTP_SENDER_DRY_EVENT, */
     571                #endif
     572                        0
     573                };
     574                int i;
     575               
     576                struct sctp_event event;
     577               
     578                for (i = 0; i < (sizeof(events_I_want) / sizeof(events_I_want[0]) - 1; i++) {
     579                        memset(&event, 0, sizeof(event));
     580                        event.se_type = events_I_want[i];
     581                        event.se_on = 1;
     582                       
     583                        /* Set the option to the socket */
     584                        CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(event)) );
     585                }
     586        }
     587        #else /* SCTP_EVENT */
     588        TRACE_DEBUG(ANNOYING, "Skipping SCTP_EVENT");
     589        #endif /* SCTP_EVENT */
     590       
     591       
     592        #ifdef SCTP_RECVRCVINFO /* Replaces SCTP_SNDRCV */
     593        {
     594                int bool = 1;
     595               
     596                /* Set the option to the socket */
     597                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_RECVRCVINFO, &bool, sizeof(bool))  );
     598               
     599        }
     600        #else /* SCTP_RECVRCVINFO */
     601        TRACE_DEBUG(ANNOYING, "Skipping SCTP_RECVRCVINFO");
     602        #endif /* SCTP_RECVRCVINFO */
     603       
     604       
     605#endif /* OLD_SCTP_SOCKET_API */
     606       
     607        /*
     608                SCTP_RECVNXTINFO
     609               
     610                SCTP_DEFAULT_SNDINFO : send defaults
     611                SCTP_DEFAULT_PRINFO  : default PR-SCTP
     612        */
     613       
     614
    538615        /* In case of no_ip4, force the v6only option */
    539616        #ifdef IPV6_V6ONLY
     
    560637                int asconf;
    561638               
    562                 if (TRACE_BOOL(SCTP_LEVEL)) {
     639                if (TRACE_BOOL(ANNOYING)) {
    563640                        socklen_t sz;
    564641
     
    579656                CHECK_SYS(  setsockopt(sk, IPPROTO_SCTP, SCTP_AUTO_ASCONF, &asconf, sizeof(asconf))  );
    580657               
    581                 if (TRACE_BOOL(SCTP_LEVEL)) {
     658                if (TRACE_BOOL(ANNOYING)) {
    582659                        socklen_t sz = sizeof(asconf);
    583660                        /* Check new values */
     
    587664        }
    588665        #else /* SCTP_AUTO_ASCONF */
    589         TRACE_DEBUG(SCTP_LEVEL, "Skipping SCTP_AUTO_ASCONF");
     666        TRACE_DEBUG(ANNOYING, "Skipping SCTP_AUTO_ASCONF");
    590667        #endif /* SCTP_AUTO_ASCONF */
    591668       
     
    10051082        struct iovec  iov;
    10061083        struct cmsghdr          *hdr;
     1084#ifdef OLD_SCTP_SOCKET_API
    10071085        struct sctp_sndrcvinfo  *sndrcv;
    10081086        uint8_t anci[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
     1087#else /* OLD_SCTP_SOCKET_API */
     1088        struct sctp_sndinfo     *sndinf;
     1089        uint8_t anci[CMSG_SPACE(sizeof(struct sctp_sndinfo))]; 
     1090#endif /* OLD_SCTP_SOCKET_API */
    10091091        ssize_t ret;
    10101092        int timedout = 0;
     
    10231105        /* Anciliary data: specify SCTP stream */
    10241106        hdr = (struct cmsghdr *)anci;
    1025         sndrcv = (struct sctp_sndrcvinfo *)CMSG_DATA(hdr);
    10261107        hdr->cmsg_len   = sizeof(anci);
    10271108        hdr->cmsg_level = IPPROTO_SCTP;
     1109#ifdef OLD_SCTP_SOCKET_API
    10281110        hdr->cmsg_type  = SCTP_SNDRCV;
     1111        sndrcv = (struct sctp_sndrcvinfo *)CMSG_DATA(hdr);
    10291112        sndrcv->sinfo_stream = strid;
     1113#else /* OLD_SCTP_SOCKET_API */
     1114        hdr->cmsg_type  = SCTP_SNDINFO;
     1115        sndinf = (struct sctp_sndinfo *)CMSG_DATA(hdr);
     1116        sndinf->snd_sid = strid;
     1117#endif /* OLD_SCTP_SOCKET_API */
    10301118        /* note : we could store other data also, for example in .sinfo_ppid for remote peer or in .sinfo_context for errors. */
    10311119       
     
    10851173        mhdr.msg_controllen = sizeof(ancidata);
    10861174       
     1175next_message:
     1176        datasize = 0;
     1177       
    10871178        /* We will loop while all data is not received. */
    10881179incomplete:
     
    11391230                switch (notif->sn_header.sn_type) {
    11401231                       
    1141                         case SCTP_ASSOC_CHANGE:
     1232                        case SCTP_ASSOC_CHANGE: /* We should not receive these as we did not subscribe for it */
    11421233                                TRACE_DEBUG(FULL, "Received SCTP_ASSOC_CHANGE notification");
    1143                                 TRACE_DEBUG(SCTP_LEVEL, "    state : %hu", notif->sn_assoc_change.sac_state);
    1144                                 TRACE_DEBUG(SCTP_LEVEL, "    error : %hu", notif->sn_assoc_change.sac_error);
    1145                                 TRACE_DEBUG(SCTP_LEVEL, "    instr : %hu", notif->sn_assoc_change.sac_inbound_streams);
    1146                                 TRACE_DEBUG(SCTP_LEVEL, "   outstr : %hu", notif->sn_assoc_change.sac_outbound_streams);
     1234                                TRACE_DEBUG(ANNOYING, "    state : %hu", notif->sn_assoc_change.sac_state);
     1235                                TRACE_DEBUG(ANNOYING, "    error : %hu", notif->sn_assoc_change.sac_error);
     1236                                TRACE_DEBUG(ANNOYING, "    instr : %hu", notif->sn_assoc_change.sac_inbound_streams);
     1237                                TRACE_DEBUG(ANNOYING, "   outstr : %hu", notif->sn_assoc_change.sac_outbound_streams);
    11471238                               
    11481239                                *event = FDEVP_CNX_EP_CHANGE;
     
    11511242                        case SCTP_PEER_ADDR_CHANGE:
    11521243                                TRACE_DEBUG(FULL, "Received SCTP_PEER_ADDR_CHANGE notification");
    1153                                 /* TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, "    intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); */
    1154                                 TRACE_DEBUG(SCTP_LEVEL, "          state : %d", notif->sn_paddr_change.spc_state);
    1155                                 TRACE_DEBUG(SCTP_LEVEL, "          error : %d", notif->sn_paddr_change.spc_error);
     1244                                /* TRACE_sSA(FD_LOG_DEBUG, ANNOYING, "    intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); */
     1245                                TRACE_DEBUG(ANNOYING, "          state : %d", notif->sn_paddr_change.spc_state);
     1246                                TRACE_DEBUG(ANNOYING, "          error : %d", notif->sn_paddr_change.spc_error);
    11561247                               
    11571248                                *event = FDEVP_CNX_EP_CHANGE;
    11581249                                break;
    11591250       
    1160                         case SCTP_SEND_FAILED:
    1161                                 TRACE_DEBUG(FULL, "Received SCTP_SEND_FAILED notification");
    1162                                 TRACE_DEBUG(SCTP_LEVEL, "    len : %hu", notif->sn_send_failed.ssf_length);
    1163                                 TRACE_DEBUG(SCTP_LEVEL, "    err : %d",  notif->sn_send_failed.ssf_error);
     1251                        case SCTP_REMOTE_ERROR:
     1252                                TRACE_DEBUG(FULL, "Received SCTP_REMOTE_ERROR notification");
     1253                                TRACE_DEBUG(ANNOYING, "    err : %hu", ntohs(notif->sn_remote_error.sre_error));
     1254                                TRACE_DEBUG(ANNOYING, "    len : %hu", ntohs(notif->sn_remote_error.sre_length));
    11641255                               
    11651256                                *event = FDEVP_CNX_ERROR;
    11661257                                break;
    1167                        
    1168                         case SCTP_REMOTE_ERROR:
    1169                                 TRACE_DEBUG(FULL, "Received SCTP_REMOTE_ERROR notification");
    1170                                 TRACE_DEBUG(SCTP_LEVEL, "    err : %hu", ntohs(notif->sn_remote_error.sre_error));
    1171                                 TRACE_DEBUG(SCTP_LEVEL, "    len : %hu", ntohs(notif->sn_remote_error.sre_length));
     1258       
     1259#ifdef OLD_SCTP_SOCKET_API
     1260                        case SCTP_SEND_FAILED:
     1261                                TRACE_DEBUG(FULL, "Received SCTP_SEND_FAILED notification");
     1262                                TRACE_DEBUG(ANNOYING, "    len : %hu", notif->sn_send_failed.ssf_length);
     1263                                TRACE_DEBUG(ANNOYING, "    err : %d",  notif->sn_send_failed.ssf_error);
    11721264                               
    11731265                                *event = FDEVP_CNX_ERROR;
    11741266                                break;
    1175        
     1267#else /*  OLD_SCTP_SOCKET_API */
     1268                        case SCTP_SEND_FAILED_EVENT:
     1269                                TRACE_DEBUG(FULL, "Received SCTP_SEND_FAILED_EVENT notification");
     1270                                *event = FDEVP_CNX_ERROR;
     1271                                break;
     1272#endif  /*  OLD_SCTP_SOCKET_API */             
    11761273                        case SCTP_SHUTDOWN_EVENT:
    11771274                                TRACE_DEBUG(FULL, "Received SCTP_SHUTDOWN_EVENT notification");
     
    11791276                                *event = FDEVP_CNX_SHUTDOWN;
    11801277                                break;
     1278                               
     1279#ifndef OLD_SCTP_SOCKET_API
     1280                        case SCTP_NOTIFICATIONS_STOPPED_EVENT:
     1281                                TRACE_DEBUG(INFO, "Received SCTP_NOTIFICATIONS_STOPPED_EVENT notification, marking the association in error state");
     1282                                *event = FDEVP_CNX_ERROR;
     1283                                break;
     1284#endif  /*  OLD_SCTP_SOCKET_API */             
    11811285                       
    11821286                        default:       
    1183                                 TRACE_DEBUG(FULL, "Received unknown notification %d, assume error", notif->sn_header.sn_type);
    1184                                 *event = FDEVP_CNX_ERROR;
     1287                                TRACE_DEBUG(FULL, "Received unknown notification %d, ignored", notif->sn_header.sn_type);
     1288                                goto next_message;
    11851289                }
    11861290               
     
    11961300        if (strid) {
    11971301                struct cmsghdr          *hdr;
     1302#ifdef OLD_SCTP_SOCKET_API
    11981303                struct sctp_sndrcvinfo  *sndrcv;
     1304#else /*  OLD_SCTP_SOCKET_API */
     1305                struct sctp_rcvinfo     *rcvinf;
     1306#endif /*  OLD_SCTP_SOCKET_API */
    11991307               
    12001308                /* Handle the anciliary data */
     
    12071315                        }
    12081316                       
     1317#ifdef OLD_SCTP_SOCKET_API
    12091318                        /* Also only interested in SCTP_SNDRCV message for the moment */
    12101319                        if (hdr->cmsg_type != SCTP_SNDRCV) {
     
    12141323                       
    12151324                        sndrcv = (struct sctp_sndrcvinfo *) CMSG_DATA(hdr);
    1216                         if (TRACE_BOOL(SCTP_LEVEL)) {
     1325                        if (TRACE_BOOL(ANNOYING)) {
    12171326                                fd_log_debug( "Anciliary block IPPROTO_SCTP / SCTP_SNDRCV");
    12181327                                fd_log_debug( "    sinfo_stream    : %hu", sndrcv->sinfo_stream);
     
    12281337
    12291338                        *strid = sndrcv->sinfo_stream;
     1339#else /*  OLD_SCTP_SOCKET_API */
     1340                        /* Also only interested in SCTP_RCVINFO message for the moment */
     1341                        if (hdr->cmsg_type != SCTP_RCVINFO) {
     1342                                TRACE_DEBUG(FULL, "Anciliary block IPPROTO_SCTP / %d, skipped", hdr->cmsg_type);
     1343                                continue;
     1344                        }
     1345                       
     1346                        rcvinf = (struct sctp_rcvinfo *) CMSG_DATA(hdr);
     1347
     1348                        *strid = rcvinf->rcv_sid;
     1349#endif /*  OLD_SCTP_SOCKET_API */
     1350                       
     1351                       
    12301352                }
    12311353                TRACE_DEBUG(FULL, "Received %zdb data on socket %d, stream %hu", datasize, conn->cc_socket, *strid);
Note: See TracChangeset for help on using the changeset viewer.