- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
icredirect.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
- @/* icredirect.c - icredirect */
- #include <conf.h>
- #include <kernel.h>
- #include <network.h>
- struct route *rtget();
- /*------------------------------------------------------------------------
- * icredirect - handle an incoming ICMP redirect
- *------------------------------------------------------------------------
- */
- int icredirect(pep)
- struct ep *pep;
- {
- struct route *prt;
- struct ip *pip, *pip2;
- struct icmp *pic;
- IPaddr mask;
- pip = (struct ip *)pep->ep_data;
- pic = (struct icmp *)pip->ip_data;
- pip2 = (struct ip *)pic->ic_data;
- if (pic->ic_code == ICC_HOSTRD)
- mask = ip_maskall;
- else
- mask = netmask(pip2->ip_dst);
- prt = rtget(pip2->ip_dst, RTF_LOCAL);
- if (prt == 0) {
- freebuf(pep);
- return OK;
- }
- if (pip->ip_src == prt->rt_gw) {
- rtdel(pip2->ip_dst, mask);
- rtadd(pip2->ip_dst, mask, pic->ic_gw, prt->rt_metric,
- prt->rt_ifnum, IC_RDTTL);
- }
- rtfree(prt);
- freebuf(pep);
- return OK;
- }
- @