icsetsrc.c,v
资源名称:icmp.rar [点击查看]
上传用户:lywr2008
上传日期:2022-05-26
资源大小:9k
文件大小:1k
源码类别:
网络
开发平台:
Unix_Linux
- head 1.1;
- access;
- symbols;
- locks
- dls:1.1; strict;
- comment @ * @;
- 1.1
- date 97.09.21.19.26.41; author dls; state Dist;
- branches;
- next ;
- desc
- @@
- 1.1
- log
- @pre-3e code
- @
- text
- @/* icsetsrc.c - icsetsrc */
- #include <conf.h>
- #include <kernel.h>
- #include <network.h>
- /*------------------------------------------------------------------------
- * icsetsrc - set the source address on an ICMP packet
- *------------------------------------------------------------------------
- */
- void icsetsrc(pip)
- struct ip *pip;
- {
- int i;
- for (i=0; i<Net.nif; ++i) {
- if (i == NI_LOCAL)
- continue;
- if (netmatch(pip->ip_dst,nif[i].ni_ip,nif[i].ni_mask,0))
- break;
- }
- if (i == Net.nif)
- pip->ip_src = ip_anyaddr;
- else
- pip->ip_src = nif[i].ni_ip;
- }
- @