···669 u32 *put;670 int i;671672- dsc = (u32 *) kmalloc(uPD98401_TXPD_SIZE*2+673- uPD98401_TXBD_SIZE*ATM_SKB(skb)->iovcnt,GFP_ATOMIC);674 if (!dsc) {675- if (vcc->pop) vcc->pop(vcc,skb);676- else dev_kfree_skb_irq(skb);00677 return -EAGAIN;678 }679 /* @@@ should check alignment */···685 (ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ?686 uPD98401_CLPM_1 : uPD98401_CLPM_0));687 dsc[1] = 0;688- dsc[2] = ATM_SKB(skb)->iovcnt*uPD98401_TXBD_SIZE;689 dsc[3] = virt_to_bus(put);690 for (i = 0; i < ATM_SKB(skb)->iovcnt; i++) {691 *put++ = ((struct iovec *) skb->data)[i].iov_len;
···669 u32 *put;670 int i;671672+ dsc = kmalloc(uPD98401_TXPD_SIZE * 2 +673+ uPD98401_TXBD_SIZE * ATM_SKB(skb)->iovcnt, GFP_ATOMIC);674 if (!dsc) {675+ if (vcc->pop)676+ vcc->pop(vcc, skb);677+ else678+ dev_kfree_skb_irq(skb);679 return -EAGAIN;680 }681 /* @@@ should check alignment */···683 (ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ?684 uPD98401_CLPM_1 : uPD98401_CLPM_0));685 dsc[1] = 0;686+ dsc[2] = ATM_SKB(skb)->iovcnt * uPD98401_TXBD_SIZE;687 dsc[3] = virt_to_bus(put);688 for (i = 0; i < ATM_SKB(skb)->iovcnt; i++) {689 *put++ = ((struct iovec *) skb->data)[i].iov_len;
+1-2
drivers/net/irda/Kconfig
···1-2menu "Infrared-port device drivers"3 depends on IRDA!=n4···155156config DONGLE_OLD157 bool "Old Serial dongle support"158- depends on (IRTTY_OLD || IRPORT_SIR) && BROKEN_ON_SMP159 help160 Say Y here if you have an infrared device that connects to your161 computer's serial port. These devices are called dongles. Then say Y
···01menu "Infrared-port device drivers"2 depends on IRDA!=n3···156157config DONGLE_OLD158 bool "Old Serial dongle support"159+ depends on IRPORT_SIR && BROKEN_ON_SMP160 help161 Say Y here if you have an infrared device that connects to your162 computer's serial port. These devices are called dongles. Then say Y
+1-1
drivers/net/irda/Makefile
···45obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o4647# The SIR helper module48-sir-dev-objs := sir_core.o sir_dev.o sir_dongle.o sir_kthread.o
···45obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o4647# The SIR helper module48+sir-dev-objs := sir_dev.o sir_dongle.o sir_kthread.o
-2
drivers/net/irda/sir-dev.h
···133134extern void sirdev_enable_rx(struct sir_dev *dev);135extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param);136-extern int __init irda_thread_create(void);137-extern void __exit irda_thread_join(void);138139/* inline helpers */140
···133134extern void sirdev_enable_rx(struct sir_dev *dev);135extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param);00136137/* inline helpers */138
-56
drivers/net/irda/sir_core.c
···1-/*********************************************************************2- *3- * sir_core.c: module core for irda-sir abstraction layer4- *5- * Copyright (c) 2002 Martin Diehl6- * 7- * This program is free software; you can redistribute it and/or 8- * modify it under the terms of the GNU General Public License as 9- * published by the Free Software Foundation; either version 2 of 10- * the License, or (at your option) any later version.11- *12- ********************************************************************/ 13-14-#include <linux/module.h>15-#include <linux/kernel.h>16-#include <linux/init.h>17-18-#include <net/irda/irda.h>19-20-#include "sir-dev.h"21-22-/***************************************************************************/23-24-MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");25-MODULE_DESCRIPTION("IrDA SIR core");26-MODULE_LICENSE("GPL");27-28-/***************************************************************************/29-30-EXPORT_SYMBOL(irda_register_dongle);31-EXPORT_SYMBOL(irda_unregister_dongle);32-33-EXPORT_SYMBOL(sirdev_get_instance);34-EXPORT_SYMBOL(sirdev_put_instance);35-36-EXPORT_SYMBOL(sirdev_set_dongle);37-EXPORT_SYMBOL(sirdev_write_complete);38-EXPORT_SYMBOL(sirdev_receive);39-40-EXPORT_SYMBOL(sirdev_raw_write);41-EXPORT_SYMBOL(sirdev_raw_read);42-EXPORT_SYMBOL(sirdev_set_dtr_rts);43-44-static int __init sir_core_init(void)45-{46- return irda_thread_create();47-}48-49-static void __exit sir_core_exit(void)50-{51- irda_thread_join();52-}53-54-module_init(sir_core_init);55-module_exit(sir_core_exit);56-
···60 up(&dev->fsm.sem);61 return err;62}06364/* used by dongle drivers for dongle programming */65···95 spin_unlock_irqrestore(&dev->tx_lock, flags);96 return ret;97}09899/* seems some dongle drivers may need this */100···118119 return count;120}0121122int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)123{···127 ret = dev->drv->set_dtr_rts(dev, dtr, rts);128 return ret;129}130-0131/**********************************************************************/132133/* called from client driver - likely with bh-context - to indicate···231done:232 spin_unlock_irqrestore(&dev->tx_lock, flags);233}0234235/* called from client driver - likely with bh-context - to give us236 * some more received bytes. We put them into the rx-buffer,···284285 return 0;286}0287288/**********************************************************************/289···647out:648 return NULL;649}0650651int sirdev_put_instance(struct sir_dev *dev)652{···680681 return 0;682}0683
···60 up(&dev->fsm.sem);61 return err;62}63+EXPORT_SYMBOL(sirdev_set_dongle);6465/* used by dongle drivers for dongle programming */66···94 spin_unlock_irqrestore(&dev->tx_lock, flags);95 return ret;96}97+EXPORT_SYMBOL(sirdev_raw_write);9899/* seems some dongle drivers may need this */100···116117 return count;118}119+EXPORT_SYMBOL(sirdev_raw_read);120121int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)122{···124 ret = dev->drv->set_dtr_rts(dev, dtr, rts);125 return ret;126}127+EXPORT_SYMBOL(sirdev_set_dtr_rts);128+129/**********************************************************************/130131/* called from client driver - likely with bh-context - to indicate···227done:228 spin_unlock_irqrestore(&dev->tx_lock, flags);229}230+EXPORT_SYMBOL(sirdev_write_complete);231232/* called from client driver - likely with bh-context - to give us233 * some more received bytes. We put them into the rx-buffer,···279280 return 0;281}282+EXPORT_SYMBOL(sirdev_receive);283284/**********************************************************************/285···641out:642 return NULL;643}644+EXPORT_SYMBOL(sirdev_get_instance);645646int sirdev_put_instance(struct sir_dev *dev)647{···673674 return 0;675}676+EXPORT_SYMBOL(sirdev_put_instance);677
···214 * This allows the VLAN to have a different MAC than the underlying215 * device, and still route correctly.216 */217- if (memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN) == 0) {218 /* It is for our (changed) MAC-address! */219 skb->pkt_type = PACKET_HOST;220 }
···214 * This allows the VLAN to have a different MAC than the underlying215 * device, and still route correctly.216 */217+ if (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {218 /* It is for our (changed) MAC-address! */219 skb->pkt_type = PACKET_HOST;220 }
+2-2
net/atm/br2684.c
···296 eth = eth_hdr(skb);297298 if (is_multicast_ether_addr(eth->h_dest)) {299- if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)300 skb->pkt_type = PACKET_BROADCAST;301 else302 skb->pkt_type = PACKET_MULTICAST;303 }304305- else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))306 skb->pkt_type = PACKET_OTHERHOST;307308 if (ntohs(eth->h_proto) >= 1536)
···296 eth = eth_hdr(skb);297298 if (is_multicast_ether_addr(eth->h_dest)) {299+ if (!compare_ether_addr(eth->h_dest, dev->broadcast))300 skb->pkt_type = PACKET_BROADCAST;301 else302 skb->pkt_type = PACKET_MULTICAST;303 }304305+ else if (compare_ether_addr(eth->h_dest, dev->dev_addr))306 skb->pkt_type = PACKET_OTHERHOST;307308 if (ntohs(eth->h_proto) >= 1536)
+3-3
net/atm/lec.c
···1321 struct sk_buff *skb;1322 struct lec_priv *priv = (struct lec_priv*)dev->priv;13231324- if ( memcmp(lan_dst, dev->dev_addr, ETH_ALEN) != 0 )1325 return (0); /* not our mac address */13261327 kfree(priv->tlvs); /* NULL if there was no previous association */···17981799 to_return = priv->lec_arp_tables[place];1800 while(to_return) {1801- if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) {1802 return to_return;1803 }1804 to_return = to_return->next;···2002 return priv->mcast_vcc;2003 break;2004 case 2: /* LANE2 wants arp for multicast addresses */2005- if ( memcmp(mac_to_find, bus_mac, ETH_ALEN) == 0)2006 return priv->mcast_vcc;2007 break;2008 default:
···1321 struct sk_buff *skb;1322 struct lec_priv *priv = (struct lec_priv*)dev->priv;13231324+ if (compare_ether_addr(lan_dst, dev->dev_addr))1325 return (0); /* not our mac address */13261327 kfree(priv->tlvs); /* NULL if there was no previous association */···17981799 to_return = priv->lec_arp_tables[place];1800 while(to_return) {1801+ if (!compare_ether_addr(mac_addr, to_return->mac_addr)) {1802 return to_return;1803 }1804 to_return = to_return->next;···2002 return priv->mcast_vcc;2003 break;2004 case 2: /* LANE2 wants arp for multicast addresses */2005+ if (!compare_ether_addr(mac_to_find, bus_mac))2006 return priv->mcast_vcc;2007 break;2008 default:
+1-1
net/atm/mpc.c
···552 goto non_ip; /* Multi-Protocol Over ATM :-) */553554 while (i < mpc->number_of_mps_macs) {555- if (memcmp(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN), ETH_ALEN) == 0)556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */557 return 0; /* success! */558 i++;
···552 goto non_ip; /* Multi-Protocol Over ATM :-) */553554 while (i < mpc->number_of_mps_macs) {555+ if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */557 return 0; /* success! */558 i++;
+3-3
net/bluetooth/bnep/core.c
···7576 list_for_each(p, &bnep_session_list) {77 s = list_entry(p, struct bnep_session, list); 78- if (!memcmp(dst, s->eh.h_source, ETH_ALEN))79 return s;80 }81 return NULL;···420 iv[il++] = (struct kvec) { &type, 1 };421 len++;422423- if (!memcmp(eh->h_dest, s->eh.h_source, ETH_ALEN))424 type |= 0x01;425426- if (!memcmp(eh->h_source, s->eh.h_dest, ETH_ALEN))427 type |= 0x02;428429 if (type)
···7576 list_for_each(p, &bnep_session_list) {77 s = list_entry(p, struct bnep_session, list); 78+ if (!compare_ether_addr(dst, s->eh.h_source))79 return s;80 }81 return NULL;···420 iv[il++] = (struct kvec) { &type, 1 };421 len++;422423+ if (!compare_ether_addr(eh->h_dest, s->eh.h_source))424 type |= 0x01;425426+ if (!compare_ether_addr(eh->h_source, s->eh.h_dest))427 type |= 0x02;428429 if (type)
···164 if (datalen != len)165 return -EINVAL;166 /* Make sure the match only receives stp frames */167- if (memcmp(e->destmac, bridge_ula, ETH_ALEN) ||168- memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC))169 return -EINVAL;170171 return 0;
···164 if (datalen != len)165 return -EINVAL;166 /* Make sure the match only receives stp frames */167+ if (compare_ether_addr(e->destmac, bridge_ula) ||168+ compare_ether_addr(e->destmsk, msk) || !(e->bitmask & EBT_DESTMAC))169 return -EINVAL;170171 return 0;
+1-1
net/core/dv.c
···457 unsigned char *skb_data_end = skb->data + skb->len;458459 /* Packet is already aimed at us, return */460- if (!memcmp(eth, skb->dev->dev_addr, ETH_ALEN))461 return;462463 /* proto is not IP, do nothing */
···457 unsigned char *skb_data_end = skb->data + skb->len;458459 /* Packet is already aimed at us, return */460+ if (!compare_ether_addr(eth, skb->dev->dev_addr))461 return;462463 /* proto is not IP, do nothing */
+1-1
net/core/wireless.c
···15061507 /* Update all records that match */1508 for(i = 0; i < spydata->spy_number; i++)1509- if(!memcmp(address, spydata->spy_address[i], ETH_ALEN)) {1510 memcpy(&(spydata->spy_stat[i]), wstats,1511 sizeof(struct iw_quality));1512 match = i;
···15061507 /* Update all records that match */1508 for(i = 0; i < spydata->spy_number; i++)1509+ if(!compare_ether_addr(address, spydata->spy_address[i])) {1510 memcpy(&(spydata->spy_stat[i]), wstats,1511 sizeof(struct iw_quality));1512 match = i;
+7-7
net/ieee80211/ieee80211_rx.c
···7677 if (entry->skb != NULL && entry->seq == seq &&78 (entry->last_frag + 1 == frag || frag == -1) &&79- memcmp(entry->src_addr, src, ETH_ALEN) == 0 &&80- memcmp(entry->dst_addr, dst, ETH_ALEN) == 0)81 return entry;82 }83···243 /* check that the frame is unicast frame to us */244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==245 IEEE80211_FCTL_TODS &&246- memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 &&247- memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {248 /* ToDS frame with own addr BSSID and DA */249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==250 IEEE80211_FCTL_FROMDS &&251- memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {252 /* FromDS frame with own addr as DA */253 } else254 return 0;···505 if (ieee->iw_mode == IW_MODE_MASTER && !wds &&506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==507 IEEE80211_FCTL_FROMDS && ieee->stadev508- && memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {509 /* Frame from BSSID of the AP for which we are a client */510 skb->dev = dev = ieee->stadev;511 stats = hostap_get_stats(dev);···1231 * as one network */1232 return ((src->ssid_len == dst->ssid_len) &&1233 (src->channel == dst->channel) &&1234- !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&1235 !memcmp(src->ssid, dst->ssid, src->ssid_len));1236}1237
···7677 if (entry->skb != NULL && entry->seq == seq &&78 (entry->last_frag + 1 == frag || frag == -1) &&79+ !compare_ether_addr(entry->src_addr, src) &&80+ !compare_ether_addr(entry->dst_addr, dst))81 return entry;82 }83···243 /* check that the frame is unicast frame to us */244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==245 IEEE80211_FCTL_TODS &&246+ !compare_ether_addr(hdr->addr1, dev->dev_addr) &&247+ !compare_ether_addr(hdr->addr3, dev->dev_addr)) {248 /* ToDS frame with own addr BSSID and DA */249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==250 IEEE80211_FCTL_FROMDS &&251+ !compare_ether_addr(hdr->addr1, dev->dev_addr)) {252 /* FromDS frame with own addr as DA */253 } else254 return 0;···505 if (ieee->iw_mode == IW_MODE_MASTER && !wds &&506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==507 IEEE80211_FCTL_FROMDS && ieee->stadev508+ && !compare_ether_addr(hdr->addr2, ieee->assoc_ap_addr)) {509 /* Frame from BSSID of the AP for which we are a client */510 skb->dev = dev = ieee->stadev;511 stats = hostap_get_stats(dev);···1231 * as one network */1232 return ((src->ssid_len == dst->ssid_len) &&1233 (src->channel == dst->channel) &&1234+ !compare_ether_addr(src->bssid, dst->bssid) &&1235 !memcmp(src->ssid, dst->ssid, src->ssid_len));1236}1237
···1/* IPv4 specific functions of netfilter core */00002#include <linux/kernel.h>3#include <linux/netfilter.h>4#include <linux/netfilter_ipv4.h>05#include <linux/ip.h>0006#include <net/route.h>7#include <net/xfrm.h>8#include <net/ip.h>···146147module_init(init);148module_exit(fini);00
+1-1
net/ipv4/netfilter/ip_conntrack_proto_generic.c
···12#include <linux/netfilter.h>13#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>1415-unsigned long ip_ct_generic_timeout = 600*HZ;1617static int generic_pkt_to_tuple(const struct sk_buff *skb,18 unsigned int dataoff,
···12#include <linux/netfilter.h>13#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>1415+unsigned int ip_ct_generic_timeout = 600*HZ;1617static int generic_pkt_to_tuple(const struct sk_buff *skb,18 unsigned int dataoff,
+1-1
net/ipv4/netfilter/ip_conntrack_proto_icmp.c
···22#include <linux/netfilter_ipv4/ip_conntrack_core.h>23#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>2425-unsigned long ip_ct_icmp_timeout = 30*HZ;2627#if 028#define DEBUGP printk
···22#include <linux/netfilter_ipv4/ip_conntrack_core.h>23#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>2425+unsigned int ip_ct_icmp_timeout = 30*HZ;2627#if 028#define DEBUGP printk
+8-8
net/ipv4/netfilter/ip_conntrack_proto_sctp.c
···58#define HOURS * 60 MINS59#define DAYS * 24 HOURS6061-static unsigned long ip_ct_sctp_timeout_closed = 10 SECS;62-static unsigned long ip_ct_sctp_timeout_cookie_wait = 3 SECS;63-static unsigned long ip_ct_sctp_timeout_cookie_echoed = 3 SECS;64-static unsigned long ip_ct_sctp_timeout_established = 5 DAYS;65-static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;66-static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;67-static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;6869-static const unsigned long * sctp_timeouts[]70= { NULL, /* SCTP_CONNTRACK_NONE */71 &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */72 &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
···58#define HOURS * 60 MINS59#define DAYS * 24 HOURS6061+static unsigned int ip_ct_sctp_timeout_closed = 10 SECS;62+static unsigned int ip_ct_sctp_timeout_cookie_wait = 3 SECS;63+static unsigned int ip_ct_sctp_timeout_cookie_echoed = 3 SECS;64+static unsigned int ip_ct_sctp_timeout_established = 5 DAYS;65+static unsigned int ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;66+static unsigned int ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;67+static unsigned int ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;6869+static const unsigned int * sctp_timeouts[]70= { NULL, /* SCTP_CONNTRACK_NONE */71 &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */72 &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
+10-10
net/ipv4/netfilter/ip_conntrack_proto_tcp.c
···85#define HOURS * 60 MINS86#define DAYS * 24 HOURS8788-unsigned long ip_ct_tcp_timeout_syn_sent = 2 MINS;89-unsigned long ip_ct_tcp_timeout_syn_recv = 60 SECS;90-unsigned long ip_ct_tcp_timeout_established = 5 DAYS;91-unsigned long ip_ct_tcp_timeout_fin_wait = 2 MINS;92-unsigned long ip_ct_tcp_timeout_close_wait = 60 SECS;93-unsigned long ip_ct_tcp_timeout_last_ack = 30 SECS;94-unsigned long ip_ct_tcp_timeout_time_wait = 2 MINS;95-unsigned long ip_ct_tcp_timeout_close = 10 SECS;9697/* RFC1122 says the R2 limit should be at least 100 seconds.98 Linux uses 15 packets as limit, which corresponds 99 to ~13-30min depending on RTO. */100-unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS;101102-static const unsigned long * tcp_timeouts[]103= { NULL, /* TCP_CONNTRACK_NONE */104 &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */105 &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
···85#define HOURS * 60 MINS86#define DAYS * 24 HOURS8788+unsigned int ip_ct_tcp_timeout_syn_sent = 2 MINS;89+unsigned int ip_ct_tcp_timeout_syn_recv = 60 SECS;90+unsigned int ip_ct_tcp_timeout_established = 5 DAYS;91+unsigned int ip_ct_tcp_timeout_fin_wait = 2 MINS;92+unsigned int ip_ct_tcp_timeout_close_wait = 60 SECS;93+unsigned int ip_ct_tcp_timeout_last_ack = 30 SECS;94+unsigned int ip_ct_tcp_timeout_time_wait = 2 MINS;95+unsigned int ip_ct_tcp_timeout_close = 10 SECS;9697/* RFC1122 says the R2 limit should be at least 100 seconds.98 Linux uses 15 packets as limit, which corresponds 99 to ~13-30min depending on RTO. */100+unsigned int ip_ct_tcp_timeout_max_retrans = 5 MINS;101102+static const unsigned int * tcp_timeouts[]103= { NULL, /* TCP_CONNTRACK_NONE */104 &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */105 &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
+2-2
net/ipv4/netfilter/ip_conntrack_proto_udp.c
···19#include <linux/netfilter_ipv4.h>20#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>2122-unsigned long ip_ct_udp_timeout = 30*HZ;23-unsigned long ip_ct_udp_timeout_stream = 180*HZ;2425static int udp_pkt_to_tuple(const struct sk_buff *skb,26 unsigned int dataoff,
···19#include <linux/netfilter_ipv4.h>20#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>2122+unsigned int ip_ct_udp_timeout = 30*HZ;23+unsigned int ip_ct_udp_timeout_stream = 180*HZ;2425static int udp_pkt_to_tuple(const struct sk_buff *skb,26 unsigned int dataoff,
+13-13
net/ipv4/netfilter/ip_conntrack_standalone.c
···544extern unsigned int ip_conntrack_htable_size;545546/* From ip_conntrack_proto_tcp.c */547-extern unsigned long ip_ct_tcp_timeout_syn_sent;548-extern unsigned long ip_ct_tcp_timeout_syn_recv;549-extern unsigned long ip_ct_tcp_timeout_established;550-extern unsigned long ip_ct_tcp_timeout_fin_wait;551-extern unsigned long ip_ct_tcp_timeout_close_wait;552-extern unsigned long ip_ct_tcp_timeout_last_ack;553-extern unsigned long ip_ct_tcp_timeout_time_wait;554-extern unsigned long ip_ct_tcp_timeout_close;555-extern unsigned long ip_ct_tcp_timeout_max_retrans;556extern int ip_ct_tcp_loose;557extern int ip_ct_tcp_be_liberal;558extern int ip_ct_tcp_max_retrans;559560/* From ip_conntrack_proto_udp.c */561-extern unsigned long ip_ct_udp_timeout;562-extern unsigned long ip_ct_udp_timeout_stream;563564/* From ip_conntrack_proto_icmp.c */565-extern unsigned long ip_ct_icmp_timeout;566567/* From ip_conntrack_proto_icmp.c */568-extern unsigned long ip_ct_generic_timeout;569570/* Log invalid packets of a given protocol */571static int log_invalid_proto_min = 0;
···544extern unsigned int ip_conntrack_htable_size;545546/* From ip_conntrack_proto_tcp.c */547+extern unsigned int ip_ct_tcp_timeout_syn_sent;548+extern unsigned int ip_ct_tcp_timeout_syn_recv;549+extern unsigned int ip_ct_tcp_timeout_established;550+extern unsigned int ip_ct_tcp_timeout_fin_wait;551+extern unsigned int ip_ct_tcp_timeout_close_wait;552+extern unsigned int ip_ct_tcp_timeout_last_ack;553+extern unsigned int ip_ct_tcp_timeout_time_wait;554+extern unsigned int ip_ct_tcp_timeout_close;555+extern unsigned int ip_ct_tcp_timeout_max_retrans;556extern int ip_ct_tcp_loose;557extern int ip_ct_tcp_be_liberal;558extern int ip_ct_tcp_max_retrans;559560/* From ip_conntrack_proto_udp.c */561+extern unsigned int ip_ct_udp_timeout;562+extern unsigned int ip_ct_udp_timeout_stream;563564/* From ip_conntrack_proto_icmp.c */565+extern unsigned int ip_ct_icmp_timeout;566567/* From ip_conntrack_proto_icmp.c */568+extern unsigned int ip_ct_generic_timeout;569570/* Log invalid packets of a given protocol */571static int log_invalid_proto_min = 0;
+34-47
net/ipv4/netfilter/ip_nat_helper_pptp.c
···148{149 struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info;150 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;151-152- u_int16_t msg, *cid = NULL, new_callid;153154 new_callid = htons(ct_pptp_info->pns_call_id);155156 switch (msg = ntohs(ctlh->messageType)) {157 case PPTP_OUT_CALL_REQUEST:158- cid = &pptpReq->ocreq.callID;159 /* FIXME: ideally we would want to reserve a call ID160 * here. current netfilter NAT core is not able to do161 * this :( For now we use TCP source port. This breaks···172 ct_pptp_info->pns_call_id = ntohs(new_callid);173 break;174 case PPTP_IN_CALL_REPLY:175- cid = &pptpReq->icreq.callID;176 break;177 case PPTP_CALL_CLEAR_REQUEST:178- cid = &pptpReq->clrreq.callID;179 break;180 default:181 DEBUGP("unknown outbound packet 0x%04x:%s\n", msg,···197198 /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass199 * down to here */200-201- IP_NF_ASSERT(cid);202-203 DEBUGP("altering call id from 0x%04x to 0x%04x\n",204- ntohs(*cid), ntohs(new_callid));205206 /* mangle packet */207 if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,208- (void *)cid - ((void *)ctlh - sizeof(struct pptp_pkt_hdr)),209- sizeof(new_callid), 210- (char *)&new_callid,211- sizeof(new_callid)) == 0)212 return NF_DROP;213214 return NF_ACCEPT;···296 union pptp_ctrl_union *pptpReq)297{298 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;299- u_int16_t msg, new_cid = 0, new_pcid, *pcid = NULL, *cid = NULL;300-301- int ret = NF_ACCEPT, rv;302303 new_pcid = htons(nat_pptp_info->pns_call_id);304305 switch (msg = ntohs(ctlh->messageType)) {306 case PPTP_OUT_CALL_REPLY:307- pcid = &pptpReq->ocack.peersCallID; 308- cid = &pptpReq->ocack.callID;309 break;310 case PPTP_IN_CALL_CONNECT:311- pcid = &pptpReq->iccon.peersCallID;312 break;313 case PPTP_IN_CALL_REQUEST:314 /* only need to nat in case PAC is behind NAT box */315- break;316 case PPTP_WAN_ERROR_NOTIFY:317- pcid = &pptpReq->wanerr.peersCallID;318 break;319 case PPTP_CALL_DISCONNECT_NOTIFY:320- pcid = &pptpReq->disc.callID;321 break;322 case PPTP_SET_LINK_INFO:323- pcid = &pptpReq->setlink.peersCallID;324 break;325326 default:···341 * WAN_ERROR_NOTIFY, CALL_DISCONNECT_NOTIFY pass down here */342343 /* mangle packet */344- IP_NF_ASSERT(pcid);345 DEBUGP("altering peer call id from 0x%04x to 0x%04x\n",346- ntohs(*pcid), ntohs(new_pcid));347-348- rv = ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, 349- (void *)pcid - ((void *)ctlh - sizeof(struct pptp_pkt_hdr)),350- sizeof(new_pcid), (char *)&new_pcid, 351- sizeof(new_pcid));352- if (rv != NF_ACCEPT) 353- return rv;354355 if (new_cid) {356- IP_NF_ASSERT(cid);357 DEBUGP("altering call id from 0x%04x to 0x%04x\n",358- ntohs(*cid), ntohs(new_cid));359- rv = ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, 360- (void *)cid - ((void *)ctlh - sizeof(struct pptp_pkt_hdr)), 361- sizeof(new_cid),362- (char *)&new_cid, 363- sizeof(new_cid));364- if (rv != NF_ACCEPT)365- return rv;366 }367-368- /* check for earlier return value of 'switch' above */369- if (ret != NF_ACCEPT)370- return ret;371-372- /* great, at least we don't need to resize packets */373 return NF_ACCEPT;374}375
···148{149 struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info;150 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;151+ u_int16_t msg, new_callid;152+ unsigned int cid_off;153154 new_callid = htons(ct_pptp_info->pns_call_id);155156 switch (msg = ntohs(ctlh->messageType)) {157 case PPTP_OUT_CALL_REQUEST:158+ cid_off = offsetof(union pptp_ctrl_union, ocreq.callID);159 /* FIXME: ideally we would want to reserve a call ID160 * here. current netfilter NAT core is not able to do161 * this :( For now we use TCP source port. This breaks···172 ct_pptp_info->pns_call_id = ntohs(new_callid);173 break;174 case PPTP_IN_CALL_REPLY:175+ cid_off = offsetof(union pptp_ctrl_union, icreq.callID);176 break;177 case PPTP_CALL_CLEAR_REQUEST:178+ cid_off = offsetof(union pptp_ctrl_union, clrreq.callID);179 break;180 default:181 DEBUGP("unknown outbound packet 0x%04x:%s\n", msg,···197198 /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass199 * down to here */000200 DEBUGP("altering call id from 0x%04x to 0x%04x\n",201+ ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_callid));202203 /* mangle packet */204 if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,205+ cid_off + sizeof(struct pptp_pkt_hdr) +206+ sizeof(struct PptpControlHeader),207+ sizeof(new_callid), (char *)&new_callid,208+ sizeof(new_callid)) == 0)209 return NF_DROP;210211 return NF_ACCEPT;···299 union pptp_ctrl_union *pptpReq)300{301 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;302+ u_int16_t msg, new_cid = 0, new_pcid;303+ unsigned int pcid_off, cid_off = 0;0304305 new_pcid = htons(nat_pptp_info->pns_call_id);306307 switch (msg = ntohs(ctlh->messageType)) {308 case PPTP_OUT_CALL_REPLY:309+ pcid_off = offsetof(union pptp_ctrl_union, ocack.peersCallID);310+ cid_off = offsetof(union pptp_ctrl_union, ocack.callID);311 break;312 case PPTP_IN_CALL_CONNECT:313+ pcid_off = offsetof(union pptp_ctrl_union, iccon.peersCallID);314 break;315 case PPTP_IN_CALL_REQUEST:316 /* only need to nat in case PAC is behind NAT box */317+ return NF_ACCEPT;318 case PPTP_WAN_ERROR_NOTIFY:319+ pcid_off = offsetof(union pptp_ctrl_union, wanerr.peersCallID);320 break;321 case PPTP_CALL_DISCONNECT_NOTIFY:322+ pcid_off = offsetof(union pptp_ctrl_union, disc.callID);323 break;324 case PPTP_SET_LINK_INFO:325+ pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID);326 break;327328 default:···345 * WAN_ERROR_NOTIFY, CALL_DISCONNECT_NOTIFY pass down here */346347 /* mangle packet */0348 DEBUGP("altering peer call id from 0x%04x to 0x%04x\n",349+ ntohs(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid));350+351+ if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,352+ pcid_off + sizeof(struct pptp_pkt_hdr) +353+ sizeof(struct PptpControlHeader),354+ sizeof(new_pcid), (char *)&new_pcid,355+ sizeof(new_pcid)) == 0)356+ return NF_DROP;357358 if (new_cid) {0359 DEBUGP("altering call id from 0x%04x to 0x%04x\n",360+ ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid));361+ if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,362+ cid_off + sizeof(struct pptp_pkt_hdr) +363+ sizeof(struct PptpControlHeader),364+ sizeof(new_cid), (char *)&new_cid,365+ sizeof(new_cid)) == 0)366+ return NF_DROP;0367 }000000368 return NF_ACCEPT;369}370
-38
net/ipv4/netfilter/ip_nat_proto_gre.c
···151 return 1;152}153154-/* print out a nat tuple */155-static unsigned int 156-gre_print(char *buffer, 157- const struct ip_conntrack_tuple *match,158- const struct ip_conntrack_tuple *mask)159-{160- unsigned int len = 0;161-162- if (mask->src.u.gre.key)163- len += sprintf(buffer + len, "srckey=0x%x ", 164- ntohl(match->src.u.gre.key));165-166- if (mask->dst.u.gre.key)167- len += sprintf(buffer + len, "dstkey=0x%x ",168- ntohl(match->src.u.gre.key));169-170- return len;171-}172-173-/* print a range of keys */174-static unsigned int 175-gre_print_range(char *buffer, const struct ip_nat_range *range)176-{177- if (range->min.gre.key != 0 178- || range->max.gre.key != 0xFFFF) {179- if (range->min.gre.key == range->max.gre.key)180- return sprintf(buffer, "key 0x%x ",181- ntohl(range->min.gre.key));182- else183- return sprintf(buffer, "keys 0x%u-0x%u ",184- ntohl(range->min.gre.key),185- ntohl(range->max.gre.key));186- } else187- return 0;188-}189-190/* nat helper struct */191static struct ip_nat_protocol gre = { 192 .name = "GRE", ···158 .manip_pkt = gre_manip_pkt,159 .in_range = gre_in_range,160 .unique_tuple = gre_unique_tuple,161- .print = gre_print,162- .print_range = gre_print_range,163#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \164 defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)165 .range_to_nfattr = ip_nat_port_range_to_nfattr,
···34 return (skb->mac.raw >= skb->head35 && (skb->mac.raw + ETH_HLEN) <= skb->data36 /* If so, compare... */37- && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN)38- == 0) ^ info->invert));39}4041static int
···34 return (skb->mac.raw >= skb->head35 && (skb->mac.raw + ETH_HLEN) <= skb->data36 /* If so, compare... */37+ && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))38+ ^ info->invert));39}4041static int
+2-2
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
···335#ifdef CONFIG_SYSCTL336337/* From nf_conntrack_proto_icmpv6.c */338-extern unsigned long nf_ct_icmpv6_timeout;339340/* From nf_conntrack_frag6.c */341-extern unsigned long nf_ct_frag6_timeout;342extern unsigned int nf_ct_frag6_low_thresh;343extern unsigned int nf_ct_frag6_high_thresh;344
···335#ifdef CONFIG_SYSCTL336337/* From nf_conntrack_proto_icmpv6.c */338+extern unsigned int nf_ct_icmpv6_timeout;339340/* From nf_conntrack_frag6.c */341+extern unsigned int nf_ct_frag6_timeout;342extern unsigned int nf_ct_frag6_low_thresh;343extern unsigned int nf_ct_frag6_high_thresh;344
+1-1
net/netfilter/nf_conntrack_proto_generic.c
···17#include <linux/netfilter.h>18#include <net/netfilter/nf_conntrack_protocol.h>1920-unsigned long nf_ct_generic_timeout = 600*HZ;2122static int generic_pkt_to_tuple(const struct sk_buff *skb,23 unsigned int dataoff,
···17#include <linux/netfilter.h>18#include <net/netfilter/nf_conntrack_protocol.h>1920+unsigned int nf_ct_generic_timeout = 600*HZ;2122static int generic_pkt_to_tuple(const struct sk_buff *skb,23 unsigned int dataoff,
+8-8
net/netfilter/nf_conntrack_proto_sctp.c
···62#define HOURS * 60 MINS63#define DAYS * 24 HOURS6465-static unsigned long nf_ct_sctp_timeout_closed = 10 SECS;66-static unsigned long nf_ct_sctp_timeout_cookie_wait = 3 SECS;67-static unsigned long nf_ct_sctp_timeout_cookie_echoed = 3 SECS;68-static unsigned long nf_ct_sctp_timeout_established = 5 DAYS;69-static unsigned long nf_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;70-static unsigned long nf_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;71-static unsigned long nf_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;7273-static unsigned long * sctp_timeouts[]74= { NULL, /* SCTP_CONNTRACK_NONE */75 &nf_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */76 &nf_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
···62#define HOURS * 60 MINS63#define DAYS * 24 HOURS6465+static unsigned int nf_ct_sctp_timeout_closed = 10 SECS;66+static unsigned int nf_ct_sctp_timeout_cookie_wait = 3 SECS;67+static unsigned int nf_ct_sctp_timeout_cookie_echoed = 3 SECS;68+static unsigned int nf_ct_sctp_timeout_established = 5 DAYS;69+static unsigned int nf_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;70+static unsigned int nf_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;71+static unsigned int nf_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;7273+static unsigned int * sctp_timeouts[]74= { NULL, /* SCTP_CONNTRACK_NONE */75 &nf_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */76 &nf_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
+10-10
net/netfilter/nf_conntrack_proto_tcp.c
···93#define HOURS * 60 MINS94#define DAYS * 24 HOURS9596-unsigned long nf_ct_tcp_timeout_syn_sent = 2 MINS;97-unsigned long nf_ct_tcp_timeout_syn_recv = 60 SECS;98-unsigned long nf_ct_tcp_timeout_established = 5 DAYS;99-unsigned long nf_ct_tcp_timeout_fin_wait = 2 MINS;100-unsigned long nf_ct_tcp_timeout_close_wait = 60 SECS;101-unsigned long nf_ct_tcp_timeout_last_ack = 30 SECS;102-unsigned long nf_ct_tcp_timeout_time_wait = 2 MINS;103-unsigned long nf_ct_tcp_timeout_close = 10 SECS;104105/* RFC1122 says the R2 limit should be at least 100 seconds.106 Linux uses 15 packets as limit, which corresponds 107 to ~13-30min depending on RTO. */108-unsigned long nf_ct_tcp_timeout_max_retrans = 5 MINS;109110-static unsigned long * tcp_timeouts[]111= { NULL, /* TCP_CONNTRACK_NONE */112 &nf_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */113 &nf_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
···93#define HOURS * 60 MINS94#define DAYS * 24 HOURS9596+unsigned int nf_ct_tcp_timeout_syn_sent = 2 MINS;97+unsigned int nf_ct_tcp_timeout_syn_recv = 60 SECS;98+unsigned int nf_ct_tcp_timeout_established = 5 DAYS;99+unsigned int nf_ct_tcp_timeout_fin_wait = 2 MINS;100+unsigned int nf_ct_tcp_timeout_close_wait = 60 SECS;101+unsigned int nf_ct_tcp_timeout_last_ack = 30 SECS;102+unsigned int nf_ct_tcp_timeout_time_wait = 2 MINS;103+unsigned int nf_ct_tcp_timeout_close = 10 SECS;104105/* RFC1122 says the R2 limit should be at least 100 seconds.106 Linux uses 15 packets as limit, which corresponds 107 to ~13-30min depending on RTO. */108+unsigned int nf_ct_tcp_timeout_max_retrans = 5 MINS;109110+static unsigned int * tcp_timeouts[]111= { NULL, /* TCP_CONNTRACK_NONE */112 &nf_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */113 &nf_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
+2-2
net/netfilter/nf_conntrack_proto_udp.c
···27#include <linux/netfilter_ipv6.h>28#include <net/netfilter/nf_conntrack_protocol.h>2930-unsigned long nf_ct_udp_timeout = 30*HZ;31-unsigned long nf_ct_udp_timeout_stream = 180*HZ;3233static int udp_pkt_to_tuple(const struct sk_buff *skb,34 unsigned int dataoff,
···27#include <linux/netfilter_ipv6.h>28#include <net/netfilter/nf_conntrack_protocol.h>2930+unsigned int nf_ct_udp_timeout = 30*HZ;31+unsigned int nf_ct_udp_timeout_stream = 180*HZ;3233static int udp_pkt_to_tuple(const struct sk_buff *skb,34 unsigned int dataoff,
+12-12
net/netfilter/nf_conntrack_standalone.c
···431extern unsigned int nf_conntrack_htable_size;432433/* From nf_conntrack_proto_tcp.c */434-extern unsigned long nf_ct_tcp_timeout_syn_sent;435-extern unsigned long nf_ct_tcp_timeout_syn_recv;436-extern unsigned long nf_ct_tcp_timeout_established;437-extern unsigned long nf_ct_tcp_timeout_fin_wait;438-extern unsigned long nf_ct_tcp_timeout_close_wait;439-extern unsigned long nf_ct_tcp_timeout_last_ack;440-extern unsigned long nf_ct_tcp_timeout_time_wait;441-extern unsigned long nf_ct_tcp_timeout_close;442-extern unsigned long nf_ct_tcp_timeout_max_retrans;443extern int nf_ct_tcp_loose;444extern int nf_ct_tcp_be_liberal;445extern int nf_ct_tcp_max_retrans;446447/* From nf_conntrack_proto_udp.c */448-extern unsigned long nf_ct_udp_timeout;449-extern unsigned long nf_ct_udp_timeout_stream;450451/* From nf_conntrack_proto_generic.c */452-extern unsigned long nf_ct_generic_timeout;453454/* Log invalid packets of a given protocol */455static int log_invalid_proto_min = 0;
···431extern unsigned int nf_conntrack_htable_size;432433/* From nf_conntrack_proto_tcp.c */434+extern unsigned int nf_ct_tcp_timeout_syn_sent;435+extern unsigned int nf_ct_tcp_timeout_syn_recv;436+extern unsigned int nf_ct_tcp_timeout_established;437+extern unsigned int nf_ct_tcp_timeout_fin_wait;438+extern unsigned int nf_ct_tcp_timeout_close_wait;439+extern unsigned int nf_ct_tcp_timeout_last_ack;440+extern unsigned int nf_ct_tcp_timeout_time_wait;441+extern unsigned int nf_ct_tcp_timeout_close;442+extern unsigned int nf_ct_tcp_timeout_max_retrans;443extern int nf_ct_tcp_loose;444extern int nf_ct_tcp_be_liberal;445extern int nf_ct_tcp_max_retrans;446447/* From nf_conntrack_proto_udp.c */448+extern unsigned int nf_ct_udp_timeout;449+extern unsigned int nf_ct_udp_timeout_stream;450451/* From nf_conntrack_proto_generic.c */452+extern unsigned int nf_ct_generic_timeout;453454/* Log invalid packets of a given protocol */455static int log_invalid_proto_min = 0;