arp.c

来自「一个基于linux的TCP/IP协议栈的实现」· C语言 代码 · 共 36 行

C
36
字号
/* arp.c test the arp module * linqianghe@163.com * 2006-09-30 */#include "arp.h"#include "log.h"#include <net/route.h>static void test_bind_neighbour(void){	struct rtable table[10];	int i;	for( i = 0; i < 10; i ++ ){		memset( &table[i], 0, sizeof(struct rtable) );		table[i].rt_gateway = i * 10; 		if( (table[i].u.dst.dev = dev_get_by_name( "mylo" )) == NULL ){			PR_ERR( "please load the device mylo first, test myarp_bind_neighbour stopped!\n");			return;		}		if( myarp_bind_neighbour( &(table[i].u.dst) ) < 0 )			PR_NOTICE( "test myarp_bind_neighbour failed!\n" );		else			PR_NOTICE( "test myarp_bind_neighbour successed!\n" );	}	for( i = 0; i < 10; i ++ )		dev_put( table[i].u.dst.dev );}void arp_test(void){	test_bind_neighbour();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?