···669669 u32 *put;670670 int i;671671672672- dsc = (u32 *) kmalloc(uPD98401_TXPD_SIZE*2+673673- uPD98401_TXBD_SIZE*ATM_SKB(skb)->iovcnt,GFP_ATOMIC);672672+ dsc = kmalloc(uPD98401_TXPD_SIZE * 2 +673673+ uPD98401_TXBD_SIZE * ATM_SKB(skb)->iovcnt, GFP_ATOMIC);674674 if (!dsc) {675675- if (vcc->pop) vcc->pop(vcc,skb);676676- else dev_kfree_skb_irq(skb);675675+ if (vcc->pop)676676+ vcc->pop(vcc, skb);677677+ else678678+ dev_kfree_skb_irq(skb);677679 return -EAGAIN;678680 }679681 /* @@@ should check alignment */···685683 (ATM_SKB(skb)->atm_options & ATM_ATMOPT_CLP ?686684 uPD98401_CLPM_1 : uPD98401_CLPM_0));687685 dsc[1] = 0;688688- dsc[2] = ATM_SKB(skb)->iovcnt*uPD98401_TXBD_SIZE;686686+ dsc[2] = ATM_SKB(skb)->iovcnt * uPD98401_TXBD_SIZE;689687 dsc[3] = virt_to_bus(put);690688 for (i = 0; i < ATM_SKB(skb)->iovcnt; i++) {691689 *put++ = ((struct iovec *) skb->data)[i].iov_len;
+1-2
drivers/net/irda/Kconfig
···11-21menu "Infrared-port device drivers"32 depends on IRDA!=n43···155156156157config DONGLE_OLD157158 bool "Old Serial dongle support"158158- depends on (IRTTY_OLD || IRPORT_SIR) && BROKEN_ON_SMP159159+ depends on IRPORT_SIR && BROKEN_ON_SMP159160 help160161 Say Y here if you have an infrared device that connects to your161162 computer's serial port. These devices are called dongles. Then say Y
+1-1
drivers/net/irda/Makefile
···4545obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o46464747# The SIR helper module4848-sir-dev-objs := sir_core.o sir_dev.o sir_dongle.o sir_kthread.o4848+sir-dev-objs := sir_dev.o sir_dongle.o sir_kthread.o
-2
drivers/net/irda/sir-dev.h
···133133134134extern void sirdev_enable_rx(struct sir_dev *dev);135135extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param);136136-extern int __init irda_thread_create(void);137137-extern void __exit irda_thread_join(void);138136139137/* inline helpers */140138
-56
drivers/net/irda/sir_core.c
···11-/*********************************************************************22- *33- * sir_core.c: module core for irda-sir abstraction layer44- *55- * Copyright (c) 2002 Martin Diehl66- * 77- * This program is free software; you can redistribute it and/or 88- * modify it under the terms of the GNU General Public License as 99- * published by the Free Software Foundation; either version 2 of 1010- * the License, or (at your option) any later version.1111- *1212- ********************************************************************/ 1313-1414-#include <linux/module.h>1515-#include <linux/kernel.h>1616-#include <linux/init.h>1717-1818-#include <net/irda/irda.h>1919-2020-#include "sir-dev.h"2121-2222-/***************************************************************************/2323-2424-MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");2525-MODULE_DESCRIPTION("IrDA SIR core");2626-MODULE_LICENSE("GPL");2727-2828-/***************************************************************************/2929-3030-EXPORT_SYMBOL(irda_register_dongle);3131-EXPORT_SYMBOL(irda_unregister_dongle);3232-3333-EXPORT_SYMBOL(sirdev_get_instance);3434-EXPORT_SYMBOL(sirdev_put_instance);3535-3636-EXPORT_SYMBOL(sirdev_set_dongle);3737-EXPORT_SYMBOL(sirdev_write_complete);3838-EXPORT_SYMBOL(sirdev_receive);3939-4040-EXPORT_SYMBOL(sirdev_raw_write);4141-EXPORT_SYMBOL(sirdev_raw_read);4242-EXPORT_SYMBOL(sirdev_set_dtr_rts);4343-4444-static int __init sir_core_init(void)4545-{4646- return irda_thread_create();4747-}4848-4949-static void __exit sir_core_exit(void)5050-{5151- irda_thread_join();5252-}5353-5454-module_init(sir_core_init);5555-module_exit(sir_core_exit);5656-
+9-1
drivers/net/irda/sir_dev.c
···6060 up(&dev->fsm.sem);6161 return err;6262}6363+EXPORT_SYMBOL(sirdev_set_dongle);63646465/* used by dongle drivers for dongle programming */6566···9594 spin_unlock_irqrestore(&dev->tx_lock, flags);9695 return ret;9796}9797+EXPORT_SYMBOL(sirdev_raw_write);98989999/* seems some dongle drivers may need this */100100···118116119117 return count;120118}119119+EXPORT_SYMBOL(sirdev_raw_read);121120122121int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)123122{···127124 ret = dev->drv->set_dtr_rts(dev, dtr, rts);128125 return ret;129126}130130-127127+EXPORT_SYMBOL(sirdev_set_dtr_rts);128128+131129/**********************************************************************/132130133131/* called from client driver - likely with bh-context - to indicate···231227done:232228 spin_unlock_irqrestore(&dev->tx_lock, flags);233229}230230+EXPORT_SYMBOL(sirdev_write_complete);234231235232/* called from client driver - likely with bh-context - to give us236233 * some more received bytes. We put them into the rx-buffer,···284279285280 return 0;286281}282282+EXPORT_SYMBOL(sirdev_receive);287283288284/**********************************************************************/289285···647641out:648642 return NULL;649643}644644+EXPORT_SYMBOL(sirdev_get_instance);650645651646int sirdev_put_instance(struct sir_dev *dev)652647{···680673681674 return 0;682675}676676+EXPORT_SYMBOL(sirdev_put_instance);683677
···214214 * This allows the VLAN to have a different MAC than the underlying215215 * device, and still route correctly.216216 */217217- if (memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN) == 0) {217217+ if (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {218218 /* It is for our (changed) MAC-address! */219219 skb->pkt_type = PACKET_HOST;220220 }
+2-2
net/atm/br2684.c
···296296 eth = eth_hdr(skb);297297298298 if (is_multicast_ether_addr(eth->h_dest)) {299299- if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)299299+ if (!compare_ether_addr(eth->h_dest, dev->broadcast))300300 skb->pkt_type = PACKET_BROADCAST;301301 else302302 skb->pkt_type = PACKET_MULTICAST;303303 }304304305305- else if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))305305+ else if (compare_ether_addr(eth->h_dest, dev->dev_addr))306306 skb->pkt_type = PACKET_OTHERHOST;307307308308 if (ntohs(eth->h_proto) >= 1536)
+3-3
net/atm/lec.c
···13211321 struct sk_buff *skb;13221322 struct lec_priv *priv = (struct lec_priv*)dev->priv;1323132313241324- if ( memcmp(lan_dst, dev->dev_addr, ETH_ALEN) != 0 )13241324+ if (compare_ether_addr(lan_dst, dev->dev_addr))13251325 return (0); /* not our mac address */1326132613271327 kfree(priv->tlvs); /* NULL if there was no previous association */···1798179817991799 to_return = priv->lec_arp_tables[place];18001800 while(to_return) {18011801- if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) {18011801+ if (!compare_ether_addr(mac_addr, to_return->mac_addr)) {18021802 return to_return;18031803 }18041804 to_return = to_return->next;···20022002 return priv->mcast_vcc;20032003 break;20042004 case 2: /* LANE2 wants arp for multicast addresses */20052005- if ( memcmp(mac_to_find, bus_mac, ETH_ALEN) == 0)20052005+ if (!compare_ether_addr(mac_to_find, bus_mac))20062006 return priv->mcast_vcc;20072007 break;20082008 default:
+1-1
net/atm/mpc.c
···552552 goto non_ip; /* Multi-Protocol Over ATM :-) */553553554554 while (i < mpc->number_of_mps_macs) {555555- if (memcmp(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN), ETH_ALEN) == 0)555555+ if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))556556 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */557557 return 0; /* success! */558558 i++;
+3-3
net/bluetooth/bnep/core.c
···75757676 list_for_each(p, &bnep_session_list) {7777 s = list_entry(p, struct bnep_session, list); 7878- if (!memcmp(dst, s->eh.h_source, ETH_ALEN))7878+ if (!compare_ether_addr(dst, s->eh.h_source))7979 return s;8080 }8181 return NULL;···420420 iv[il++] = (struct kvec) { &type, 1 };421421 len++;422422423423- if (!memcmp(eh->h_dest, s->eh.h_source, ETH_ALEN))423423+ if (!compare_ether_addr(eh->h_dest, s->eh.h_source))424424 type |= 0x01;425425426426- if (!memcmp(eh->h_source, s->eh.h_dest, ETH_ALEN))426426+ if (!compare_ether_addr(eh->h_source, s->eh.h_dest))427427 type |= 0x02;428428429429 if (type)
+1-1
net/bluetooth/hci_conn.c
···403403404404 size = sizeof(req) + req.conn_num * sizeof(*ci);405405406406- if (!(cl = (void *) kmalloc(size, GFP_KERNEL)))406406+ if (!(cl = kmalloc(size, GFP_KERNEL)))407407 return -ENOMEM;408408409409 if (!(hdev = hci_dev_get(req.dev_id))) {
···164164 if (datalen != len)165165 return -EINVAL;166166 /* Make sure the match only receives stp frames */167167- if (memcmp(e->destmac, bridge_ula, ETH_ALEN) ||168168- memcmp(e->destmsk, msk, ETH_ALEN) || !(e->bitmask & EBT_DESTMAC))167167+ if (compare_ether_addr(e->destmac, bridge_ula) ||168168+ compare_ether_addr(e->destmsk, msk) || !(e->bitmask & EBT_DESTMAC))169169 return -EINVAL;170170171171 return 0;
+1-1
net/core/dv.c
···457457 unsigned char *skb_data_end = skb->data + skb->len;458458459459 /* Packet is already aimed at us, return */460460- if (!memcmp(eth, skb->dev->dev_addr, ETH_ALEN))460460+ if (!compare_ether_addr(eth, skb->dev->dev_addr))461461 return;462462463463 /* proto is not IP, do nothing */
+1-1
net/core/wireless.c
···1506150615071507 /* Update all records that match */15081508 for(i = 0; i < spydata->spy_number; i++)15091509- if(!memcmp(address, spydata->spy_address[i], ETH_ALEN)) {15091509+ if(!compare_ether_addr(address, spydata->spy_address[i])) {15101510 memcpy(&(spydata->spy_stat[i]), wstats,15111511 sizeof(struct iw_quality));15121512 match = i;
+7-7
net/ieee80211/ieee80211_rx.c
···76767777 if (entry->skb != NULL && entry->seq == seq &&7878 (entry->last_frag + 1 == frag || frag == -1) &&7979- memcmp(entry->src_addr, src, ETH_ALEN) == 0 &&8080- memcmp(entry->dst_addr, dst, ETH_ALEN) == 0)7979+ !compare_ether_addr(entry->src_addr, src) &&8080+ !compare_ether_addr(entry->dst_addr, dst))8181 return entry;8282 }8383···243243 /* check that the frame is unicast frame to us */244244 if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==245245 IEEE80211_FCTL_TODS &&246246- memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 &&247247- memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {246246+ !compare_ether_addr(hdr->addr1, dev->dev_addr) &&247247+ !compare_ether_addr(hdr->addr3, dev->dev_addr)) {248248 /* ToDS frame with own addr BSSID and DA */249249 } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==250250 IEEE80211_FCTL_FROMDS &&251251- memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {251251+ !compare_ether_addr(hdr->addr1, dev->dev_addr)) {252252 /* FromDS frame with own addr as DA */253253 } else254254 return 0;···505505 if (ieee->iw_mode == IW_MODE_MASTER && !wds &&506506 (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==507507 IEEE80211_FCTL_FROMDS && ieee->stadev508508- && memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {508508+ && !compare_ether_addr(hdr->addr2, ieee->assoc_ap_addr)) {509509 /* Frame from BSSID of the AP for which we are a client */510510 skb->dev = dev = ieee->stadev;511511 stats = hostap_get_stats(dev);···12311231 * as one network */12321232 return ((src->ssid_len == dst->ssid_len) &&12331233 (src->channel == dst->channel) &&12341234- !memcmp(src->bssid, dst->bssid, ETH_ALEN) &&12341234+ !compare_ether_addr(src->bssid, dst->bssid) &&12351235 !memcmp(src->ssid, dst->ssid, src->ssid_len));12361236}12371237
···1212#include <linux/netfilter.h>1313#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>14141515-unsigned long ip_ct_generic_timeout = 600*HZ;1515+unsigned int ip_ct_generic_timeout = 600*HZ;16161717static int generic_pkt_to_tuple(const struct sk_buff *skb,1818 unsigned int dataoff,
+1-1
net/ipv4/netfilter/ip_conntrack_proto_icmp.c
···2222#include <linux/netfilter_ipv4/ip_conntrack_core.h>2323#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>24242525-unsigned long ip_ct_icmp_timeout = 30*HZ;2525+unsigned int ip_ct_icmp_timeout = 30*HZ;26262727#if 02828#define DEBUGP printk
+8-8
net/ipv4/netfilter/ip_conntrack_proto_sctp.c
···5858#define HOURS * 60 MINS5959#define DAYS * 24 HOURS60606161-static unsigned long ip_ct_sctp_timeout_closed = 10 SECS;6262-static unsigned long ip_ct_sctp_timeout_cookie_wait = 3 SECS;6363-static unsigned long ip_ct_sctp_timeout_cookie_echoed = 3 SECS;6464-static unsigned long ip_ct_sctp_timeout_established = 5 DAYS;6565-static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;6666-static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;6767-static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;6161+static unsigned int ip_ct_sctp_timeout_closed = 10 SECS;6262+static unsigned int ip_ct_sctp_timeout_cookie_wait = 3 SECS;6363+static unsigned int ip_ct_sctp_timeout_cookie_echoed = 3 SECS;6464+static unsigned int ip_ct_sctp_timeout_established = 5 DAYS;6565+static unsigned int ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;6666+static unsigned int ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;6767+static unsigned int ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;68686969-static const unsigned long * sctp_timeouts[]6969+static const unsigned int * sctp_timeouts[]7070= { NULL, /* SCTP_CONNTRACK_NONE */7171 &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */7272 &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
+10-10
net/ipv4/netfilter/ip_conntrack_proto_tcp.c
···8585#define HOURS * 60 MINS8686#define DAYS * 24 HOURS87878888-unsigned long ip_ct_tcp_timeout_syn_sent = 2 MINS;8989-unsigned long ip_ct_tcp_timeout_syn_recv = 60 SECS;9090-unsigned long ip_ct_tcp_timeout_established = 5 DAYS;9191-unsigned long ip_ct_tcp_timeout_fin_wait = 2 MINS;9292-unsigned long ip_ct_tcp_timeout_close_wait = 60 SECS;9393-unsigned long ip_ct_tcp_timeout_last_ack = 30 SECS;9494-unsigned long ip_ct_tcp_timeout_time_wait = 2 MINS;9595-unsigned long ip_ct_tcp_timeout_close = 10 SECS;8888+unsigned int ip_ct_tcp_timeout_syn_sent = 2 MINS;8989+unsigned int ip_ct_tcp_timeout_syn_recv = 60 SECS;9090+unsigned int ip_ct_tcp_timeout_established = 5 DAYS;9191+unsigned int ip_ct_tcp_timeout_fin_wait = 2 MINS;9292+unsigned int ip_ct_tcp_timeout_close_wait = 60 SECS;9393+unsigned int ip_ct_tcp_timeout_last_ack = 30 SECS;9494+unsigned int ip_ct_tcp_timeout_time_wait = 2 MINS;9595+unsigned int ip_ct_tcp_timeout_close = 10 SECS;96969797/* RFC1122 says the R2 limit should be at least 100 seconds.9898 Linux uses 15 packets as limit, which corresponds 9999 to ~13-30min depending on RTO. */100100-unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS;100100+unsigned int ip_ct_tcp_timeout_max_retrans = 5 MINS;101101102102-static const unsigned long * tcp_timeouts[]102102+static const unsigned int * tcp_timeouts[]103103= { NULL, /* TCP_CONNTRACK_NONE */104104 &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */105105 &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
+2-2
net/ipv4/netfilter/ip_conntrack_proto_udp.c
···1919#include <linux/netfilter_ipv4.h>2020#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>21212222-unsigned long ip_ct_udp_timeout = 30*HZ;2323-unsigned long ip_ct_udp_timeout_stream = 180*HZ;2222+unsigned int ip_ct_udp_timeout = 30*HZ;2323+unsigned int ip_ct_udp_timeout_stream = 180*HZ;24242525static int udp_pkt_to_tuple(const struct sk_buff *skb,2626 unsigned int dataoff,
+13-13
net/ipv4/netfilter/ip_conntrack_standalone.c
···544544extern unsigned int ip_conntrack_htable_size;545545546546/* From ip_conntrack_proto_tcp.c */547547-extern unsigned long ip_ct_tcp_timeout_syn_sent;548548-extern unsigned long ip_ct_tcp_timeout_syn_recv;549549-extern unsigned long ip_ct_tcp_timeout_established;550550-extern unsigned long ip_ct_tcp_timeout_fin_wait;551551-extern unsigned long ip_ct_tcp_timeout_close_wait;552552-extern unsigned long ip_ct_tcp_timeout_last_ack;553553-extern unsigned long ip_ct_tcp_timeout_time_wait;554554-extern unsigned long ip_ct_tcp_timeout_close;555555-extern unsigned long ip_ct_tcp_timeout_max_retrans;547547+extern unsigned int ip_ct_tcp_timeout_syn_sent;548548+extern unsigned int ip_ct_tcp_timeout_syn_recv;549549+extern unsigned int ip_ct_tcp_timeout_established;550550+extern unsigned int ip_ct_tcp_timeout_fin_wait;551551+extern unsigned int ip_ct_tcp_timeout_close_wait;552552+extern unsigned int ip_ct_tcp_timeout_last_ack;553553+extern unsigned int ip_ct_tcp_timeout_time_wait;554554+extern unsigned int ip_ct_tcp_timeout_close;555555+extern unsigned int ip_ct_tcp_timeout_max_retrans;556556extern int ip_ct_tcp_loose;557557extern int ip_ct_tcp_be_liberal;558558extern int ip_ct_tcp_max_retrans;559559560560/* From ip_conntrack_proto_udp.c */561561-extern unsigned long ip_ct_udp_timeout;562562-extern unsigned long ip_ct_udp_timeout_stream;561561+extern unsigned int ip_ct_udp_timeout;562562+extern unsigned int ip_ct_udp_timeout_stream;563563564564/* From ip_conntrack_proto_icmp.c */565565-extern unsigned long ip_ct_icmp_timeout;565565+extern unsigned int ip_ct_icmp_timeout;566566567567/* From ip_conntrack_proto_icmp.c */568568-extern unsigned long ip_ct_generic_timeout;568568+extern unsigned int ip_ct_generic_timeout;569569570570/* Log invalid packets of a given protocol */571571static int log_invalid_proto_min = 0;
+34-47
net/ipv4/netfilter/ip_nat_helper_pptp.c
···148148{149149 struct ip_ct_pptp_master *ct_pptp_info = &ct->help.ct_pptp_info;150150 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;151151-152152- u_int16_t msg, *cid = NULL, new_callid;151151+ u_int16_t msg, new_callid;152152+ unsigned int cid_off;153153154154 new_callid = htons(ct_pptp_info->pns_call_id);155155156156 switch (msg = ntohs(ctlh->messageType)) {157157 case PPTP_OUT_CALL_REQUEST:158158- cid = &pptpReq->ocreq.callID;158158+ cid_off = offsetof(union pptp_ctrl_union, ocreq.callID);159159 /* FIXME: ideally we would want to reserve a call ID160160 * here. current netfilter NAT core is not able to do161161 * this :( For now we use TCP source port. This breaks···172172 ct_pptp_info->pns_call_id = ntohs(new_callid);173173 break;174174 case PPTP_IN_CALL_REPLY:175175- cid = &pptpReq->icreq.callID;175175+ cid_off = offsetof(union pptp_ctrl_union, icreq.callID);176176 break;177177 case PPTP_CALL_CLEAR_REQUEST:178178- cid = &pptpReq->clrreq.callID;178178+ cid_off = offsetof(union pptp_ctrl_union, clrreq.callID);179179 break;180180 default:181181 DEBUGP("unknown outbound packet 0x%04x:%s\n", msg,···197197198198 /* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass199199 * down to here */200200-201201- IP_NF_ASSERT(cid);202202-203200 DEBUGP("altering call id from 0x%04x to 0x%04x\n",204204- ntohs(*cid), ntohs(new_callid));201201+ ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_callid));205202206203 /* mangle packet */207204 if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,208208- (void *)cid - ((void *)ctlh - sizeof(struct pptp_pkt_hdr)),209209- sizeof(new_callid), 210210- (char *)&new_callid,211211- sizeof(new_callid)) == 0)205205+ cid_off + sizeof(struct pptp_pkt_hdr) +206206+ sizeof(struct PptpControlHeader),207207+ sizeof(new_callid), (char *)&new_callid,208208+ sizeof(new_callid)) == 0)212209 return NF_DROP;213210214211 return NF_ACCEPT;···296299 union pptp_ctrl_union *pptpReq)297300{298301 struct ip_nat_pptp *nat_pptp_info = &ct->nat.help.nat_pptp_info;299299- u_int16_t msg, new_cid = 0, new_pcid, *pcid = NULL, *cid = NULL;300300-301301- int ret = NF_ACCEPT, rv;302302+ u_int16_t msg, new_cid = 0, new_pcid;303303+ unsigned int pcid_off, cid_off = 0;302304303305 new_pcid = htons(nat_pptp_info->pns_call_id);304306305307 switch (msg = ntohs(ctlh->messageType)) {306308 case PPTP_OUT_CALL_REPLY:307307- pcid = &pptpReq->ocack.peersCallID; 308308- cid = &pptpReq->ocack.callID;309309+ pcid_off = offsetof(union pptp_ctrl_union, ocack.peersCallID);310310+ cid_off = offsetof(union pptp_ctrl_union, ocack.callID);309311 break;310312 case PPTP_IN_CALL_CONNECT:311311- pcid = &pptpReq->iccon.peersCallID;313313+ pcid_off = offsetof(union pptp_ctrl_union, iccon.peersCallID);312314 break;313315 case PPTP_IN_CALL_REQUEST:314316 /* only need to nat in case PAC is behind NAT box */315315- break;317317+ return NF_ACCEPT;316318 case PPTP_WAN_ERROR_NOTIFY:317317- pcid = &pptpReq->wanerr.peersCallID;319319+ pcid_off = offsetof(union pptp_ctrl_union, wanerr.peersCallID);318320 break;319321 case PPTP_CALL_DISCONNECT_NOTIFY:320320- pcid = &pptpReq->disc.callID;322322+ pcid_off = offsetof(union pptp_ctrl_union, disc.callID);321323 break;322324 case PPTP_SET_LINK_INFO:323323- pcid = &pptpReq->setlink.peersCallID;325325+ pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID);324326 break;325327326328 default:···341345 * WAN_ERROR_NOTIFY, CALL_DISCONNECT_NOTIFY pass down here */342346343347 /* mangle packet */344344- IP_NF_ASSERT(pcid);345348 DEBUGP("altering peer call id from 0x%04x to 0x%04x\n",346346- ntohs(*pcid), ntohs(new_pcid));347347-348348- rv = ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, 349349- (void *)pcid - ((void *)ctlh - sizeof(struct pptp_pkt_hdr)),350350- sizeof(new_pcid), (char *)&new_pcid, 351351- sizeof(new_pcid));352352- if (rv != NF_ACCEPT) 353353- return rv;349349+ ntohs(*(u_int16_t *)pptpReq + pcid_off), ntohs(new_pcid));350350+351351+ if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,352352+ pcid_off + sizeof(struct pptp_pkt_hdr) +353353+ sizeof(struct PptpControlHeader),354354+ sizeof(new_pcid), (char *)&new_pcid,355355+ sizeof(new_pcid)) == 0)356356+ return NF_DROP;354357355358 if (new_cid) {356356- IP_NF_ASSERT(cid);357359 DEBUGP("altering call id from 0x%04x to 0x%04x\n",358358- ntohs(*cid), ntohs(new_cid));359359- rv = ip_nat_mangle_tcp_packet(pskb, ct, ctinfo, 360360- (void *)cid - ((void *)ctlh - sizeof(struct pptp_pkt_hdr)), 361361- sizeof(new_cid),362362- (char *)&new_cid, 363363- sizeof(new_cid));364364- if (rv != NF_ACCEPT)365365- return rv;360360+ ntohs(*(u_int16_t *)pptpReq + cid_off), ntohs(new_cid));361361+ if (ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,362362+ cid_off + sizeof(struct pptp_pkt_hdr) +363363+ sizeof(struct PptpControlHeader),364364+ sizeof(new_cid), (char *)&new_cid,365365+ sizeof(new_cid)) == 0)366366+ return NF_DROP;366367 }367367-368368- /* check for earlier return value of 'switch' above */369369- if (ret != NF_ACCEPT)370370- return ret;371371-372372- /* great, at least we don't need to resize packets */373368 return NF_ACCEPT;374369}375370
-38
net/ipv4/netfilter/ip_nat_proto_gre.c
···151151 return 1;152152}153153154154-/* print out a nat tuple */155155-static unsigned int 156156-gre_print(char *buffer, 157157- const struct ip_conntrack_tuple *match,158158- const struct ip_conntrack_tuple *mask)159159-{160160- unsigned int len = 0;161161-162162- if (mask->src.u.gre.key)163163- len += sprintf(buffer + len, "srckey=0x%x ", 164164- ntohl(match->src.u.gre.key));165165-166166- if (mask->dst.u.gre.key)167167- len += sprintf(buffer + len, "dstkey=0x%x ",168168- ntohl(match->src.u.gre.key));169169-170170- return len;171171-}172172-173173-/* print a range of keys */174174-static unsigned int 175175-gre_print_range(char *buffer, const struct ip_nat_range *range)176176-{177177- if (range->min.gre.key != 0 178178- || range->max.gre.key != 0xFFFF) {179179- if (range->min.gre.key == range->max.gre.key)180180- return sprintf(buffer, "key 0x%x ",181181- ntohl(range->min.gre.key));182182- else183183- return sprintf(buffer, "keys 0x%u-0x%u ",184184- ntohl(range->min.gre.key),185185- ntohl(range->max.gre.key));186186- } else187187- return 0;188188-}189189-190154/* nat helper struct */191155static struct ip_nat_protocol gre = { 192156 .name = "GRE", ···158194 .manip_pkt = gre_manip_pkt,159195 .in_range = gre_in_range,160196 .unique_tuple = gre_unique_tuple,161161- .print = gre_print,162162- .print_range = gre_print_range,163197#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \164198 defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)165199 .range_to_nfattr = ip_nat_port_range_to_nfattr,
···3434 return (skb->mac.raw >= skb->head3535 && (skb->mac.raw + ETH_HLEN) <= skb->data3636 /* If so, compare... */3737- && ((memcmp(eth_hdr(skb)->h_source, info->srcaddr, ETH_ALEN)3838- == 0) ^ info->invert));3737+ && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr))3838+ ^ info->invert));3939}40404141static int
+2-2
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
···335335#ifdef CONFIG_SYSCTL336336337337/* From nf_conntrack_proto_icmpv6.c */338338-extern unsigned long nf_ct_icmpv6_timeout;338338+extern unsigned int nf_ct_icmpv6_timeout;339339340340/* From nf_conntrack_frag6.c */341341-extern unsigned long nf_ct_frag6_timeout;341341+extern unsigned int nf_ct_frag6_timeout;342342extern unsigned int nf_ct_frag6_low_thresh;343343extern unsigned int nf_ct_frag6_high_thresh;344344
+1-1
net/netfilter/nf_conntrack_proto_generic.c
···1717#include <linux/netfilter.h>1818#include <net/netfilter/nf_conntrack_protocol.h>19192020-unsigned long nf_ct_generic_timeout = 600*HZ;2020+unsigned int nf_ct_generic_timeout = 600*HZ;21212222static int generic_pkt_to_tuple(const struct sk_buff *skb,2323 unsigned int dataoff,
+8-8
net/netfilter/nf_conntrack_proto_sctp.c
···6262#define HOURS * 60 MINS6363#define DAYS * 24 HOURS64646565-static unsigned long nf_ct_sctp_timeout_closed = 10 SECS;6666-static unsigned long nf_ct_sctp_timeout_cookie_wait = 3 SECS;6767-static unsigned long nf_ct_sctp_timeout_cookie_echoed = 3 SECS;6868-static unsigned long nf_ct_sctp_timeout_established = 5 DAYS;6969-static unsigned long nf_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;7070-static unsigned long nf_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;7171-static unsigned long nf_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;6565+static unsigned int nf_ct_sctp_timeout_closed = 10 SECS;6666+static unsigned int nf_ct_sctp_timeout_cookie_wait = 3 SECS;6767+static unsigned int nf_ct_sctp_timeout_cookie_echoed = 3 SECS;6868+static unsigned int nf_ct_sctp_timeout_established = 5 DAYS;6969+static unsigned int nf_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000;7070+static unsigned int nf_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000;7171+static unsigned int nf_ct_sctp_timeout_shutdown_ack_sent = 3 SECS;72727373-static unsigned long * sctp_timeouts[]7373+static unsigned int * sctp_timeouts[]7474= { NULL, /* SCTP_CONNTRACK_NONE */7575 &nf_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */7676 &nf_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
+10-10
net/netfilter/nf_conntrack_proto_tcp.c
···9393#define HOURS * 60 MINS9494#define DAYS * 24 HOURS95959696-unsigned long nf_ct_tcp_timeout_syn_sent = 2 MINS;9797-unsigned long nf_ct_tcp_timeout_syn_recv = 60 SECS;9898-unsigned long nf_ct_tcp_timeout_established = 5 DAYS;9999-unsigned long nf_ct_tcp_timeout_fin_wait = 2 MINS;100100-unsigned long nf_ct_tcp_timeout_close_wait = 60 SECS;101101-unsigned long nf_ct_tcp_timeout_last_ack = 30 SECS;102102-unsigned long nf_ct_tcp_timeout_time_wait = 2 MINS;103103-unsigned long nf_ct_tcp_timeout_close = 10 SECS;9696+unsigned int nf_ct_tcp_timeout_syn_sent = 2 MINS;9797+unsigned int nf_ct_tcp_timeout_syn_recv = 60 SECS;9898+unsigned int nf_ct_tcp_timeout_established = 5 DAYS;9999+unsigned int nf_ct_tcp_timeout_fin_wait = 2 MINS;100100+unsigned int nf_ct_tcp_timeout_close_wait = 60 SECS;101101+unsigned int nf_ct_tcp_timeout_last_ack = 30 SECS;102102+unsigned int nf_ct_tcp_timeout_time_wait = 2 MINS;103103+unsigned int nf_ct_tcp_timeout_close = 10 SECS;104104105105/* RFC1122 says the R2 limit should be at least 100 seconds.106106 Linux uses 15 packets as limit, which corresponds 107107 to ~13-30min depending on RTO. */108108-unsigned long nf_ct_tcp_timeout_max_retrans = 5 MINS;108108+unsigned int nf_ct_tcp_timeout_max_retrans = 5 MINS;109109110110-static unsigned long * tcp_timeouts[]110110+static unsigned int * tcp_timeouts[]111111= { NULL, /* TCP_CONNTRACK_NONE */112112 &nf_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */113113 &nf_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
+2-2
net/netfilter/nf_conntrack_proto_udp.c
···2727#include <linux/netfilter_ipv6.h>2828#include <net/netfilter/nf_conntrack_protocol.h>29293030-unsigned long nf_ct_udp_timeout = 30*HZ;3131-unsigned long nf_ct_udp_timeout_stream = 180*HZ;3030+unsigned int nf_ct_udp_timeout = 30*HZ;3131+unsigned int nf_ct_udp_timeout_stream = 180*HZ;32323333static int udp_pkt_to_tuple(const struct sk_buff *skb,3434 unsigned int dataoff,
+12-12
net/netfilter/nf_conntrack_standalone.c
···431431extern unsigned int nf_conntrack_htable_size;432432433433/* From nf_conntrack_proto_tcp.c */434434-extern unsigned long nf_ct_tcp_timeout_syn_sent;435435-extern unsigned long nf_ct_tcp_timeout_syn_recv;436436-extern unsigned long nf_ct_tcp_timeout_established;437437-extern unsigned long nf_ct_tcp_timeout_fin_wait;438438-extern unsigned long nf_ct_tcp_timeout_close_wait;439439-extern unsigned long nf_ct_tcp_timeout_last_ack;440440-extern unsigned long nf_ct_tcp_timeout_time_wait;441441-extern unsigned long nf_ct_tcp_timeout_close;442442-extern unsigned long nf_ct_tcp_timeout_max_retrans;434434+extern unsigned int nf_ct_tcp_timeout_syn_sent;435435+extern unsigned int nf_ct_tcp_timeout_syn_recv;436436+extern unsigned int nf_ct_tcp_timeout_established;437437+extern unsigned int nf_ct_tcp_timeout_fin_wait;438438+extern unsigned int nf_ct_tcp_timeout_close_wait;439439+extern unsigned int nf_ct_tcp_timeout_last_ack;440440+extern unsigned int nf_ct_tcp_timeout_time_wait;441441+extern unsigned int nf_ct_tcp_timeout_close;442442+extern unsigned int nf_ct_tcp_timeout_max_retrans;443443extern int nf_ct_tcp_loose;444444extern int nf_ct_tcp_be_liberal;445445extern int nf_ct_tcp_max_retrans;446446447447/* From nf_conntrack_proto_udp.c */448448-extern unsigned long nf_ct_udp_timeout;449449-extern unsigned long nf_ct_udp_timeout_stream;448448+extern unsigned int nf_ct_udp_timeout;449449+extern unsigned int nf_ct_udp_timeout_stream;450450451451/* From nf_conntrack_proto_generic.c */452452-extern unsigned long nf_ct_generic_timeout;452452+extern unsigned int nf_ct_generic_timeout;453453454454/* Log invalid packets of a given protocol */455455static int log_invalid_proto_min = 0;
+1-1
net/netlink/af_netlink.c
···14221422 while (skb->len >= nlmsg_total_size(0)) {14231423 nlh = (struct nlmsghdr *) skb->data;1424142414251425- if (skb->len < nlh->nlmsg_len)14251425+ if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len)14261426 return 0;1427142714281428 total_len = min(NLMSG_ALIGN(nlh->nlmsg_len), skb->len);