Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/udp_discard_cli.c

    r321 r331  
    22 *  TINET (TCP/IP Protocol Stack)
    33 *
    4  *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
     4 *  Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    66 *
     
    5656#endif  /* of #ifdef TARGET_KERNEL_JSP */
    5757
    58 #include <tinet_defs.h>
    59 #include <tinet_config.h>
    60 
    61 #include <net/if.h>
    62 #include <net/if_ppp.h>
    63 #include <net/if_loop.h>
    64 #include <net/ethernet.h>
    65 #include <net/net.h>
    66 #include <net/net_var.h>
    67 #include <net/net_timer.h>
    68 
    6958#include <netinet/in.h>
     59#include <netinet/in_itron.h>
    7060#include <netinet/ip.h>
    71 #include <netinet/ip6.h>
    7261#include <netinet/udp.h>
    73 #include <netinet/udp_var.h>
    74 #include <netinet/in_itron.h>
    7562
    7663#include <netapp/netapp.h>
    7764#include <netapp/netapp_var.h>
    78 #include <netapp/discard.h>
     65#include <netapp/udp_discard_cli.h>
    7966
    8067#ifdef USE_UDP_DISCARD_CLI
     
    9077#define PAT_BEGIN       ' '
    9178#define PAT_END         '~'
     79
     80#if defined(SUPPORT_INET6)
     81#define API_PROTO               '6'
     82#else
     83#define API_PROTO               '4'
     84#endif
    9285
    9386/*
     
    10497send_udp_discard (ID cepid, T_IN_ADDR *ipaddr, uint16_t portno)
    10598{
    106         static char smsg[IF_MTU - IP_UDP_HDR_SIZE];
     99#if defined(SUPPORT_INET6)
     100        static char smsg[IPV6_MMTU - (IP6_HDR_SIZE + UDP_HDR_SIZE)];
     101#else
     102        static char smsg[IP4_MSS - (IP4_HDR_SIZE + UDP_HDR_SIZE)];
     103#endif
    107104
    108105        T_IPEP          dst;
     
    117114
    118115        p = smsg;
    119         for (slen = IF_MTU - IP_UDP_HDR_SIZE; slen > 0; )
     116        for (slen = sizeof(smsg); slen > 0; )
    120117                for (pat = PAT_BEGIN; slen > 0 && pat <= PAT_END; pat ++, slen --)
    121118                        *p ++ = pat;
    122119
    123120        get_tim(&time);
    124         syslog(LOG_NOTICE, "[UDC:%02d SND] sending:    %6ld, to:   %s.%d",
    125                            cepid, time / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno);
     121        syslog(LOG_NOTICE, "[UDC%c:%02u SND] send:  %7lu, to:   %s.%d",
     122                           API_PROTO, cepid, time / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno);
    126123
    127124        scount = total = 0;
    128125        udp_discard_cli_valid = true;
    129         for (slen = IF_MTU - IP_UDP_HDR_SIZE; udp_discard_cli_valid && slen > 0; slen --) {
     126        for (slen = sizeof(smsg); udp_discard_cli_valid && slen > 0; slen --) {
    130127                scount ++;
    131128                if ((len = UDP_SND_DAT(cepid, &dst, smsg, slen, TMO_FEVR)) < 0) {
    132                         syslog(LOG_NOTICE, "[UDC:%02d SND] send error: %s", cepid, itron_strerror(len));
     129                        syslog(LOG_NOTICE, "[UDC%c:%02u SND] error: %s", API_PROTO, cepid, itron_strerror(len));
    133130                        return len;
    134131                        }
    135132                else
    136                         syslog(LOG_NOTICE, "[UDC:%02d SND] send: %4d, %4d", cepid, scount, slen);
     133                        syslog(LOG_NOTICE, "[UDC%c:%02u SND] send:  %7lu, %4u", API_PROTO, cepid, scount, slen);
    137134                total += len;
    138                 dly_tsk(10 * SYSTIM_HZ + net_rand() % (10 * SYSTIM_HZ));
     135                dly_tsk(10 * SYSTIM_HZ + netapp_rand() % (10 * SYSTIM_HZ));
    139136                }
    140137
    141138        get_tim(&time);
    142         syslog(LOG_NOTICE, "[UDC:%02d SND] finished:   %6ld, snd: %4d,            len: %ld",
    143                            cepid, time / SYSTIM_HZ, scount, total);
     139        syslog(LOG_NOTICE, "[UDC%c:%02u SND] finsh: %7lu, snd: %4u,            len: %ld",
     140                           API_PROTO, cepid, time / SYSTIM_HZ, scount, total);
    144141        return E_OK;
    145142        }
     
    158155        int_t           no;
    159156        uint16_t        portno;
     157        char            apip;
    160158
    161159#ifdef USE_UDP_EXTENTIONS
    162160
     161#if defined(SUPPORT_INET6)
     162        T_UDP6_CCEP     ccep;
     163#else
    163164        T_UDP_CCEP      ccep;
     165#endif
    164166
    165167#endif  /* of #ifdef USE_UDP_EXTENTIONS */
     168
     169#if defined(SUPPORT_INET6)
     170        apip = API_PROTO_IPV6;
     171#else
     172        apip = API_PROTO_IPV4;
     173#endif
    166174
    167175        get_tid(&tskid);
     
    171179                        line = skip_blanks(GET_IPADDR(&addr, skip_blanks(line)));       /* IP Address */
    172180
     181                        if ((line = lookup_ipaddr(&addr, line, apip)) == NULL) {
     182                                syslog(LOG_NOTICE, "[UDC%c:%02u TSK] unknown host.", (ID)exinf);
     183                                continue;
     184                                }
     185
    173186                        if ('0' <= *line && *line <= '9') {                             /* Port No */
    174187                                line = get_int(&no, line);
     
    186199                        ccep.myaddr.portno = UDP_PORTANY;
    187200
     201#if defined(SUPPORT_INET6)
     202
     203                        memcpy(&ccep.myaddr.ipaddr, &ipv6_addrany, sizeof(T_IN6_ADDR));
     204
     205#else   /* #if defined(SUPPORT_INET6) */
     206
    188207#if defined(SUPPORT_INET4)
    189208                        ccep.myaddr.ipaddr = IPV4_ADDRANY;
    190209#endif
    191210
    192 #if defined(SUPPORT_INET6)
    193                         memcpy(&ccep.myaddr.ipaddr, &ipv6_addrany, sizeof(T_IN6_ADDR));
    194 #endif
    195 
    196                         if ((error = alloc_udp_cep(&cepid, tskid, &ccep)) != E_OK) {
    197                                 syslog(LOG_NOTICE, "[UDC:%02d TSK] CEP create error: %s", cepid, itron_strerror(error));
     211#endif  /* #if defined(SUPPORT_INET6) */
     212
     213                        if ((error = ALLOC_UDP_CEP(&cepid, tskid, &ccep)) != E_OK) {
     214                                syslog(LOG_NOTICE, "[UDC%c:%02u TSK] CEP create error: %s", API_PROTO, cepid, itron_strerror(error));
    198215                                continue;
    199216                                }
     
    206223
    207224                        if ((error = send_udp_discard(cepid, &addr, portno)) != E_OK)
    208                                 syslog(LOG_NOTICE, "[UDC:%02d TSK] error: %s", cepid, itron_strerror(error));
     225                                syslog(LOG_NOTICE, "[UDC%c:%02u TSK] error: %s", API_PROTO, cepid, itron_strerror(error));
    209226
    210227#ifdef USE_UDP_EXTENTIONS
    211228
    212                         if ((error = free_udp_cep(cepid, !(error == E_NOEXS || error == E_DLT))) != E_OK)
    213                                 syslog(LOG_NOTICE, "[UDC:%02d TSK] CEP delete error: %s", cepid, itron_strerror(error));
     229                        if ((error = FREE_UDP_CEP(cepid, !(error == E_NOEXS || error == E_DLT))) != E_OK)
     230                                syslog(LOG_NOTICE, "[UDC%c:%02u TSK] CEP delete error: %s", API_PROTO, cepid, itron_strerror(error));
    214231
    215232#endif  /* of #ifdef USE_UDP_EXTENTIONS */
Note: See TracChangeset for help on using the changeset viewer.