📄 packet_out.c
字号:
/*************************************************************************** packet_out.c - description ------------------- begin : Mon Aug 4 2003 copyright : (C) 2003 by Luke Klein-Berndt email : kleinb@nist.gov ***************************************************************************/#include "packet_out.h"extern u_int32_t g_broadcast_ip;extern u_int32_t g_my_ip;extern u_int8_t g_aodv_gateway;unsigned int output_handler(unsigned int hooknum, struct sk_buff **skb, const struct net_device *in, const struct net_device *out, int (*okfn) (struct sk_buff *)){ struct iphdr *ip= (*skb)->nh.iph; struct net_device *dev= (*skb)->dev; aodv_route *tmp_route; aodv_neigh *tmp_neigh; void *p = (uint32_t *) ip + ip->ihl; struct udphdr *udp = p; //(struct udphdr *) ip + ip->ihl; struct ethhdr *mac = (*skb)->mac.ethernet; //Thanks to Randy Pitz for adding this extra check... if (ip->daddr == g_broadcast_ip) { return NF_ACCEPT; } //Need this additional check, otherwise users on the //gateway will not be able to access the externel //network. Remote user located outside the aodv_subnet //also require this check if they are access services on //the gateway node. 28 April 2004 pb if(g_aodv_gateway && !aodv_subnet_test(ip->daddr)) { return NF_ACCEPT; } //Try to get a route to the destination tmp_route = find_aodv_route(ip->daddr); if ((tmp_route == NULL) || !(tmp_route->route_valid)) { gen_rreq(g_my_ip, ip->daddr); return NF_QUEUE; } if ((tmp_route != NULL) && (tmp_route->route_valid)) //Found after an LONG search by Jon Anderson { if (!tmp_route->self_route) tmp_route->lifetime = getcurrtime() + ACTIVE_ROUTE_TIMEOUT; } return NF_ACCEPT;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -