[388] | 1 | /*
|
---|
| 2 | * TINET (TCP/IP Protocol Stack)
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2001-2012 by Dep. of Computer Science and Engineering
|
---|
| 5 | * Tomakomai National College of Technology, JAPAN
|
---|
| 6 | *
|
---|
| 7 | * ä¸è¨èä½æ¨©è
|
---|
| 8 | ã¯ï¼ä»¥ä¸ã® (1)ï½(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 9 | * ã«ãã£ã¦å
|
---|
| 10 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 11 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 12 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 13 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 14 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 15 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 16 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 17 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 18 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 19 | * ç¨ã§ããå½¢ã§åé
|
---|
| 20 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 21 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 22 | * è
|
---|
| 23 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 24 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 25 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 26 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 27 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
| 28 | * (a) åé
|
---|
| 29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 31 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 32 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 33 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 34 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 35 | 責ãããã¨ï¼
|
---|
| 36 | *
|
---|
| 37 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 38 | ã
|
---|
| 39 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 40 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 41 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 42 | *
|
---|
| 43 | * @(#) $Id: ip_igmp.c 388 2019-05-22 11:25:18Z coas-nagasima $
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | #include <string.h>
|
---|
| 47 |
|
---|
| 48 | #ifdef TARGET_KERNEL_ASP
|
---|
| 49 |
|
---|
| 50 | #include <kernel.h>
|
---|
| 51 | #include <sil.h>
|
---|
| 52 | #include <t_syslog.h>
|
---|
| 53 | #include "kernel_cfg.h"
|
---|
| 54 | #include "tinet_cfg.h"
|
---|
| 55 |
|
---|
| 56 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
| 57 |
|
---|
| 58 | #ifdef TARGET_KERNEL_JSP
|
---|
| 59 |
|
---|
| 60 | #include <s_services.h>
|
---|
| 61 | #include <t_services.h>
|
---|
| 62 | #include "tinet_id.h"
|
---|
| 63 |
|
---|
| 64 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
| 65 |
|
---|
| 66 | #include <tinet_defs.h>
|
---|
| 67 | #include <tinet_config.h>
|
---|
| 68 |
|
---|
| 69 | #include <net/if.h>
|
---|
| 70 | #include <net/if_loop.h>
|
---|
| 71 | #include <net/if_ppp.h>
|
---|
| 72 | #include <net/ethernet.h>
|
---|
| 73 | #include <net/ppp_ipcp.h>
|
---|
| 74 | #include <net/net.h>
|
---|
| 75 | #include <net/net_endian.h>
|
---|
| 76 | #include <net/net_buf.h>
|
---|
| 77 | #include <net/net_timer.h>
|
---|
| 78 | #include <net/net_count.h>
|
---|
| 79 |
|
---|
| 80 | #include <netinet/in.h>
|
---|
| 81 | #include <netinet/in_var.h>
|
---|
| 82 | #include <netinet/ip.h>
|
---|
| 83 | #include <netinet/ip_var.h>
|
---|
| 84 | #include <netinet/tcp.h>
|
---|
| 85 | #include <netinet/tcp_var.h>
|
---|
| 86 | #include <netinet/udp_var.h>
|
---|
| 87 | #include <netinet/ip_igmp.h>
|
---|
| 88 |
|
---|
| 89 | #include <net/if_var.h>
|
---|
| 90 | #include <net/net_var.h>
|
---|
| 91 |
|
---|
| 92 | #ifdef SUPPORT_IGMP
|
---|
| 93 |
|
---|
| 94 | static T_IGMP_ENTRY igmp_groups[NUM_IGMP_ENTRY];
|
---|
| 95 | static T_IN4_ADDR igmp_send_addrs[NUM_IGMP_ENTRY];
|
---|
| 96 |
|
---|
| 97 | static bool_t igmp_send_report_v2(T_IN4_ADDR dst);
|
---|
| 98 | static int16_t igmp_get_timer(T_IGMP_ENTRY *entry);
|
---|
| 99 |
|
---|
| 100 | ER igmp_set_loop(T_UDP_CEP *cep, uint8_t optval)
|
---|
| 101 | {
|
---|
| 102 | switch (optval) {
|
---|
| 103 | case 0:
|
---|
| 104 | cep->igmp_loopback = false;
|
---|
| 105 | return E_OK;
|
---|
| 106 | case 1:
|
---|
| 107 | cep->igmp_loopback = true;
|
---|
| 108 | return E_OK;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | return E_PAR;
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | ER igmp_get_loop(T_UDP_CEP *cep, uint8_t *optval)
|
---|
| 115 | {
|
---|
| 116 | if (optval == NULL)
|
---|
| 117 | return E_PAR;
|
---|
| 118 |
|
---|
| 119 | *optval = cep->igmp_loopback ? 1 : 0;
|
---|
| 120 |
|
---|
| 121 | return E_OK;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | ER igmp_set_ttl(T_UDP_CEP *cep, uint8_t optval)
|
---|
| 125 | {
|
---|
| 126 | cep->igmp_ttl = optval;
|
---|
| 127 |
|
---|
| 128 | return E_OK;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | ER igmp_get_ttl(T_UDP_CEP *cep, uint8_t *optval)
|
---|
| 132 | {
|
---|
| 133 | if (optval == NULL)
|
---|
| 134 | return E_PAR;
|
---|
| 135 |
|
---|
| 136 | *optval = cep->igmp_ttl;
|
---|
| 137 |
|
---|
| 138 | return E_OK;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | ER igmp_set_if(T_UDP_CEP *cep, T_IN4_ADDR *optval)
|
---|
| 142 | {
|
---|
| 143 | if (optval == NULL)
|
---|
| 144 | return E_PAR;
|
---|
| 145 |
|
---|
| 146 | cep->igmp_mcaddr = *optval;
|
---|
| 147 |
|
---|
| 148 | return E_OK;
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | ER igmp_get_if(T_UDP_CEP *cep, T_IN4_ADDR *optval)
|
---|
| 152 | {
|
---|
| 153 | if (optval == NULL)
|
---|
| 154 | return E_PAR;
|
---|
| 155 |
|
---|
| 156 | *optval = cep->igmp_mcaddr;
|
---|
| 157 |
|
---|
| 158 | return E_OK;
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | ER igmp_add_membership(T_UDP_CEP *cep, T_IP_MREQ *optval)
|
---|
| 162 | {
|
---|
| 163 | T_IGMP_ENTRY *entry = NULL;
|
---|
| 164 | int i;
|
---|
| 165 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
| 166 | ER ret = E_NOMEM;
|
---|
| 167 |
|
---|
| 168 | if ((optval->imr_interface != IPV4_ADDRANY)
|
---|
| 169 | && (optval->imr_interface != ifp->in4_ifaddr.addr))
|
---|
| 170 | return E_PAR;
|
---|
| 171 |
|
---|
| 172 | syscall(wai_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 173 |
|
---|
| 174 | for (i = 0; i < NUM_IGMP_ENTRY; i++) {
|
---|
| 175 | entry = &igmp_groups[i];
|
---|
| 176 | if (entry->timer == -1) {
|
---|
| 177 | entry->timer = 0;
|
---|
| 178 | entry->ip_addr = optval->imr_multiaddr;
|
---|
| 179 | ret = E_OK;
|
---|
| 180 | break;
|
---|
| 181 | }
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | syscall(sig_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 185 |
|
---|
| 186 | return ret;
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | ER igmp_drop_membership(T_UDP_CEP *cep, T_IP_MREQ *optval)
|
---|
| 190 | {
|
---|
| 191 | T_IGMP_ENTRY *entry = NULL;
|
---|
| 192 | int i;
|
---|
| 193 | ER ret = E_PAR;
|
---|
| 194 | T_IFNET *ifp = IF_GET_IFNET();
|
---|
| 195 |
|
---|
| 196 | if ((optval->imr_interface != IPV4_ADDRANY)
|
---|
| 197 | && (optval->imr_interface != ifp->in4_ifaddr.addr))
|
---|
| 198 | return E_PAR;
|
---|
| 199 |
|
---|
| 200 | syscall(wai_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 201 |
|
---|
| 202 | for (i = 0; i < NUM_IGMP_ENTRY; i++) {
|
---|
| 203 | entry = &igmp_groups[i];
|
---|
| 204 | if ((entry->timer >= 0) && (entry->ip_addr == optval->imr_multiaddr)) {
|
---|
| 205 | entry->timer = -1;
|
---|
| 206 | entry->ip_addr = 0;
|
---|
| 207 | ret = E_OK;
|
---|
| 208 | break;
|
---|
| 209 | }
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | syscall(sig_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 213 |
|
---|
| 214 | return ret;
|
---|
| 215 | }
|
---|
| 216 |
|
---|
| 217 | ER igmp_set_ip_msfilter(T_UDP_CEP *cep, const T_IP_MSFILTER *optval)
|
---|
| 218 | {
|
---|
| 219 | return E_PAR;
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | ER igmp_get_ip_msfilter(T_UDP_CEP *cep, T_IP_MSFILTER *optval)
|
---|
| 223 | {
|
---|
| 224 | return E_PAR;
|
---|
| 225 | }
|
---|
| 226 |
|
---|
| 227 | uint_t igmp_input(T_NET_BUF **inputp, uint_t *offp, uint_t *nextp)
|
---|
| 228 | {
|
---|
| 229 | T_NET_BUF *input = *inputp;
|
---|
| 230 | T_IGMPV2_HDR *igmph;
|
---|
| 231 | uint_t len, align;
|
---|
| 232 | T_IP4_HDR *ip4h;
|
---|
| 233 | int i;
|
---|
| 234 | T_IGMP_ENTRY *entry;
|
---|
| 235 | bool_t ret;
|
---|
| 236 |
|
---|
| 237 | NET_COUNT_IGMP(net_count_igmp.in_octets,
|
---|
| 238 | input->len - GET_IF_IP4_HDR_SIZE(input));
|
---|
| 239 | NET_COUNT_IGMP(net_count_igmp.in_packets, 1);
|
---|
| 240 |
|
---|
| 241 | /* ICMP ãããã®é·ãããã§ãã¯ããã*/
|
---|
| 242 | if (input->len < IF_IP4_IGMP_HDR_SIZE) {
|
---|
| 243 | NET_COUNT_IGMP(net_count_igmp.in_err_packets, 1);
|
---|
| 244 | NET_COUNT_MIB(igmp_stats.igmpInErrors, 1);
|
---|
| 245 | goto buf_rel;
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | igmph = (T_IGMPV2_HDR *)(input->buf + *offp);
|
---|
| 249 |
|
---|
| 250 | /* 4 ãªã¯ãããå¢çã®ãã¼ã¿é· */
|
---|
| 251 | len = input->len - *offp;
|
---|
| 252 | align = (len + 3) >> 2 << 2;
|
---|
| 253 |
|
---|
| 254 | /* 4 ãªã¯ãããå¢çã¾ã§ããã£ã³ã°ã§åããã*/
|
---|
| 255 | if (align > len)
|
---|
| 256 | memset((uint8_t*)input->buf + input->len, 0, (size_t)(align - len));
|
---|
| 257 |
|
---|
| 258 | /* ãã§ãã¯ãµã ãè¨ç®ããã*/
|
---|
| 259 | if (in_cksum(igmph, align) != 0) {
|
---|
| 260 | NET_COUNT_IGMP(net_count_igmp.in_err_packets, 1);
|
---|
| 261 | goto buf_rel;
|
---|
| 262 | }
|
---|
| 263 |
|
---|
| 264 | /* ã¡ãã»ã¼ã¸ã®åã«ããåå²ããã*/
|
---|
| 265 | switch (igmph->type) {
|
---|
| 266 | case IGMP_MEMBERSHIP_QUERY:
|
---|
| 267 | ip4h = GET_IP4_HDR(input);
|
---|
| 268 | ret = false;
|
---|
| 269 |
|
---|
| 270 | /* åå ä¸ã®ã°ã«ã¼ãã¢ãã¬ã¹ããã®ã¯ã¨ãªã¼ã®å ´å */
|
---|
| 271 | syscall(wai_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 272 |
|
---|
| 273 | for (i = 0; i < NUM_IGMP_ENTRY; i++) {
|
---|
| 274 | entry = &igmp_groups[i];
|
---|
| 275 | if ((entry->timer >= 0) && (entry->ip_addr == igmph->addr)) {
|
---|
| 276 | entry->resptime = igmph->time;
|
---|
| 277 | ret = true;
|
---|
| 278 | break;
|
---|
| 279 | }
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | syscall(sig_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 283 |
|
---|
| 284 | if (ret) {
|
---|
| 285 | /* ã¡ã³ãã¼ã·ãããªãã¼ããéä¿¡ */
|
---|
| 286 | igmp_send_report_v2(ip4h->src);
|
---|
| 287 | }
|
---|
| 288 | break;
|
---|
| 289 | }
|
---|
| 290 |
|
---|
| 291 | buf_rel:
|
---|
| 292 | syscall(rel_net_buf(input));
|
---|
| 293 | return IPPROTO_DONE;
|
---|
| 294 | }
|
---|
| 295 |
|
---|
| 296 | static bool_t igmp_send_report_v2(T_IN4_ADDR dst)
|
---|
| 297 | {
|
---|
| 298 | T_IGMPV2_HDR *igmph;
|
---|
| 299 | T_NET_BUF *output;
|
---|
| 300 | uint_t len = 0, align;
|
---|
| 301 |
|
---|
| 302 | if (in4_get_datagram(&output, (uint_t)(IF_IP4_IGMP_HDR_SIZE + len), 0,
|
---|
| 303 | &dst, NULL, IPPROTO_IGMP, IP4_DEFTTL,
|
---|
| 304 | NBA_SEARCH_ASCENT, TMO_IGMP_OUTPUT) != E_OK)
|
---|
| 305 | return false;
|
---|
| 306 |
|
---|
| 307 | /* IGMP ããããè¨å®ããã*/
|
---|
| 308 | igmph = GET_IGMPV2_HDR(output, IF_IP4_IGMP_HDR_OFFSET);
|
---|
| 309 | igmph->type = IGMP_MEMBERSHIP_REPORT_V2;
|
---|
| 310 | igmph->time = 0;
|
---|
| 311 | igmph->addr = htonl(dst);
|
---|
| 312 |
|
---|
| 313 | /* 4 ãªã¯ãããå¢çã®ãã¼ã¿é· */
|
---|
| 314 | align = (len + 3) >> 2 << 2;
|
---|
| 315 |
|
---|
| 316 | /* 4 ãªã¯ãããå¢çã¾ã§ããã£ã³ã°ã§åããã*/
|
---|
| 317 | if (align > len)
|
---|
| 318 | memset((uint8_t*)GET_IGMP_SDU(output, IF_IP4_IGMP_HDR_OFFSET) + len,
|
---|
| 319 | 0, (size_t)(align - len));
|
---|
| 320 |
|
---|
| 321 | /* ãã§ãã¯ãµã ãè¨ç®ããã*/
|
---|
| 322 | igmph->sum = 0;
|
---|
| 323 | igmph->sum = in_cksum(igmph, (uint_t)(IGMP_HDR_SIZE + align));
|
---|
| 324 |
|
---|
| 325 | /* éä¿¡ããã*/
|
---|
| 326 | NET_COUNT_IGMP(net_count_igmp.out_octets,
|
---|
| 327 | output->len - GET_IF_IP4_HDR_SIZE(output));
|
---|
| 328 | NET_COUNT_IGMP(net_count_igmp.out_packets, 1);
|
---|
| 329 | NET_COUNT_MIB(icmp_stats.icmpOutMsgs, 1);
|
---|
| 330 | NET_COUNT_MIB(icmp_stats.icmpOutDestUnreachs, 1);
|
---|
| 331 | ip_output(output, TMO_IGMP_OUTPUT);
|
---|
| 332 |
|
---|
| 333 | return true;
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | /*
|
---|
| 337 | * igmp_timer -- IGMP å
|
---|
| 338 | ±éã¿ã¤ãã¼
|
---|
| 339 | */
|
---|
| 340 | static void igmp_timer(void *ignore)
|
---|
| 341 | {
|
---|
| 342 | T_IGMP_ENTRY *entry = NULL;
|
---|
| 343 | int i, j = 0;
|
---|
| 344 |
|
---|
| 345 | /* memset(igmp_send_addrs, 0, sizeof(igmp_send_addrs)); */
|
---|
| 346 |
|
---|
| 347 | syscall(wai_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 348 |
|
---|
| 349 | for (i = 0; i < NUM_IGMP_ENTRY; i++) {
|
---|
| 350 | entry = &igmp_groups[i];
|
---|
| 351 | if (entry->timer > 0)
|
---|
| 352 | entry->timer--;
|
---|
| 353 | if (entry->timer == 0) {
|
---|
| 354 | entry->timer = igmp_get_timer(entry);
|
---|
| 355 | igmp_send_addrs[j++] = entry->ip_addr;
|
---|
| 356 | }
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | syscall(sig_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 360 |
|
---|
| 361 | for (i = 0; i < j; i++) {
|
---|
| 362 | igmp_send_report_v2(igmp_send_addrs[i]);
|
---|
| 363 | }
|
---|
| 364 |
|
---|
| 365 | timeout(igmp_timer, NULL, NET_TIMER_HZ / 1);
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | /*
|
---|
| 369 | * igmp_init -- IGMP æ©è½ãåæåããã
|
---|
| 370 | */
|
---|
| 371 |
|
---|
| 372 | void igmp_init(void)
|
---|
| 373 | {
|
---|
| 374 | int i;
|
---|
| 375 |
|
---|
| 376 | for (i = 0; i < NUM_IGMP_ENTRY; i++) {
|
---|
| 377 | igmp_groups[i].timer = -1;
|
---|
| 378 | }
|
---|
| 379 |
|
---|
| 380 | timeout(igmp_timer, NULL, NET_TIMER_HZ / 1);
|
---|
| 381 | }
|
---|
| 382 |
|
---|
| 383 | bool_t igmp_is_joined_group(T_IN4_ADDR addr)
|
---|
| 384 | {
|
---|
| 385 | T_IGMP_ENTRY *entry = NULL;
|
---|
| 386 | int i;
|
---|
| 387 | bool_t ret = false;
|
---|
| 388 |
|
---|
| 389 | syscall(wai_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 390 |
|
---|
| 391 | for (i = 0; i < NUM_IGMP_ENTRY; i++) {
|
---|
| 392 | entry = &igmp_groups[i];
|
---|
| 393 | if ((entry->timer >= 0) && (entry->ip_addr == addr)) {
|
---|
| 394 | ret = true;
|
---|
| 395 | break;
|
---|
| 396 | }
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | syscall(sig_sem(SEM_IGMP_GROUP_LOCK));
|
---|
| 400 |
|
---|
| 401 | return ret;
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | int16_t igmp_get_timer(T_IGMP_ENTRY *entry)
|
---|
| 405 | {
|
---|
| 406 | int16_t time = entry->resptime;
|
---|
| 407 |
|
---|
| 408 | if (time == 0)
|
---|
| 409 | time = 590;
|
---|
| 410 |
|
---|
| 411 | return (int16_t)(net_rand() % time) + 10;
|
---|
| 412 | }
|
---|
| 413 |
|
---|
| 414 | #endif /* of #ifdef SUPPORT_IGMP */
|
---|