Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
icredirect.c,v
Package: icmp.rar [view]
Upload User: lywr2008
Upload Date: 2022-05-26
Package Size: 9k
Code Size: 1k
Category:
Linux Network
Development Platform:
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;
- }
- @