source: EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/ip_input.c@ 321

Last change on this file since 321 was 321, checked in by coas-nagasima, 7 years ago

文字コードを設定

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 16.9 KB
Line 
1/*
2 * TINET (TCP/IP Protocol Stack)
3 *
4 * Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
5 * Tomakomai National College of Technology, JAPAN
6 *
7 * 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
8 * によって公表されている GNU General Public License の Version 2 に記
9 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
10 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
11 * 利用と呼ぶ)することを無償で許諾する.
12 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
13 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
14 * スコード中に含まれていること.
15 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
16 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
17 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
18 * の無保証規定を掲載すること.
19 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
20 * 用できない形で再配布する場合には,次の条件を満たすこと.
21 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
22 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
23 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
24 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
25 *
26 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
27 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
28 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
29 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
30 *
31 * @(#) $Id$
32 */
33
34/*
35 * Copyright (c) 1982, 1986, 1988, 1993
36 * The Regents of the University of California. All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)input.c 8.2 (Berkeley) 1/4/94
67 * $FreeBSD: src/sys/netinet/input.c,v 1.111.2.4 1999/11/01 22:23:53 des Exp $
68 * $ANA: input.c,v 1.5 1996/09/18 14:34:59 wollman Exp $
69 */
70
71#include <string.h>
72
73#ifdef TARGET_KERNEL_ASP
74
75#include <kernel.h>
76#include <sil.h>
77#include <t_syslog.h>
78#include "kernel_cfg.h"
79
80#endif /* of #ifdef TARGET_KERNEL_ASP */
81
82#ifdef TARGET_KERNEL_JSP
83
84#include <s_services.h>
85#include <t_services.h>
86#include "kernel_id.h"
87
88#endif /* of #ifdef TARGET_KERNEL_JSP */
89
90#include <tinet_defs.h>
91#include <tinet_config.h>
92
93#include <net/if.h>
94#include <net/if_ppp.h>
95#include <net/if_loop.h>
96#include <net/ethernet.h>
97#include <net/ppp_ipcp.h>
98#include <net/net.h>
99#include <net/net_buf.h>
100#include <net/net_count.h>
101#include <net/net_timer.h>
102
103#include <netinet/in.h>
104#include <netinet/in_var.h>
105#include <netinet/ip.h>
106#include <netinet/ip_var.h>
107#include <netinet/ip_icmp.h>
108#include <netinet/tcp.h>
109#include <netinet/tcp_timer.h>
110#include <netinet/tcp_var.h>
111#include <netinet/udp.h>
112#include <netinet/udp_var.h>
113
114#if defined(SUPPORT_IPSEC)
115//#include <stdio.h>
116#include <sys/types.h>
117#include <netinet6/ipsec.h>
118#include <netinet6/esp.h>
119#include <netkey/key.h>
120#include <netkey/key_debug.h>
121#endif /* of defined(SUPPORT_IPSEC) */
122
123#include <net/if_var.h>
124
125/*
126 * 変数
127 */
128
129#ifdef SUPPORT_MIB
130
131/*
132 * SNMP の 管理情報ベース (MIB)
133 */
134
135T_IP_STATS ip_stats;
136
137#endif /* of #ifdef SUPPORT_MIB */
138
139#ifdef IP4_CFG_FRAGMENT
140
141/*
142 * データグラム再構成キュー
143 */
144
145static T_NET_BUF *ip_frag_queue[NUM_IP4_FRAG_QUEUE];
146static T_IN4_ADDR frag_dst [NUM_IP4_FRAG_QUEUE];
147
148/*
149 * 関数
150 */
151
152static void ip_freef (int_t ix);
153static T_NET_BUF *ip_reass (T_IP4_HDR *ip4h, T_NET_BUF *input);
154
155/*
156 * ip_get_frag_queue -- データグラム再構成キューを獲得する。
157 */
158
159const T_NET_BUF **
160ip_get_frag_queue (void)
161{
162 return (const T_NET_BUF **)ip_frag_queue;
163 }
164
165/*
166 * ip_freef -- データグラム再構成キューを解放する。
167 */
168
169static void
170ip_freef (int_t ix)
171{
172 T_NET_BUF *frag, *next;
173
174 frag = ip_frag_queue[ix];
175 while (frag != NULL) {
176 next = GET_QIP4_HDR(frag)->next;
177 syscall(rel_net_buf(frag));
178 frag = next;
179 }
180 ip_frag_queue[ix] = NULL;
181 }
182
183/*
184 * ip_frag_timer -- データグラム再構成管理タイマ
185 */
186
187void
188ip_frag_timer (void)
189{
190 T_NET_BUF *frag;
191 int_t ix;
192
193 syscall(wai_sem(SEM_IP4_FRAG_QUEUE));
194 for (ix = NUM_IP4_FRAG_QUEUE; ix -- > 0; ) {
195 frag = ip_frag_queue[ix];
196 if (frag != NULL && GET_QIP4_HDR(frag)->ttl > 0 &&
197 -- GET_QIP4_HDR(frag)->ttl == 0) {
198 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_TMOUT], 1);
199 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_DROP], 1);
200 ip_freef(ix);
201 }
202 }
203 syscall(sig_sem(SEM_IP4_FRAG_QUEUE));
204 }
205
206/*
207 * ip_reass -- データグラムを再構成する。
208 */
209
210static T_NET_BUF *
211ip_reass (T_IP4_HDR *ip4h, T_NET_BUF *input)
212{
213 T_NET_BUF *frag, *prev;
214 T_IN4_ADDR dst, src;
215 int_t ix;
216 uint_t id, off, len;
217
218 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_FRAGS], 1);
219 NET_COUNT_MIB(ip_stats.ipReasmReqds, 1);
220
221 src = ntohl(ip4h->src);
222 dst = ntohl(ip4h->dst);
223 NTOHS(ip4h->id);
224 NTOHS(ip4h->flg_off);
225 id = ip4h->id;
226 ix = id % NUM_IP4_FRAG_QUEUE;
227
228 syscall(wai_sem(SEM_IP4_FRAG_QUEUE));
229
230 /*
231 * ID、IPアドレス、上位プロトコルが異なるフラグメントがキューに有れば破棄する。
232 */
233 frag = ip_frag_queue[ix];
234 if (frag != NULL &&
235 (id != GET_IP4_HDR(frag)->id ||
236 dst != frag_dst[ix] ||
237 src != ntohl(GET_IP4_HDR(frag)->src) ||
238 ip4h->proto != GET_IP4_HDR(frag)->proto)) {
239 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_DROP], 1);
240 NET_COUNT_MIB(ip_stats.ipReasmFails, 1);
241 ip_freef(ix);
242 }
243
244 frag = ip_frag_queue[ix];
245 if (frag == NULL) {
246 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN], 1);
247
248 /* 新規の ID なら、宛先アドレスを保存して、キューにつなぐ。*/
249 frag_dst [ix] = dst;
250 ip_frag_queue[ix] = input;
251 ((T_QIP4_HDR *)ip4h)->next = NULL;
252 input = NULL;
253
254 /* 再構成タイムアウトを設定する。*/
255 ip4h->ttl = IP4_FRAGTTL;
256 }
257 else {
258
259 /* 正しい位置に挿入する。*/
260 prev = NULL;
261 while (frag != NULL &&
262 IP4_FLGOFF_OFF(ip4h->flg_off) >
263 IP4_FLGOFF_OFF(GET_QIP4_HDR(frag)->flg_off)) {
264 prev = frag;
265 frag = GET_QIP4_HDR(frag)->next;
266 }
267 ((T_QIP4_HDR *)ip4h)->next = frag;
268 if (prev == NULL) {
269 ip4h->ttl = GET_QIP4_HDR(frag)->ttl;
270 ip_frag_queue[ix] = input;
271 }
272 else
273 GET_QIP4_HDR(prev)->next = input;
274 input = NULL;
275
276 /* 全てのフラグメントが揃っているか調べる。*/
277 off = 0;
278 for (frag = ip_frag_queue[ix]; frag != NULL; frag = GET_QIP4_HDR(frag)->next) {
279 if ((IP4_FLGOFF_OFF(GET_QIP4_HDR(frag)->flg_off) << 3) != off) {
280 /* 途中が抜けていたら終了する。*/
281 syscall(sig_sem(SEM_IP4_FRAG_QUEUE));
282 return NULL;
283 }
284 off += ntohs(GET_QIP4_HDR(frag)->len) - (IP4_VHL_HL(GET_QIP4_HDR(frag)->vhl) << 2);
285 prev = frag;
286 }
287
288 /* 全てのフラグメントが揃ったら再構成する。*/
289 if ((GET_QIP4_HDR(prev)->flg_off & IP4_MF) == 0) {
290
291 /* ネットワークバッファを獲得する。*/
292 if (tget_net_buf(&input, IF_IP4_HDR_SIZE + off, TMO_IP4_FRAG_GET_NET_BUF) == E_OK) {
293 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_OK], 1);
294 NET_COUNT_MIB(ip_stats.ipReasmOKs, 1);
295
296 /* IPv4 ヘッダを設定する。*/
297 frag = ip_frag_queue[ix];
298 ip4h = GET_IP4_HDR(input);
299 *ip4h = *GET_IP4_HDR(frag);
300 ip4h->dst = htonl(frag_dst[ix]);
301 ip4h->len = htons(IP4_HDR_SIZE + off);
302 ip4h->vhl = IP4_MAKE_VHL(IPV4_VERSION, IP4_HDR_SIZE >> 2);
303 ip4h->ttl = GET_QIP4_HDR(prev)->ttl;
304 ip4h->flg_off = ip4h->id = 0;
305
306 /* データグラムを再構成する。*/
307 off = IP4_HDR_SIZE;
308 while (frag != NULL) {
309 len = ntohs(GET_QIP4_HDR(frag)->len) - (IP4_VHL_HL(GET_QIP4_HDR(frag)->vhl) << 2);
310 memcpy((uint8_t *)ip4h + off, GET_QIP4_SDU(frag), len);
311 off += len;
312 frag = GET_QIP4_HDR(frag)->next;
313 }
314 }
315 else {
316 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_NO_BUF], 1);
317 NET_COUNT_IP4(net_count_ip4[NC_IP4_FRAG_IN_DROP], 1);
318 NET_COUNT_MIB(ip_stats.ipReasmFails, 1);
319 }
320 /* キューを空にする。*/
321 ip_freef(ix);
322 }
323 }
324 syscall(sig_sem(SEM_IP4_FRAG_QUEUE));
325 return input;
326 }
327
328#endif /* of #ifdef IP4_CFG_FRAGMENT */
329
330/*
331 * ip_init -- IP の初期化
332 */
333
334void
335ip_init (void)
336{
337 in4_init();
338 }
339
340/*
341 * ip_remove_options -- IPv4 ヘッダのオプションを削除し、以降を前に詰める。
342 */
343
344ER
345ip_remove_options (T_NET_BUF *nbuf)
346{
347 T_IP_HDR *iph;
348
349 iph = GET_IP_HDR(nbuf);
350
351 if (GET_IP_HDR_SIZE(iph) > IP4_HDR_SIZE) {
352 memmove((char *)iph + IP4_HDR_SIZE, GET_IP_SDU(nbuf),
353 (size_t)(iph->len - GET_IP_HDR_SIZE(iph)));
354 iph->vhl = IP4_MAKE_VHL(IPV4_VERSION, IP4_HDR_SIZE >> 2);
355 iph->len -= (uint16_t)(GET_IP_HDR_SIZE(iph) - IP4_HDR_SIZE);
356 nbuf->len -= (uint16_t)(GET_IP_HDR_SIZE(iph) - IP4_HDR_SIZE);
357 }
358
359 return E_OK;
360 }
361
362/*
363 * ip_input -- IP の入力関数
364 */
365
366#if defined(SUPPORT_IPSEC)
367/*
368 * TODO: IPsec SPを検索し、パケットをリジェクトするかどうか判定する処理を実装する
369 */
370#endif /* of defined(SUPPORT_IPSEC) */
371
372void
373ip_input (T_NET_BUF *input)
374{
375 T_IP4_HDR *ip4h;
376 T_IFNET *ifp = IF_GET_IFNET();
377 T_IN4_ADDR dst, src, bc;
378 uint_t hlen, off;
379
380 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_OCTETS], input->len - IF_HDR_SIZE);
381 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_PACKETS], 1);
382 NET_COUNT_MIB(ip_stats.ipInReceives, 1);
383
384 /* IP ヘッダの長さをチェックする。*/
385 if (input->len < IF_IP4_HDR_SIZE) {
386 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_SHORT], 1);
387 NET_COUNT_MIB(ip_stats.ipInHdrErrors, 1);
388 goto buf_rel;
389 }
390
391 ip4h = GET_IP4_HDR(input);
392 hlen = GET_IP4_HDR_SIZE(ip4h);
393
394 /* バージョンをチェックする。*/
395 if (IP4_VHL_V(ip4h->vhl) != IPV4_VERSION) {
396 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_VER], 1);
397 NET_COUNT_MIB(ip_stats.ipInHdrErrors, 1);
398 goto buf_rel;
399 }
400
401 /* IP ヘッダの長さをチェックし、オプションを解析する。*/
402 if (hlen > IP4_HDR_SIZE) {
403 NET_COUNT_IP4(net_count_ip4[NC_IP4_OPTS], 1);
404 /* %%% オプションの解析 %%% */
405 }
406
407 /* データグラム長をチェックする。*/
408 if (ntohs(ip4h->len) > input->len - IF_HDR_SIZE) {
409 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_SHORT], 1);
410 NET_COUNT_MIB(ip_stats.ipInHdrErrors, 1);
411 goto buf_rel;
412 }
413
414 /* ネットワークバッファの長さをデータグラム長に調整する。*/
415 input->len = (uint16_t)(ntohs(ip4h->len) + IF_HDR_SIZE);
416
417 /* チェックサムをチェックする。*/
418 if (in_cksum(ip4h, hlen) != 0) {
419 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_CKSUM], 1);
420 NET_COUNT_MIB(ip_stats.ipInHdrErrors, 1);
421 goto buf_rel;
422 }
423
424 /* IP ヘッダの長さをチェックし、上位が ICMP 以外はオプションを消去する。*/
425 if (hlen > IP4_HDR_SIZE && ip4h->proto != IPPROTO_ICMP) {
426 memset((uint8_t*)ip4h + IP4_HDR_SIZE, 0, hlen - IP4_HDR_SIZE);
427 }
428
429 /* 送信元アドレスをチェックする。*/
430 src = ntohl(ip4h->src);
431 bc = (ifp->in_ifaddr.addr & ifp->in_ifaddr.mask) | ~ifp->in_ifaddr.mask;
432
433#ifdef SUPPORT_LOOP
434
435 if (src == bc || src == IPV4_ADDR_BROADCAST || src == IPV4_ADDRANY) {
436 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_ADDR], 1);
437 NET_COUNT_MIB(ip_stats.ipInAddrErrors, 1);
438 goto buf_rel;
439 }
440
441#else /* of #ifdef SUPPORT_LOOP */
442
443 if (src == ifp->in_ifaddr.addr || src == bc || src == IPV4_ADDR_BROADCAST || src == IPV4_ADDRANY) {
444 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_ADDR], 1);
445 NET_COUNT_MIB(ip_stats.ipInAddrErrors, 1);
446 goto buf_rel;
447 }
448
449#endif /* of #ifdef SUPPORT_LOOP */
450
451 /* あて先アドレスをチェックする。*/
452 dst = ntohl(ip4h->dst);
453
454#ifdef DHCP_CFG
455
456 /*
457 * DHCP_CFG が定義されているときは、ローカルアドレスが未定義の
458 * 場合もデータグラムを受信する。
459 */
460
461 if ((ifp->in_ifaddr.addr != IPV4_ADDRANY) &&
462 (!(dst == ifp->in_ifaddr.addr || dst == bc ||
463 dst == IPV4_ADDR_BROADCAST || dst == IPV4_ADDRANY))) {
464 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_ADDR], 1);
465 NET_COUNT_MIB(ip_stats.ipInAddrErrors, 1);
466 goto buf_rel;
467 }
468
469#else /* of #ifdef DHCP_CFG */
470
471#if defined(ETHER_CFG_MULTICAST)
472 if (!(dst == ifp->in_ifaddr.addr || dst == bc ||
473 dst == IPV4_ADDR_BROADCAST || dst == IPV4_ADDRANY ||
474 IN4_IS_ADDR_MULTICAST(dst))) {
475 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_ADDR], 1);
476 NET_COUNT_MIB(ip_stats.ipInAddrErrors, 1);
477 goto buf_rel;
478 }
479#else
480 if (!(dst == ifp->in_ifaddr.addr || dst == bc ||
481 dst == IPV4_ADDR_BROADCAST || dst == IPV4_ADDRANY)) {
482 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_ADDR], 1);
483 NET_COUNT_MIB(ip_stats.ipInAddrErrors, 1);
484 goto buf_rel;
485 }
486#endif
487
488#endif /* of #ifdef DHCP_CFG */
489
490#ifdef IP4_CFG_FRAGMENT
491
492 /* 分割されているかチェックする。*/
493 if (ntohs(ip4h->flg_off) & (IP4_MF | IP4_OFFMASK)) {
494 if ((input = ip_reass(ip4h, input)) == NULL)
495 return;
496 }
497
498#else /* of #ifdef IP4_CFG_FRAGMENT */
499
500 /* 分割されているかチェックする。*/
501 if (ntohs(ip4h->flg_off) & (IP4_MF | IP4_OFFMASK)) {
502 T_IN4_ADDR src;
503
504 NET_COUNT_MIB(ip_stats.ipReasmReqds, 1);
505 if ((ntohs(ip4h->flg_off) & IP4_OFFMASK) == 0) {
506 NET_COUNT_MIB(ip_stats.ipReasmFails, 1);
507 }
508 src = ntohl(ip4h->src);
509 syslog(LOG_WARNING, "[IP] flaged src: %s.", ip2str(NULL, &src));
510 goto buf_rel;
511 }
512
513#endif /* of #ifdef IP4_CFG_FRAGMENT */
514
515 off = (uint_t)(GET_IP4_SDU(input) - input->buf);
516
517#if defined(SUPPORT_IPSEC)
518 /* ここでipsec4_in_rejectを実行する */
519 if ((ip4h->proto != IPPROTO_ESP) && ipsec4_in_reject (input)) {
520 goto buf_rel;
521 }
522#endif /* of #if defined(SUPPORT_IPSEC) */
523
524 /* プロトコルを選択する */
525 switch (ip4h->proto) {
526
527#ifdef SUPPORT_UDP
528 case IPPROTO_UDP:
529 NET_COUNT_MIB(ip_stats.ipInDelivers, 1);
530 udp_input(&input, &off, NULL);
531 return;
532 break;
533#endif /* of #ifdef SUPPORT_UDP */
534
535#ifdef SUPPORT_TCP
536 case IPPROTO_TCP:
537 NET_COUNT_MIB(ip_stats.ipInDelivers, 1);
538 tcp_input(&input, &off, NULL);
539 return;
540 break;
541#endif /* of #ifdef SUPPORT_UDP */
542
543 case IPPROTO_ICMP:
544 NET_COUNT_MIB(ip_stats.ipInDelivers, 1);
545 icmp_input(&input, &off, NULL);
546 return;
547 break;
548
549#if defined(SUPPORT_IPSEC)
550 case IPPROTO_ESP:
551 NET_COUNT_MIB(ip_stats.ipInDelivers, 1);
552 esp4_input(input, &off);
553 return;
554 break;
555#endif /* of #if defined(SUPPORT_IPSEC) */
556
557 default:
558 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_PROTO], 1);
559 NET_COUNT_MIB(ip_stats.ipInUnknownProtos, 1);
560
561 /* ローカル IP アドレスに届いたデータグラムのみ ICMP エラーを通知する。*/
562 if (dst == ifp->in_ifaddr.addr) {
563 T_IN4_ADDR src;
564
565 src = ntohl(ip4h->src);
566 syslog(LOG_INFO, "[IP] unexp proto: %d, src=%s.", ip4h->proto, ip2str(NULL, &src));
567 icmp_error(ICMP4_UNREACH_PROTOCOL, input);
568 }
569 /*
570 * icmp_error では、ネットワークバッファ input を返却しないので
571 * 開放してから終了する。
572 */
573 break;
574 }
575
576buf_rel:
577 NET_COUNT_IP4(net_count_ip4[NC_IP4_IN_ERR_PACKETS], 1);
578 syscall(rel_net_buf(input));
579 }
Note: See TracBrowser for help on using the repository browser.