aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h111
-rw-r--r--include/linux/bcma/bcma_regs.h4
-rw-r--r--include/linux/etherdevice.h11
-rw-r--r--include/linux/ethtool.h17
-rw-r--r--include/linux/filter.h7
-rw-r--r--include/linux/hash.h10
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_link.h11
-rw-r--r--include/linux/if_team.h11
-rw-r--r--include/linux/if_tunnel.h3
-rw-r--r--include/linux/if_vlan.h9
-rw-r--r--include/linux/inet_diag.h1
-rw-r--r--include/linux/inetdevice.h11
-rw-r--r--include/linux/ip6_tunnel.h17
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/mdio.h83
-rw-r--r--include/linux/netdevice.h47
-rw-r--r--include/linux/netfilter.h14
-rw-r--r--include/linux/netfilter/ipset/ip_set.h15
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h106
-rw-r--r--include/linux/netfilter/nf_conntrack_amanda.h1
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h7
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h15
-rw-r--r--include/linux/netfilter/nf_conntrack_irc.h1
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h21
-rw-r--r--include/linux/netfilter/nf_nat.h8
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h8
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h1
-rw-r--r--include/linux/netfilter/xt_time.h5
-rw-r--r--include/linux/netfilter_ipv4.h1
-rw-r--r--include/linux/netfilter_ipv6/Kbuild1
-rw-r--r--include/linux/netfilter_ipv6/ip6t_NPT.h16
-rw-r--r--include/linux/netlink.h40
-rw-r--r--include/linux/nl80211.h30
-rw-r--r--include/linux/of_mdio.h33
-rw-r--r--include/linux/packet_diag.h72
-rw-r--r--include/linux/pps_kernel.h9
-rw-r--r--include/linux/ptp_clock_kernel.h21
-rw-r--r--include/linux/rfkill.h31
-rw-r--r--include/linux/sched.h3
-rw-r--r--include/linux/seq_file.h14
-rw-r--r--include/linux/skbuff.h9
-rw-r--r--include/linux/snmp.h16
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h4
-rw-r--r--include/linux/stmmac.h1
-rw-r--r--include/linux/tcp.h49
-rw-r--r--include/linux/tcp_metrics.h54
-rw-r--r--include/linux/tipc_config.h8
-rw-r--r--include/net/addrconf.h2
-rw-r--r--include/net/arp.h3
-rw-r--r--include/net/ax25.h4
-rw-r--r--include/net/bluetooth/bluetooth.h10
-rw-r--r--include/net/bluetooth/hci.h11
-rw-r--r--include/net/bluetooth/hci_core.h22
-rw-r--r--include/net/bluetooth/l2cap.h17
-rw-r--r--include/net/bluetooth/smp.h8
-rw-r--r--include/net/cfg80211.h43
-rw-r--r--include/net/checksum.h3
-rw-r--r--include/net/dst.h10
-rw-r--r--include/net/genetlink.h34
-rw-r--r--include/net/ieee80211_radiotap.h11
-rw-r--r--include/net/inet_ecn.h76
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--include/net/inet_sock.h4
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--include/net/ip6_tunnel.h41
-rw-r--r--include/net/ip_vs.h16
-rw-r--r--include/net/ipv6.h38
-rw-r--r--include/net/llc.h1
-rw-r--r--include/net/mac80211.h87
-rw-r--r--include/net/ndisc.h3
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/net_namespace.h15
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h32
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h20
-rw-r--r--include/net/netfilter/nf_nat.h6
-rw-r--r--include/net/netfilter/nf_nat_core.h5
-rw-r--r--include/net/netfilter/nf_nat_helper.h11
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h52
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h72
-rw-r--r--include/net/netfilter/nf_nat_protocol.h67
-rw-r--r--include/net/netfilter/nf_nat_rule.h15
-rw-r--r--include/net/netlink.h124
-rw-r--r--include/net/netns/conntrack.h4
-rw-r--r--include/net/netns/ipv4.h5
-rw-r--r--include/net/netns/ipv6.h9
-rw-r--r--include/net/netns/packet.h4
-rw-r--r--include/net/netns/sctp.h131
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/request_sock.h49
-rw-r--r--include/net/sch_generic.h3
-rw-r--r--include/net/scm.h25
-rw-r--r--include/net/sctp/sctp.h69
-rw-r--r--include/net/sctp/sm.h8
-rw-r--r--include/net/sctp/structs.h154
-rw-r--r--include/net/snmp.h10
-rw-r--r--include/net/sock.h40
-rw-r--r--include/net/tcp.h93
-rw-r--r--include/net/xfrm.h8
-rw-r--r--include/scsi/scsi_netlink.h24
105 files changed, 1861 insertions, 642 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index fa217607c582..90da0af28352 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -195,6 +195,7 @@ header-y += in_route.h
195header-y += sock_diag.h 195header-y += sock_diag.h
196header-y += inet_diag.h 196header-y += inet_diag.h
197header-y += unix_diag.h 197header-y += unix_diag.h
198header-y += packet_diag.h
198header-y += inotify.h 199header-y += inotify.h
199header-y += input.h 200header-y += input.h
200header-y += ioctl.h 201header-y += ioctl.h
@@ -362,6 +363,7 @@ header-y += sysctl.h
362header-y += sysinfo.h 363header-y += sysinfo.h
363header-y += taskstats.h 364header-y += taskstats.h
364header-y += tcp.h 365header-y += tcp.h
366header-y += tcp_metrics.h
365header-y += telephony.h 367header-y += telephony.h
366header-y += termios.h 368header-y += termios.h
367header-y += time.h 369header-y += time.h
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index d323a4b4143c..6ba45d2b99db 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -100,6 +100,7 @@
100#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */ 100#define BCMA_CC_CHIPST_4706_SFLASH_TYPE BIT(2) /* 0: 8b-p/ST-s flash, 1: 16b-p/Atmal-s flash */
101#define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ 101#define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */
102#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ 102#define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */
103#define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */
103#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ 104#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
104#define BCMA_CC_JCMD_START 0x80000000 105#define BCMA_CC_JCMD_START 0x80000000
105#define BCMA_CC_JCMD_BUSY 0x80000000 106#define BCMA_CC_JCMD_BUSY 0x80000000
@@ -266,6 +267,29 @@
266#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004 267#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004
267#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1 268#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1
268#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001 269#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001
270/* Block 0x140 - 0x190 registers are chipset specific */
271#define BCMA_CC_4706_FLASHSCFG 0x18C /* Flash struct configuration */
272#define BCMA_CC_4706_FLASHSCFG_MASK 0x000000ff
273#define BCMA_CC_4706_FLASHSCFG_SF1 0x00000001 /* 2nd serial flash present */
274#define BCMA_CC_4706_FLASHSCFG_PF1 0x00000002 /* 2nd parallel flash present */
275#define BCMA_CC_4706_FLASHSCFG_SF1_TYPE 0x00000004 /* 2nd serial flash type : 0 : ST, 1 : Atmel */
276#define BCMA_CC_4706_FLASHSCFG_NF1 0x00000008 /* 2nd NAND flash present */
277#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_MASK 0x000000f0
278#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_4MB 0x00000010 /* 4MB */
279#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_8MB 0x00000020 /* 8MB */
280#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_16MB 0x00000030 /* 16MB */
281#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_32MB 0x00000040 /* 32MB */
282#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_64MB 0x00000050 /* 64MB */
283#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_128MB 0x00000060 /* 128MB */
284#define BCMA_CC_4706_FLASHSCFG_1ST_MADDR_SEG_256MB 0x00000070 /* 256MB */
285/* NAND flash registers for BCM4706 (corerev = 31) */
286#define BCMA_CC_NFLASH_CTL 0x01A0
287#define BCMA_CC_NFLASH_CTL_ERR 0x08000000
288#define BCMA_CC_NFLASH_CONF 0x01A4
289#define BCMA_CC_NFLASH_COL_ADDR 0x01A8
290#define BCMA_CC_NFLASH_ROW_ADDR 0x01AC
291#define BCMA_CC_NFLASH_DATA 0x01B0
292#define BCMA_CC_NFLASH_WAITCNT0 0x01B4
269/* 0x1E0 is defined as shared BCMA_CLKCTLST */ 293/* 0x1E0 is defined as shared BCMA_CLKCTLST */
270#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ 294#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
271#define BCMA_CC_UART0_DATA 0x0300 295#define BCMA_CC_UART0_DATA 0x0300
@@ -325,6 +349,60 @@
325#define BCMA_CC_PLLCTL_ADDR 0x0660 349#define BCMA_CC_PLLCTL_ADDR 0x0660
326#define BCMA_CC_PLLCTL_DATA 0x0664 350#define BCMA_CC_PLLCTL_DATA 0x0664
327#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 351#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
352/* NAND flash MLC controller registers (corerev >= 38) */
353#define BCMA_CC_NAND_REVISION 0x0C00
354#define BCMA_CC_NAND_CMD_START 0x0C04
355#define BCMA_CC_NAND_CMD_ADDR_X 0x0C08
356#define BCMA_CC_NAND_CMD_ADDR 0x0C0C
357#define BCMA_CC_NAND_CMD_END_ADDR 0x0C10
358#define BCMA_CC_NAND_CS_NAND_SELECT 0x0C14
359#define BCMA_CC_NAND_CS_NAND_XOR 0x0C18
360#define BCMA_CC_NAND_SPARE_RD0 0x0C20
361#define BCMA_CC_NAND_SPARE_RD4 0x0C24
362#define BCMA_CC_NAND_SPARE_RD8 0x0C28
363#define BCMA_CC_NAND_SPARE_RD12 0x0C2C
364#define BCMA_CC_NAND_SPARE_WR0 0x0C30
365#define BCMA_CC_NAND_SPARE_WR4 0x0C34
366#define BCMA_CC_NAND_SPARE_WR8 0x0C38
367#define BCMA_CC_NAND_SPARE_WR12 0x0C3C
368#define BCMA_CC_NAND_ACC_CONTROL 0x0C40
369#define BCMA_CC_NAND_CONFIG 0x0C48
370#define BCMA_CC_NAND_TIMING_1 0x0C50
371#define BCMA_CC_NAND_TIMING_2 0x0C54
372#define BCMA_CC_NAND_SEMAPHORE 0x0C58
373#define BCMA_CC_NAND_DEVID 0x0C60
374#define BCMA_CC_NAND_DEVID_X 0x0C64
375#define BCMA_CC_NAND_BLOCK_LOCK_STATUS 0x0C68
376#define BCMA_CC_NAND_INTFC_STATUS 0x0C6C
377#define BCMA_CC_NAND_ECC_CORR_ADDR_X 0x0C70
378#define BCMA_CC_NAND_ECC_CORR_ADDR 0x0C74
379#define BCMA_CC_NAND_ECC_UNC_ADDR_X 0x0C78
380#define BCMA_CC_NAND_ECC_UNC_ADDR 0x0C7C
381#define BCMA_CC_NAND_READ_ERROR_COUNT 0x0C80
382#define BCMA_CC_NAND_CORR_STAT_THRESHOLD 0x0C84
383#define BCMA_CC_NAND_READ_ADDR_X 0x0C90
384#define BCMA_CC_NAND_READ_ADDR 0x0C94
385#define BCMA_CC_NAND_PAGE_PROGRAM_ADDR_X 0x0C98
386#define BCMA_CC_NAND_PAGE_PROGRAM_ADDR 0x0C9C
387#define BCMA_CC_NAND_COPY_BACK_ADDR_X 0x0CA0
388#define BCMA_CC_NAND_COPY_BACK_ADDR 0x0CA4
389#define BCMA_CC_NAND_BLOCK_ERASE_ADDR_X 0x0CA8
390#define BCMA_CC_NAND_BLOCK_ERASE_ADDR 0x0CAC
391#define BCMA_CC_NAND_INV_READ_ADDR_X 0x0CB0
392#define BCMA_CC_NAND_INV_READ_ADDR 0x0CB4
393#define BCMA_CC_NAND_BLK_WR_PROTECT 0x0CC0
394#define BCMA_CC_NAND_ACC_CONTROL_CS1 0x0CD0
395#define BCMA_CC_NAND_CONFIG_CS1 0x0CD4
396#define BCMA_CC_NAND_TIMING_1_CS1 0x0CD8
397#define BCMA_CC_NAND_TIMING_2_CS1 0x0CDC
398#define BCMA_CC_NAND_SPARE_RD16 0x0D30
399#define BCMA_CC_NAND_SPARE_RD20 0x0D34
400#define BCMA_CC_NAND_SPARE_RD24 0x0D38
401#define BCMA_CC_NAND_SPARE_RD28 0x0D3C
402#define BCMA_CC_NAND_CACHE_ADDR 0x0D40
403#define BCMA_CC_NAND_CACHE_DATA 0x0D44
404#define BCMA_CC_NAND_CTRL_CONFIG 0x0D48
405#define BCMA_CC_NAND_CTRL_STATUS 0x0D4C
328 406
329/* Divider allocation in 4716/47162/5356 */ 407/* Divider allocation in 4716/47162/5356 */
330#define BCMA_CC_PMU5_MAINPLL_CPU 1 408#define BCMA_CC_PMU5_MAINPLL_CPU 1
@@ -415,6 +493,13 @@
415/* 4313 Chip specific ChipControl register bits */ 493/* 4313 Chip specific ChipControl register bits */
416#define BCMA_CCTRL_4313_12MA_LED_DRIVE 0x00000007 /* 12 mA drive strengh for later 4313 */ 494#define BCMA_CCTRL_4313_12MA_LED_DRIVE 0x00000007 /* 12 mA drive strengh for later 4313 */
417 495
496/* BCM5357 ChipControl register bits */
497#define BCMA_CHIPCTL_5357_EXTPA BIT(14)
498#define BCMA_CHIPCTL_5357_ANT_MUX_2O3 BIT(15)
499#define BCMA_CHIPCTL_5357_NFLASH BIT(16)
500#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18)
501#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19)
502
418/* Data for the PMU, if available. 503/* Data for the PMU, if available.
419 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 504 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
420 */ 505 */
@@ -430,6 +515,26 @@ struct bcma_pflash {
430 u32 window_size; 515 u32 window_size;
431}; 516};
432 517
518#ifdef CONFIG_BCMA_SFLASH
519struct bcma_sflash {
520 bool present;
521 u32 window;
522 u32 blocksize;
523 u16 numblocks;
524 u32 size;
525};
526#endif
527
528#ifdef CONFIG_BCMA_NFLASH
529struct mtd_info;
530
531struct bcma_nflash {
532 bool present;
533
534 struct mtd_info *mtd;
535};
536#endif
537
433struct bcma_serial_port { 538struct bcma_serial_port {
434 void *regs; 539 void *regs;
435 unsigned long clockspeed; 540 unsigned long clockspeed;
@@ -450,6 +555,12 @@ struct bcma_drv_cc {
450 struct bcma_chipcommon_pmu pmu; 555 struct bcma_chipcommon_pmu pmu;
451#ifdef CONFIG_BCMA_DRIVER_MIPS 556#ifdef CONFIG_BCMA_DRIVER_MIPS
452 struct bcma_pflash pflash; 557 struct bcma_pflash pflash;
558#ifdef CONFIG_BCMA_SFLASH
559 struct bcma_sflash sflash;
560#endif
561#ifdef CONFIG_BCMA_NFLASH
562 struct bcma_nflash nflash;
563#endif
453 564
454 int nr_serial_ports; 565 int nr_serial_ports;
455 struct bcma_serial_port serial_ports[4]; 566 struct bcma_serial_port serial_ports[4];
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 5a71d5719640..6c9cb93ae3de 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -11,11 +11,13 @@
11#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ 11#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
12#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ 12#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
13#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */ 13#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */
14#define BCMA_CLKCTLST_EXTRESREQ_SHIFT 8
14#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */ 15#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
15#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */ 16#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */
16#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */ 17#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */
17#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */ 18#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */
18#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */ 19#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */
20#define BCMA_CLKCTLST_EXTRESST_SHIFT 24
19/* Is there any BCM4328 on BCMA bus? */ 21/* Is there any BCM4328 on BCMA bus? */
20#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */ 22#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
21#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */ 23#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
@@ -83,4 +85,6 @@
83 * (2 ZettaBytes), high 32 bits 85 * (2 ZettaBytes), high 32 bits
84 */ 86 */
85 87
88#define BCMA_SFLASH 0x1c000000
89
86#endif /* LINUX_BCMA_REGS_H_ */ 90#endif /* LINUX_BCMA_REGS_H_ */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index d426336d92d9..b006ba0a9f42 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -151,6 +151,17 @@ static inline void eth_broadcast_addr(u8 *addr)
151} 151}
152 152
153/** 153/**
154 * eth_zero_addr - Assign zero address
155 * @addr: Pointer to a six-byte array containing the Ethernet address
156 *
157 * Assign the zero address to the given address array.
158 */
159static inline void eth_zero_addr(u8 *addr)
160{
161 memset(addr, 0x00, ETH_ALEN);
162}
163
164/**
154 * eth_hw_addr_random - Generate software assigned random Ethernet and 165 * eth_hw_addr_random - Generate software assigned random Ethernet and
155 * set device flag 166 * set device flag
156 * @dev: pointer to net_device structure 167 * @dev: pointer to net_device structure
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 21eff418091b..fcb4f8e60c1c 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -45,8 +45,10 @@ struct ethtool_cmd {
45 * bits) in Mbps. Please use 45 * bits) in Mbps. Please use
46 * ethtool_cmd_speed()/_set() to 46 * ethtool_cmd_speed()/_set() to
47 * access it */ 47 * access it */
48 __u8 eth_tp_mdix; 48 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
49 __u8 reserved2; 49 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
50 * link should be renegotiated if necessary
51 */
50 __u32 lp_advertising; /* Features the link partner advertises */ 52 __u32 lp_advertising; /* Features the link partner advertises */
51 __u32 reserved[2]; 53 __u32 reserved[2];
52}; 54};
@@ -1229,10 +1231,13 @@ struct ethtool_ops {
1229#define AUTONEG_DISABLE 0x00 1231#define AUTONEG_DISABLE 0x00
1230#define AUTONEG_ENABLE 0x01 1232#define AUTONEG_ENABLE 0x01
1231 1233
1232/* Mode MDI or MDI-X */ 1234/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
1233#define ETH_TP_MDI_INVALID 0x00 1235 * the driver is required to renegotiate link
1234#define ETH_TP_MDI 0x01 1236 */
1235#define ETH_TP_MDI_X 0x02 1237#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
1238#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
1239#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
1240#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
1236 1241
1237/* Wake-On-Lan options. */ 1242/* Wake-On-Lan options. */
1238#define WAKE_PHY (1 << 0) 1243#define WAKE_PHY (1 << 0)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 82b01357af8b..2ded090e10f4 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -74,6 +74,9 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
74#define BPF_LSH 0x60 74#define BPF_LSH 0x60
75#define BPF_RSH 0x70 75#define BPF_RSH 0x70
76#define BPF_NEG 0x80 76#define BPF_NEG 0x80
77#define BPF_MOD 0x90
78#define BPF_XOR 0xa0
79
77#define BPF_JA 0x00 80#define BPF_JA 0x00
78#define BPF_JEQ 0x10 81#define BPF_JEQ 0x10
79#define BPF_JGT 0x20 82#define BPF_JGT 0x20
@@ -196,10 +199,14 @@ enum {
196 BPF_S_ALU_MUL_K, 199 BPF_S_ALU_MUL_K,
197 BPF_S_ALU_MUL_X, 200 BPF_S_ALU_MUL_X,
198 BPF_S_ALU_DIV_X, 201 BPF_S_ALU_DIV_X,
202 BPF_S_ALU_MOD_K,
203 BPF_S_ALU_MOD_X,
199 BPF_S_ALU_AND_K, 204 BPF_S_ALU_AND_K,
200 BPF_S_ALU_AND_X, 205 BPF_S_ALU_AND_X,
201 BPF_S_ALU_OR_K, 206 BPF_S_ALU_OR_K,
202 BPF_S_ALU_OR_X, 207 BPF_S_ALU_OR_X,
208 BPF_S_ALU_XOR_K,
209 BPF_S_ALU_XOR_X,
203 BPF_S_ALU_LSH_K, 210 BPF_S_ALU_LSH_K,
204 BPF_S_ALU_LSH_X, 211 BPF_S_ALU_LSH_X,
205 BPF_S_ALU_RSH_K, 212 BPF_S_ALU_RSH_K,
diff --git a/include/linux/hash.h b/include/linux/hash.h
index b80506bdd733..24df9e70406f 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -67,4 +67,14 @@ static inline unsigned long hash_ptr(const void *ptr, unsigned int bits)
67{ 67{
68 return hash_long((unsigned long)ptr, bits); 68 return hash_long((unsigned long)ptr, bits);
69} 69}
70
71static inline u32 hash32_ptr(const void *ptr)
72{
73 unsigned long val = (unsigned long)ptr;
74
75#if BITS_PER_LONG == 64
76 val ^= (val >> 32);
77#endif
78 return (u32)val;
79}
70#endif /* _LINUX_HASH_H */ 80#endif /* _LINUX_HASH_H */
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index f0e69c6e8208..9adcc29f084a 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -92,6 +92,7 @@
92#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */ 94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
95 96
96#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
97#define ARPHRD_NONE 0xFFFE /* zero header length */ 98#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index ac173bd2ab65..24c0dd09af54 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -398,4 +398,15 @@ struct ifla_port_vsi {
398 __u8 pad[3]; 398 __u8 pad[3];
399}; 399};
400 400
401
402/* IPoIB section */
403
404enum {
405 IFLA_IPOIB_UNSPEC,
406 IFLA_IPOIB_PKEY,
407 __IFLA_IPOIB_MAX
408};
409
410#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
411
401#endif /* _LINUX_IF_LINK_H */ 412#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index aa2e167e1ef4..6d88a7f57680 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -67,6 +67,9 @@ struct team_port {
67 struct netpoll *np; 67 struct netpoll *np;
68#endif 68#endif
69 69
70 s32 priority; /* lower number ~ higher priority */
71 u16 queue_id;
72 struct list_head qom_list; /* node in queue override mapping list */
70 long mode_priv[0]; 73 long mode_priv[0];
71}; 74};
72 75
@@ -105,7 +108,7 @@ struct team_mode_ops {
105 bool (*transmit)(struct team *team, struct sk_buff *skb); 108 bool (*transmit)(struct team *team, struct sk_buff *skb);
106 int (*port_enter)(struct team *team, struct team_port *port); 109 int (*port_enter)(struct team *team, struct team_port *port);
107 void (*port_leave)(struct team *team, struct team_port *port); 110 void (*port_leave)(struct team *team, struct team_port *port);
108 void (*port_change_mac)(struct team *team, struct team_port *port); 111 void (*port_change_dev_addr)(struct team *team, struct team_port *port);
109 void (*port_enabled)(struct team *team, struct team_port *port); 112 void (*port_enabled)(struct team *team, struct team_port *port);
110 void (*port_disabled)(struct team *team, struct team_port *port); 113 void (*port_disabled)(struct team *team, struct team_port *port);
111}; 114};
@@ -115,6 +118,7 @@ enum team_option_type {
115 TEAM_OPTION_TYPE_STRING, 118 TEAM_OPTION_TYPE_STRING,
116 TEAM_OPTION_TYPE_BINARY, 119 TEAM_OPTION_TYPE_BINARY,
117 TEAM_OPTION_TYPE_BOOL, 120 TEAM_OPTION_TYPE_BOOL,
121 TEAM_OPTION_TYPE_S32,
118}; 122};
119 123
120struct team_option_inst_info { 124struct team_option_inst_info {
@@ -131,6 +135,7 @@ struct team_gsetter_ctx {
131 u32 len; 135 u32 len;
132 } bin_val; 136 } bin_val;
133 bool bool_val; 137 bool bool_val;
138 s32 s32_val;
134 } data; 139 } data;
135 struct team_option_inst_info *info; 140 struct team_option_inst_info *info;
136}; 141};
@@ -182,6 +187,8 @@ struct team {
182 187
183 const struct team_mode *mode; 188 const struct team_mode *mode;
184 struct team_mode_ops ops; 189 struct team_mode_ops ops;
190 bool queue_override_enabled;
191 struct list_head *qom_lists; /* array of queue override mapping lists */
185 long mode_priv[TEAM_MODE_PRIV_LONGS]; 192 long mode_priv[TEAM_MODE_PRIV_LONGS];
186}; 193};
187 194
@@ -231,7 +238,7 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
231 return NULL; 238 return NULL;
232} 239}
233 240
234extern int team_port_set_team_mac(struct team_port *port); 241extern int team_port_set_team_dev_addr(struct team_port *port);
235extern int team_options_register(struct team *team, 242extern int team_options_register(struct team *team,
236 const struct team_option *option, 243 const struct team_option *option,
237 size_t option_count); 244 size_t option_count);
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5efff60b6f56..8c5035ac3142 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -75,6 +75,9 @@ enum {
75 IFLA_GRE_TTL, 75 IFLA_GRE_TTL,
76 IFLA_GRE_TOS, 76 IFLA_GRE_TOS,
77 IFLA_GRE_PMTUDISC, 77 IFLA_GRE_PMTUDISC,
78 IFLA_GRE_ENCAP_LIMIT,
79 IFLA_GRE_FLOWINFO,
80 IFLA_GRE_FLAGS,
78 __IFLA_GRE_MAX, 81 __IFLA_GRE_MAX,
79}; 82};
80 83
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a810987cb80e..e6ff12dd717b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -74,8 +74,6 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
74/* found in socket.c */ 74/* found in socket.c */
75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 76
77struct vlan_info;
78
79static inline int is_vlan_dev(struct net_device *dev) 77static inline int is_vlan_dev(struct net_device *dev)
80{ 78{
81 return dev->priv_flags & IFF_802_1Q_VLAN; 79 return dev->priv_flags & IFF_802_1Q_VLAN;
@@ -101,6 +99,8 @@ extern int vlan_vids_add_by_dev(struct net_device *dev,
101 const struct net_device *by_dev); 99 const struct net_device *by_dev);
102extern void vlan_vids_del_by_dev(struct net_device *dev, 100extern void vlan_vids_del_by_dev(struct net_device *dev,
103 const struct net_device *by_dev); 101 const struct net_device *by_dev);
102
103extern bool vlan_uses_dev(const struct net_device *dev);
104#else 104#else
105static inline struct net_device * 105static inline struct net_device *
106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) 106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
@@ -151,6 +151,11 @@ static inline void vlan_vids_del_by_dev(struct net_device *dev,
151 const struct net_device *by_dev) 151 const struct net_device *by_dev)
152{ 152{
153} 153}
154
155static inline bool vlan_uses_dev(const struct net_device *dev)
156{
157 return false;
158}
154#endif 159#endif
155 160
156/** 161/**
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index f1362b5447fc..e788c186ed3a 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -159,6 +159,7 @@ struct inet_diag_handler {
159struct inet_connection_sock; 159struct inet_connection_sock;
160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req_v2 *req, 161 struct sk_buff *skb, struct inet_diag_req_v2 *req,
162 struct user_namespace *user_ns,
162 u32 pid, u32 seq, u16 nlmsg_flags, 163 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh); 164 const struct nlmsghdr *unlh);
164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 165void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 67f9ddacb70c..d032780d0ce5 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -104,9 +104,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
104#define IN_DEV_ANDCONF(in_dev, attr) \ 104#define IN_DEV_ANDCONF(in_dev, attr) \
105 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ 105 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
106 IN_DEV_CONF_GET((in_dev), attr)) 106 IN_DEV_CONF_GET((in_dev), attr))
107#define IN_DEV_ORCONF(in_dev, attr) \ 107
108 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \ 108#define IN_DEV_NET_ORCONF(in_dev, net, attr) \
109 (IPV4_DEVCONF_ALL(net, attr) || \
109 IN_DEV_CONF_GET((in_dev), attr)) 110 IN_DEV_CONF_GET((in_dev), attr))
111
112#define IN_DEV_ORCONF(in_dev, attr) \
113 IN_DEV_NET_ORCONF(in_dev, dev_net(in_dev->dev), attr)
114
110#define IN_DEV_MAXCONF(in_dev, attr) \ 115#define IN_DEV_MAXCONF(in_dev, attr) \
111 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ 116 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
112 IN_DEV_CONF_GET((in_dev), attr))) 117 IN_DEV_CONF_GET((in_dev), attr)))
@@ -133,6 +138,8 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
133 IN_DEV_ORCONF((in_dev), \ 138 IN_DEV_ORCONF((in_dev), \
134 PROMOTE_SECONDARIES) 139 PROMOTE_SECONDARIES)
135#define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET) 140#define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET)
141#define IN_DEV_NET_ROUTE_LOCALNET(in_dev, net) \
142 IN_DEV_NET_ORCONF(in_dev, net, ROUTE_LOCALNET)
136 143
137#define IN_DEV_RX_REDIRECTS(in_dev) \ 144#define IN_DEV_RX_REDIRECTS(in_dev) \
138 ((IN_DEV_FORWARD(in_dev) && \ 145 ((IN_DEV_FORWARD(in_dev) && \
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index bf22b0317902..48af63c9a48d 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -31,4 +31,21 @@ struct ip6_tnl_parm {
31 struct in6_addr raddr; /* remote tunnel end-point address */ 31 struct in6_addr raddr; /* remote tunnel end-point address */
32}; 32};
33 33
34struct ip6_tnl_parm2 {
35 char name[IFNAMSIZ]; /* name of tunnel device */
36 int link; /* ifindex of underlying L2 interface */
37 __u8 proto; /* tunnel protocol */
38 __u8 encap_limit; /* encapsulation limit for tunnel */
39 __u8 hop_limit; /* hop limit for tunnel */
40 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
41 __u32 flags; /* tunnel flags */
42 struct in6_addr laddr; /* local tunnel end-point address */
43 struct in6_addr raddr; /* remote tunnel end-point address */
44
45 __be16 i_flags;
46 __be16 o_flags;
47 __be32 i_key;
48 __be32 o_key;
49};
50
34#endif 51#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 879db26ec401..0b94e91ed685 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -256,6 +256,7 @@ struct inet6_skb_parm {
256#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 256#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
257 __u16 dsthao; 257 __u16 dsthao;
258#endif 258#endif
259 __u16 frag_max_size;
259 260
260#define IP6SKB_XFRM_TRANSFORMED 1 261#define IP6SKB_XFRM_TRANSFORMED 1
261#define IP6SKB_FORWARDED 2 262#define IP6SKB_FORWARDED 2
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 82680541576d..05e3c2c7a8cf 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -312,7 +312,13 @@ extern void jiffies_to_timespec(const unsigned long jiffies,
312extern unsigned long timeval_to_jiffies(const struct timeval *value); 312extern unsigned long timeval_to_jiffies(const struct timeval *value);
313extern void jiffies_to_timeval(const unsigned long jiffies, 313extern void jiffies_to_timeval(const unsigned long jiffies,
314 struct timeval *value); 314 struct timeval *value);
315
315extern clock_t jiffies_to_clock_t(unsigned long x); 316extern clock_t jiffies_to_clock_t(unsigned long x);
317static inline clock_t jiffies_delta_to_clock_t(long delta)
318{
319 return jiffies_to_clock_t(max(0L, delta));
320}
321
316extern unsigned long clock_t_to_jiffies(unsigned long x); 322extern unsigned long clock_t_to_jiffies(unsigned long x);
317extern u64 jiffies_64_to_clock_t(u64 x); 323extern u64 jiffies_64_to_clock_t(u64 x);
318extern u64 nsec_to_clock_t(u64 x); 324extern u64 nsec_to_clock_t(u64 x);
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 7cccafe50e7b..6c406845f7e2 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -377,5 +377,88 @@ static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio,
377extern int mdio_mii_ioctl(const struct mdio_if_info *mdio, 377extern int mdio_mii_ioctl(const struct mdio_if_info *mdio,
378 struct mii_ioctl_data *mii_data, int cmd); 378 struct mii_ioctl_data *mii_data, int cmd);
379 379
380/**
381 * mmd_eee_cap_to_ethtool_sup_t
382 * @eee_cap: value of the MMD EEE Capability register
383 *
384 * A small helper function that translates MMD EEE Capability (3.20) bits
385 * to ethtool supported settings.
386 */
387static inline u32 mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap)
388{
389 u32 supported = 0;
390
391 if (eee_cap & MDIO_EEE_100TX)
392 supported |= SUPPORTED_100baseT_Full;
393 if (eee_cap & MDIO_EEE_1000T)
394 supported |= SUPPORTED_1000baseT_Full;
395 if (eee_cap & MDIO_EEE_10GT)
396 supported |= SUPPORTED_10000baseT_Full;
397 if (eee_cap & MDIO_EEE_1000KX)
398 supported |= SUPPORTED_1000baseKX_Full;
399 if (eee_cap & MDIO_EEE_10GKX4)
400 supported |= SUPPORTED_10000baseKX4_Full;
401 if (eee_cap & MDIO_EEE_10GKR)
402 supported |= SUPPORTED_10000baseKR_Full;
403
404 return supported;
405}
406
407/**
408 * mmd_eee_adv_to_ethtool_adv_t
409 * @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers
410 *
411 * A small helper function that translates the MMD EEE Advertisment (7.60)
412 * and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
413 * settings.
414 */
415static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
416{
417 u32 adv = 0;
418
419 if (eee_adv & MDIO_EEE_100TX)
420 adv |= ADVERTISED_100baseT_Full;
421 if (eee_adv & MDIO_EEE_1000T)
422 adv |= ADVERTISED_1000baseT_Full;
423 if (eee_adv & MDIO_EEE_10GT)
424 adv |= ADVERTISED_10000baseT_Full;
425 if (eee_adv & MDIO_EEE_1000KX)
426 adv |= ADVERTISED_1000baseKX_Full;
427 if (eee_adv & MDIO_EEE_10GKX4)
428 adv |= ADVERTISED_10000baseKX4_Full;
429 if (eee_adv & MDIO_EEE_10GKR)
430 adv |= ADVERTISED_10000baseKR_Full;
431
432 return adv;
433}
434
435/**
436 * ethtool_adv_to_mmd_eee_adv_t
437 * @adv: the ethtool advertisement settings
438 *
439 * A small helper function that translates ethtool advertisement settings
440 * to EEE advertisements for the MMD EEE Advertisement (7.60) and
441 * MMD EEE Link Partner Ability (7.61) registers.
442 */
443static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
444{
445 u16 reg = 0;
446
447 if (adv & ADVERTISED_100baseT_Full)
448 reg |= MDIO_EEE_100TX;
449 if (adv & ADVERTISED_1000baseT_Full)
450 reg |= MDIO_EEE_1000T;
451 if (adv & ADVERTISED_10000baseT_Full)
452 reg |= MDIO_EEE_10GT;
453 if (adv & ADVERTISED_1000baseKX_Full)
454 reg |= MDIO_EEE_1000KX;
455 if (adv & ADVERTISED_10000baseKX4_Full)
456 reg |= MDIO_EEE_10GKX4;
457 if (adv & ADVERTISED_10000baseKR_Full)
458 reg |= MDIO_EEE_10GKR;
459
460 return reg;
461}
462
380#endif /* __KERNEL__ */ 463#endif /* __KERNEL__ */
381#endif /* __LINUX_MDIO_H__ */ 464#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 59dc05f38247..dd320bb22a5a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -338,18 +338,16 @@ struct napi_struct {
338 338
339 unsigned long state; 339 unsigned long state;
340 int weight; 340 int weight;
341 unsigned int gro_count;
341 int (*poll)(struct napi_struct *, int); 342 int (*poll)(struct napi_struct *, int);
342#ifdef CONFIG_NETPOLL 343#ifdef CONFIG_NETPOLL
343 spinlock_t poll_lock; 344 spinlock_t poll_lock;
344 int poll_owner; 345 int poll_owner;
345#endif 346#endif
346
347 unsigned int gro_count;
348
349 struct net_device *dev; 347 struct net_device *dev;
350 struct list_head dev_list;
351 struct sk_buff *gro_list; 348 struct sk_buff *gro_list;
352 struct sk_buff *skb; 349 struct sk_buff *skb;
350 struct list_head dev_list;
353}; 351};
354 352
355enum { 353enum {
@@ -907,10 +905,10 @@ struct netdev_fcoe_hbainfo {
907 * Must return >0 or -errno if it changed dev->features itself. 905 * Must return >0 or -errno if it changed dev->features itself.
908 * 906 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, 907 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
910 * unsigned char *addr, u16 flags) 908 * const unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr. 909 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 910 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr) 911 * const unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr. 912 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 913 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx) 914 * struct net_device *dev, int idx)
@@ -1017,11 +1015,11 @@ struct net_device_ops {
1017 1015
1018 int (*ndo_fdb_add)(struct ndmsg *ndm, 1016 int (*ndo_fdb_add)(struct ndmsg *ndm,
1019 struct net_device *dev, 1017 struct net_device *dev,
1020 unsigned char *addr, 1018 const unsigned char *addr,
1021 u16 flags); 1019 u16 flags);
1022 int (*ndo_fdb_del)(struct ndmsg *ndm, 1020 int (*ndo_fdb_del)(struct ndmsg *ndm,
1023 struct net_device *dev, 1021 struct net_device *dev,
1024 unsigned char *addr); 1022 const unsigned char *addr);
1025 int (*ndo_fdb_dump)(struct sk_buff *skb, 1023 int (*ndo_fdb_dump)(struct sk_buff *skb,
1026 struct netlink_callback *cb, 1024 struct netlink_callback *cb,
1027 struct net_device *dev, 1025 struct net_device *dev,
@@ -1322,6 +1320,8 @@ struct net_device {
1322 /* phy device may attach itself for hardware timestamping */ 1320 /* phy device may attach itself for hardware timestamping */
1323 struct phy_device *phydev; 1321 struct phy_device *phydev;
1324 1322
1323 struct lock_class_key *qdisc_tx_busylock;
1324
1325 /* group the device belongs to */ 1325 /* group the device belongs to */
1326 int group; 1326 int group;
1327 1327
@@ -1401,6 +1401,9 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1401 f(dev, &dev->_tx[i], arg); 1401 f(dev, &dev->_tx[i], arg);
1402} 1402}
1403 1403
1404extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1405 struct sk_buff *skb);
1406
1404/* 1407/*
1405 * Net namespace inlines 1408 * Net namespace inlines
1406 */ 1409 */
@@ -1553,7 +1556,7 @@ struct packet_type {
1553#define NETDEV_PRE_TYPE_CHANGE 0x000E 1556#define NETDEV_PRE_TYPE_CHANGE 0x000E
1554#define NETDEV_POST_TYPE_CHANGE 0x000F 1557#define NETDEV_POST_TYPE_CHANGE 0x000F
1555#define NETDEV_POST_INIT 0x0010 1558#define NETDEV_POST_INIT 0x0010
1556#define NETDEV_UNREGISTER_BATCH 0x0011 1559#define NETDEV_UNREGISTER_FINAL 0x0011
1557#define NETDEV_RELEASE 0x0012 1560#define NETDEV_RELEASE 0x0012
1558#define NETDEV_NOTIFY_PEERS 0x0013 1561#define NETDEV_NOTIFY_PEERS 0x0013
1559#define NETDEV_JOIN 0x0014 1562#define NETDEV_JOIN 0x0014
@@ -2227,6 +2230,7 @@ static inline void dev_hold(struct net_device *dev)
2227 * kind of lower layer not just hardware media. 2230 * kind of lower layer not just hardware media.
2228 */ 2231 */
2229 2232
2233extern void linkwatch_init_dev(struct net_device *dev);
2230extern void linkwatch_fire_event(struct net_device *dev); 2234extern void linkwatch_fire_event(struct net_device *dev);
2231extern void linkwatch_forget_dev(struct net_device *dev); 2235extern void linkwatch_forget_dev(struct net_device *dev);
2232 2236
@@ -2249,8 +2253,6 @@ extern void netif_carrier_on(struct net_device *dev);
2249 2253
2250extern void netif_carrier_off(struct net_device *dev); 2254extern void netif_carrier_off(struct net_device *dev);
2251 2255
2252extern void netif_notify_peers(struct net_device *dev);
2253
2254/** 2256/**
2255 * netif_dormant_on - mark device as dormant. 2257 * netif_dormant_on - mark device as dormant.
2256 * @dev: network device 2258 * @dev: network device
@@ -2560,9 +2562,9 @@ extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2560extern void __hw_addr_init(struct netdev_hw_addr_list *list); 2562extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2561 2563
2562/* Functions used for device addresses handling */ 2564/* Functions used for device addresses handling */
2563extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2565extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2564 unsigned char addr_type); 2566 unsigned char addr_type);
2565extern int dev_addr_del(struct net_device *dev, unsigned char *addr, 2567extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2566 unsigned char addr_type); 2568 unsigned char addr_type);
2567extern int dev_addr_add_multiple(struct net_device *to_dev, 2569extern int dev_addr_add_multiple(struct net_device *to_dev,
2568 struct net_device *from_dev, 2570 struct net_device *from_dev,
@@ -2574,20 +2576,20 @@ extern void dev_addr_flush(struct net_device *dev);
2574extern int dev_addr_init(struct net_device *dev); 2576extern int dev_addr_init(struct net_device *dev);
2575 2577
2576/* Functions used for unicast addresses handling */ 2578/* Functions used for unicast addresses handling */
2577extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2579extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2578extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr); 2580extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2579extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2581extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2580extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2582extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2581extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2583extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2582extern void dev_uc_flush(struct net_device *dev); 2584extern void dev_uc_flush(struct net_device *dev);
2583extern void dev_uc_init(struct net_device *dev); 2585extern void dev_uc_init(struct net_device *dev);
2584 2586
2585/* Functions used for multicast addresses handling */ 2587/* Functions used for multicast addresses handling */
2586extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2588extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2587extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2589extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
2588extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr); 2590extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2589extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2591extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2590extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2592extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2591extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2593extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2592extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2594extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2593extern void dev_mc_flush(struct net_device *dev); 2595extern void dev_mc_flush(struct net_device *dev);
@@ -2599,8 +2601,7 @@ extern void __dev_set_rx_mode(struct net_device *dev);
2599extern int dev_set_promiscuity(struct net_device *dev, int inc); 2601extern int dev_set_promiscuity(struct net_device *dev, int inc);
2600extern int dev_set_allmulti(struct net_device *dev, int inc); 2602extern int dev_set_allmulti(struct net_device *dev, int inc);
2601extern void netdev_state_change(struct net_device *dev); 2603extern void netdev_state_change(struct net_device *dev);
2602extern int netdev_bonding_change(struct net_device *dev, 2604extern void netdev_notify_peers(struct net_device *dev);
2603 unsigned long event);
2604extern void netdev_features_change(struct net_device *dev); 2605extern void netdev_features_change(struct net_device *dev);
2605/* Load a device via the kmod */ 2606/* Load a device via the kmod */
2606extern void dev_load(struct net *net, const char *name); 2607extern void dev_load(struct net *net, const char *name);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index c613cf0d7884..1dcf2a38e51f 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -342,7 +342,7 @@ extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
342extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 342extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
343 343
344#include <net/flow.h> 344#include <net/flow.h>
345extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 345extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *);
346 346
347static inline void 347static inline void
348nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) 348nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
@@ -350,13 +350,11 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
350#ifdef CONFIG_NF_NAT_NEEDED 350#ifdef CONFIG_NF_NAT_NEEDED
351 void (*decodefn)(struct sk_buff *, struct flowi *); 351 void (*decodefn)(struct sk_buff *, struct flowi *);
352 352
353 if (family == AF_INET) { 353 rcu_read_lock();
354 rcu_read_lock(); 354 decodefn = rcu_dereference(nf_nat_decode_session_hook);
355 decodefn = rcu_dereference(ip_nat_decode_session); 355 if (decodefn)
356 if (decodefn) 356 decodefn(skb, fl);
357 decodefn(skb, fl); 357 rcu_read_unlock();
358 rcu_read_unlock();
359 }
360#endif 358#endif
361} 359}
362 360
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 2edc64cab739..528697b3c152 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -190,6 +190,7 @@ enum ip_set_dim {
190 * If changed, new revision of iptables match/target is required. 190 * If changed, new revision of iptables match/target is required.
191 */ 191 */
192 IPSET_DIM_MAX = 6, 192 IPSET_DIM_MAX = 6,
193 IPSET_BIT_RETURN_NOMATCH = 7,
193}; 194};
194 195
195/* Option flags for kernel operations */ 196/* Option flags for kernel operations */
@@ -198,6 +199,7 @@ enum ip_set_kopt {
198 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), 199 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
199 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), 200 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
200 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), 201 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
202 IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH),
201}; 203};
202 204
203#ifdef __KERNEL__ 205#ifdef __KERNEL__
@@ -206,9 +208,15 @@ enum ip_set_kopt {
206#include <linux/netlink.h> 208#include <linux/netlink.h>
207#include <linux/netfilter.h> 209#include <linux/netfilter.h>
208#include <linux/netfilter/x_tables.h> 210#include <linux/netfilter/x_tables.h>
211#include <linux/stringify.h>
209#include <linux/vmalloc.h> 212#include <linux/vmalloc.h>
210#include <net/netlink.h> 213#include <net/netlink.h>
211 214
215#define _IP_SET_MODULE_DESC(a, b, c) \
216 MODULE_DESCRIPTION(a " type of IP sets, revisions " b "-" c)
217#define IP_SET_MODULE_DESC(a, b, c) \
218 _IP_SET_MODULE_DESC(a, __stringify(b), __stringify(c))
219
212/* Set features */ 220/* Set features */
213enum ip_set_feature { 221enum ip_set_feature {
214 IPSET_TYPE_IP_FLAG = 0, 222 IPSET_TYPE_IP_FLAG = 0,
@@ -223,6 +231,8 @@ enum ip_set_feature {
223 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), 231 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
224 IPSET_TYPE_IFACE_FLAG = 5, 232 IPSET_TYPE_IFACE_FLAG = 5,
225 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG), 233 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
234 IPSET_TYPE_NOMATCH_FLAG = 6,
235 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG),
226 /* Strictly speaking not a feature, but a flag for dumping: 236 /* Strictly speaking not a feature, but a flag for dumping:
227 * this settype must be dumped last */ 237 * this settype must be dumped last */
228 IPSET_DUMP_LAST_FLAG = 7, 238 IPSET_DUMP_LAST_FLAG = 7,
@@ -249,7 +259,7 @@ struct ip_set_type_variant {
249 * returns negative error code, 259 * returns negative error code,
250 * zero for no match/success to add/delete 260 * zero for no match/success to add/delete
251 * positive for matching element */ 261 * positive for matching element */
252 int (*kadt)(struct ip_set *set, const struct sk_buff * skb, 262 int (*kadt)(struct ip_set *set, const struct sk_buff *skb,
253 const struct xt_action_param *par, 263 const struct xt_action_param *par,
254 enum ipset_adt adt, const struct ip_set_adt_opt *opt); 264 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
255 265
@@ -424,7 +434,8 @@ static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
424 return ret; 434 return ret;
425} 435}
426 436
427static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, const struct in6_addr *ipaddrptr) 437static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
438 const struct in6_addr *ipaddrptr)
428{ 439{
429 struct nlattr *__nested = ipset_nest_start(skb, type); 440 struct nlattr *__nested = ipset_nest_start(skb, type);
430 int ret; 441 int ret;
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index b114d35aea5e..ef9acd3c8450 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -137,50 +137,59 @@ htable_bits(u32 hashsize)
137#endif 137#endif
138 138
139#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) 139#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
140#ifdef IP_SET_HASH_WITH_MULTI
141#define NETS_LENGTH(family) (SET_HOST_MASK(family) + 1)
142#else
143#define NETS_LENGTH(family) SET_HOST_MASK(family)
144#endif
140 145
141/* Network cidr size book keeping when the hash stores different 146/* Network cidr size book keeping when the hash stores different
142 * sized networks */ 147 * sized networks */
143static void 148static void
144add_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask) 149add_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length)
145{ 150{
146 u8 i; 151 int i, j;
147
148 ++h->nets[cidr-1].nets;
149
150 pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets);
151 152
152 if (h->nets[cidr-1].nets > 1) 153 /* Add in increasing prefix order, so larger cidr first */
153 return; 154 for (i = 0, j = -1; i < nets_length && h->nets[i].nets; i++) {
154 155 if (j != -1)
155 /* New cidr size */ 156 continue;
156 for (i = 0; i < host_mask && h->nets[i].cidr; i++) { 157 else if (h->nets[i].cidr < cidr)
157 /* Add in increasing prefix order, so larger cidr first */ 158 j = i;
158 if (h->nets[i].cidr < cidr) 159 else if (h->nets[i].cidr == cidr) {
159 swap(h->nets[i].cidr, cidr); 160 h->nets[i].nets++;
161 return;
162 }
163 }
164 if (j != -1) {
165 for (; i > j; i--) {
166 h->nets[i].cidr = h->nets[i - 1].cidr;
167 h->nets[i].nets = h->nets[i - 1].nets;
168 }
160 } 169 }
161 if (i < host_mask) 170 h->nets[i].cidr = cidr;
162 h->nets[i].cidr = cidr; 171 h->nets[i].nets = 1;
163} 172}
164 173
165static void 174static void
166del_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask) 175del_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length)
167{ 176{
168 u8 i; 177 u8 i, j;
169
170 --h->nets[cidr-1].nets;
171 178
172 pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets); 179 for (i = 0; i < nets_length - 1 && h->nets[i].cidr != cidr; i++)
180 ;
181 h->nets[i].nets--;
173 182
174 if (h->nets[cidr-1].nets != 0) 183 if (h->nets[i].nets != 0)
175 return; 184 return;
176 185
177 /* All entries with this cidr size deleted, so cleanup h->cidr[] */ 186 for (j = i; j < nets_length - 1 && h->nets[j].nets; j++) {
178 for (i = 0; i < host_mask - 1 && h->nets[i].cidr; i++) { 187 h->nets[j].cidr = h->nets[j + 1].cidr;
179 if (h->nets[i].cidr == cidr) 188 h->nets[j].nets = h->nets[j + 1].nets;
180 h->nets[i].cidr = cidr = h->nets[i+1].cidr;
181 } 189 }
182 h->nets[i - 1].cidr = 0;
183} 190}
191#else
192#define NETS_LENGTH(family) 0
184#endif 193#endif
185 194
186/* Destroy the hashtable part of the set */ 195/* Destroy the hashtable part of the set */
@@ -202,14 +211,14 @@ ahash_destroy(struct htable *t)
202 211
203/* Calculate the actual memory size of the set data */ 212/* Calculate the actual memory size of the set data */
204static size_t 213static size_t
205ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 host_mask) 214ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 nets_length)
206{ 215{
207 u32 i; 216 u32 i;
208 struct htable *t = h->table; 217 struct htable *t = h->table;
209 size_t memsize = sizeof(*h) 218 size_t memsize = sizeof(*h)
210 + sizeof(*t) 219 + sizeof(*t)
211#ifdef IP_SET_HASH_WITH_NETS 220#ifdef IP_SET_HASH_WITH_NETS
212 + sizeof(struct ip_set_hash_nets) * host_mask 221 + sizeof(struct ip_set_hash_nets) * nets_length
213#endif 222#endif
214 + jhash_size(t->htable_bits) * sizeof(struct hbucket); 223 + jhash_size(t->htable_bits) * sizeof(struct hbucket);
215 224
@@ -238,7 +247,7 @@ ip_set_hash_flush(struct ip_set *set)
238 } 247 }
239#ifdef IP_SET_HASH_WITH_NETS 248#ifdef IP_SET_HASH_WITH_NETS
240 memset(h->nets, 0, sizeof(struct ip_set_hash_nets) 249 memset(h->nets, 0, sizeof(struct ip_set_hash_nets)
241 * SET_HOST_MASK(set->family)); 250 * NETS_LENGTH(set->family));
242#endif 251#endif
243 h->elements = 0; 252 h->elements = 0;
244} 253}
@@ -271,9 +280,6 @@ ip_set_hash_destroy(struct ip_set *set)
271(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \ 280(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \
272 & jhash_mask(htable_bits)) 281 & jhash_mask(htable_bits))
273 282
274#define CONCAT(a, b, c) a##b##c
275#define TOKEN(a, b, c) CONCAT(a, b, c)
276
277/* Type/family dependent function prototypes */ 283/* Type/family dependent function prototypes */
278 284
279#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal) 285#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal)
@@ -478,7 +484,7 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
478 } 484 }
479 485
480#ifdef IP_SET_HASH_WITH_NETS 486#ifdef IP_SET_HASH_WITH_NETS
481 add_cidr(h, CIDR(d->cidr), HOST_MASK); 487 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
482#endif 488#endif
483 h->elements++; 489 h->elements++;
484out: 490out:
@@ -513,7 +519,7 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags)
513 n->pos--; 519 n->pos--;
514 h->elements--; 520 h->elements--;
515#ifdef IP_SET_HASH_WITH_NETS 521#ifdef IP_SET_HASH_WITH_NETS
516 del_cidr(h, CIDR(d->cidr), HOST_MASK); 522 del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
517#endif 523#endif
518 if (n->pos + AHASH_INIT_SIZE < n->size) { 524 if (n->pos + AHASH_INIT_SIZE < n->size) {
519 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 525 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -546,10 +552,10 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
546 const struct type_pf_elem *data; 552 const struct type_pf_elem *data;
547 int i, j = 0; 553 int i, j = 0;
548 u32 key, multi = 0; 554 u32 key, multi = 0;
549 u8 host_mask = SET_HOST_MASK(set->family); 555 u8 nets_length = NETS_LENGTH(set->family);
550 556
551 pr_debug("test by nets\n"); 557 pr_debug("test by nets\n");
552 for (; j < host_mask && h->nets[j].cidr && !multi; j++) { 558 for (; j < nets_length && h->nets[j].nets && !multi; j++) {
553 type_pf_data_netmask(d, h->nets[j].cidr); 559 type_pf_data_netmask(d, h->nets[j].cidr);
554 key = HKEY(d, h->initval, t->htable_bits); 560 key = HKEY(d, h->initval, t->htable_bits);
555 n = hbucket(t, key); 561 n = hbucket(t, key);
@@ -604,7 +610,7 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
604 memsize = ahash_memsize(h, with_timeout(h->timeout) 610 memsize = ahash_memsize(h, with_timeout(h->timeout)
605 ? sizeof(struct type_pf_telem) 611 ? sizeof(struct type_pf_telem)
606 : sizeof(struct type_pf_elem), 612 : sizeof(struct type_pf_elem),
607 set->family == AF_INET ? 32 : 128); 613 NETS_LENGTH(set->family));
608 read_unlock_bh(&set->lock); 614 read_unlock_bh(&set->lock);
609 615
610 nested = ipset_nest_start(skb, IPSET_ATTR_DATA); 616 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
@@ -690,7 +696,7 @@ nla_put_failure:
690} 696}
691 697
692static int 698static int
693type_pf_kadt(struct ip_set *set, const struct sk_buff * skb, 699type_pf_kadt(struct ip_set *set, const struct sk_buff *skb,
694 const struct xt_action_param *par, 700 const struct xt_action_param *par,
695 enum ipset_adt adt, const struct ip_set_adt_opt *opt); 701 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
696static int 702static int
@@ -783,7 +789,7 @@ type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
783 789
784/* Delete expired elements from the hashtable */ 790/* Delete expired elements from the hashtable */
785static void 791static void
786type_pf_expire(struct ip_set_hash *h) 792type_pf_expire(struct ip_set_hash *h, u8 nets_length)
787{ 793{
788 struct htable *t = h->table; 794 struct htable *t = h->table;
789 struct hbucket *n; 795 struct hbucket *n;
@@ -798,7 +804,7 @@ type_pf_expire(struct ip_set_hash *h)
798 if (type_pf_data_expired(data)) { 804 if (type_pf_data_expired(data)) {
799 pr_debug("expired %u/%u\n", i, j); 805 pr_debug("expired %u/%u\n", i, j);
800#ifdef IP_SET_HASH_WITH_NETS 806#ifdef IP_SET_HASH_WITH_NETS
801 del_cidr(h, CIDR(data->cidr), HOST_MASK); 807 del_cidr(h, CIDR(data->cidr), nets_length);
802#endif 808#endif
803 if (j != n->pos - 1) 809 if (j != n->pos - 1)
804 /* Not last one */ 810 /* Not last one */
@@ -839,7 +845,7 @@ type_pf_tresize(struct ip_set *set, bool retried)
839 if (!retried) { 845 if (!retried) {
840 i = h->elements; 846 i = h->elements;
841 write_lock_bh(&set->lock); 847 write_lock_bh(&set->lock);
842 type_pf_expire(set->data); 848 type_pf_expire(set->data, NETS_LENGTH(set->family));
843 write_unlock_bh(&set->lock); 849 write_unlock_bh(&set->lock);
844 if (h->elements < i) 850 if (h->elements < i)
845 return 0; 851 return 0;
@@ -904,7 +910,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
904 910
905 if (h->elements >= h->maxelem) 911 if (h->elements >= h->maxelem)
906 /* FIXME: when set is full, we slow down here */ 912 /* FIXME: when set is full, we slow down here */
907 type_pf_expire(h); 913 type_pf_expire(h, NETS_LENGTH(set->family));
908 if (h->elements >= h->maxelem) { 914 if (h->elements >= h->maxelem) {
909 if (net_ratelimit()) 915 if (net_ratelimit())
910 pr_warning("Set %s is full, maxelem %u reached\n", 916 pr_warning("Set %s is full, maxelem %u reached\n",
@@ -933,8 +939,8 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
933 if (j != AHASH_MAX(h) + 1) { 939 if (j != AHASH_MAX(h) + 1) {
934 data = ahash_tdata(n, j); 940 data = ahash_tdata(n, j);
935#ifdef IP_SET_HASH_WITH_NETS 941#ifdef IP_SET_HASH_WITH_NETS
936 del_cidr(h, CIDR(data->cidr), HOST_MASK); 942 del_cidr(h, CIDR(data->cidr), NETS_LENGTH(set->family));
937 add_cidr(h, CIDR(d->cidr), HOST_MASK); 943 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
938#endif 944#endif
939 type_pf_data_copy(data, d); 945 type_pf_data_copy(data, d);
940 type_pf_data_timeout_set(data, timeout); 946 type_pf_data_timeout_set(data, timeout);
@@ -952,7 +958,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
952 } 958 }
953 959
954#ifdef IP_SET_HASH_WITH_NETS 960#ifdef IP_SET_HASH_WITH_NETS
955 add_cidr(h, CIDR(d->cidr), HOST_MASK); 961 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
956#endif 962#endif
957 h->elements++; 963 h->elements++;
958out: 964out:
@@ -986,7 +992,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags)
986 n->pos--; 992 n->pos--;
987 h->elements--; 993 h->elements--;
988#ifdef IP_SET_HASH_WITH_NETS 994#ifdef IP_SET_HASH_WITH_NETS
989 del_cidr(h, CIDR(d->cidr), HOST_MASK); 995 del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
990#endif 996#endif
991 if (n->pos + AHASH_INIT_SIZE < n->size) { 997 if (n->pos + AHASH_INIT_SIZE < n->size) {
992 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 998 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -1016,9 +1022,9 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
1016 struct hbucket *n; 1022 struct hbucket *n;
1017 int i, j = 0; 1023 int i, j = 0;
1018 u32 key, multi = 0; 1024 u32 key, multi = 0;
1019 u8 host_mask = SET_HOST_MASK(set->family); 1025 u8 nets_length = NETS_LENGTH(set->family);
1020 1026
1021 for (; j < host_mask && h->nets[j].cidr && !multi; j++) { 1027 for (; j < nets_length && h->nets[j].nets && !multi; j++) {
1022 type_pf_data_netmask(d, h->nets[j].cidr); 1028 type_pf_data_netmask(d, h->nets[j].cidr);
1023 key = HKEY(d, h->initval, t->htable_bits); 1029 key = HKEY(d, h->initval, t->htable_bits);
1024 n = hbucket(t, key); 1030 n = hbucket(t, key);
@@ -1147,7 +1153,7 @@ type_pf_gc(unsigned long ul_set)
1147 1153
1148 pr_debug("called\n"); 1154 pr_debug("called\n");
1149 write_lock_bh(&set->lock); 1155 write_lock_bh(&set->lock);
1150 type_pf_expire(h); 1156 type_pf_expire(h, NETS_LENGTH(set->family));
1151 write_unlock_bh(&set->lock); 1157 write_unlock_bh(&set->lock);
1152 1158
1153 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; 1159 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h
index 0bb5a6976bf3..4b59a1584959 100644
--- a/include/linux/netfilter/nf_conntrack_amanda.h
+++ b/include/linux/netfilter/nf_conntrack_amanda.h
@@ -4,6 +4,7 @@
4 4
5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, 5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb,
6 enum ip_conntrack_info ctinfo, 6 enum ip_conntrack_info ctinfo,
7 unsigned int protoff,
7 unsigned int matchoff, 8 unsigned int matchoff,
8 unsigned int matchlen, 9 unsigned int matchlen,
9 struct nf_conntrack_expect *exp); 10 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index 3e3aa08980c3..8faf3f792d13 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -18,13 +18,17 @@ enum nf_ct_ftp_type {
18 18
19#define FTP_PORT 21 19#define FTP_PORT 21
20 20
21#define NF_CT_FTP_SEQ_PICKUP (1 << 0)
22
21#define NUM_SEQ_TO_REMEMBER 2 23#define NUM_SEQ_TO_REMEMBER 2
22/* This structure exists only once per master */ 24/* This structure exists only once per master */
23struct nf_ct_ftp_master { 25struct nf_ct_ftp_master {
24 /* Valid seq positions for cmd matching after newline */ 26 /* Valid seq positions for cmd matching after newline */
25 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; 27 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
26 /* 0 means seq_match_aft_nl not set */ 28 /* 0 means seq_match_aft_nl not set */
27 int seq_aft_nl_num[IP_CT_DIR_MAX]; 29 u_int16_t seq_aft_nl_num[IP_CT_DIR_MAX];
30 /* pickup sequence tracking, useful for conntrackd */
31 u_int16_t flags[IP_CT_DIR_MAX];
28}; 32};
29 33
30struct nf_conntrack_expect; 34struct nf_conntrack_expect;
@@ -34,6 +38,7 @@ struct nf_conntrack_expect;
34extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb, 38extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
35 enum ip_conntrack_info ctinfo, 39 enum ip_conntrack_info ctinfo,
36 enum nf_ct_ftp_type type, 40 enum nf_ct_ftp_type type,
41 unsigned int protoff,
37 unsigned int matchoff, 42 unsigned int matchoff,
38 unsigned int matchlen, 43 unsigned int matchlen,
39 struct nf_conntrack_expect *exp); 44 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index 26f9226ea72b..f381020eee92 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -36,12 +36,12 @@ extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37extern void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this); 38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff *skb, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
42 union nf_inet_addr *addr, 42 union nf_inet_addr *addr,
43 __be16 port); 43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff *skb, 44extern int (*set_h225_addr_hook) (struct sk_buff *skb, unsigned int protoff,
45 unsigned char **data, int dataoff, 45 unsigned char **data, int dataoff,
46 TransportAddress *taddr, 46 TransportAddress *taddr,
47 union nf_inet_addr *addr, 47 union nf_inet_addr *addr,
@@ -49,40 +49,45 @@ extern int (*set_h225_addr_hook) (struct sk_buff *skb,
49extern int (*set_sig_addr_hook) (struct sk_buff *skb, 49extern int (*set_sig_addr_hook) (struct sk_buff *skb,
50 struct nf_conn *ct, 50 struct nf_conn *ct,
51 enum ip_conntrack_info ctinfo, 51 enum ip_conntrack_info ctinfo,
52 unsigned char **data, 52 unsigned int protoff, unsigned char **data,
53 TransportAddress *taddr, int count); 53 TransportAddress *taddr, int count);
54extern int (*set_ras_addr_hook) (struct sk_buff *skb, 54extern int (*set_ras_addr_hook) (struct sk_buff *skb,
55 struct nf_conn *ct, 55 struct nf_conn *ct,
56 enum ip_conntrack_info ctinfo, 56 enum ip_conntrack_info ctinfo,
57 unsigned char **data, 57 unsigned int protoff, unsigned char **data,
58 TransportAddress *taddr, int count); 58 TransportAddress *taddr, int count);
59extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb, 59extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
60 struct nf_conn *ct, 60 struct nf_conn *ct,
61 enum ip_conntrack_info ctinfo, 61 enum ip_conntrack_info ctinfo,
62 unsigned char **data, int dataoff, 62 unsigned int protoff, unsigned char **data,
63 int dataoff,
63 H245_TransportAddress *taddr, 64 H245_TransportAddress *taddr,
64 __be16 port, __be16 rtp_port, 65 __be16 port, __be16 rtp_port,
65 struct nf_conntrack_expect *rtp_exp, 66 struct nf_conntrack_expect *rtp_exp,
66 struct nf_conntrack_expect *rtcp_exp); 67 struct nf_conntrack_expect *rtcp_exp);
67extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct, 68extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct,
68 enum ip_conntrack_info ctinfo, 69 enum ip_conntrack_info ctinfo,
70 unsigned int protoff,
69 unsigned char **data, int dataoff, 71 unsigned char **data, int dataoff,
70 H245_TransportAddress *taddr, __be16 port, 72 H245_TransportAddress *taddr, __be16 port,
71 struct nf_conntrack_expect *exp); 73 struct nf_conntrack_expect *exp);
72extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct, 74extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct,
73 enum ip_conntrack_info ctinfo, 75 enum ip_conntrack_info ctinfo,
76 unsigned int protoff,
74 unsigned char **data, int dataoff, 77 unsigned char **data, int dataoff,
75 TransportAddress *taddr, __be16 port, 78 TransportAddress *taddr, __be16 port,
76 struct nf_conntrack_expect *exp); 79 struct nf_conntrack_expect *exp);
77extern int (*nat_callforwarding_hook) (struct sk_buff *skb, 80extern int (*nat_callforwarding_hook) (struct sk_buff *skb,
78 struct nf_conn *ct, 81 struct nf_conn *ct,
79 enum ip_conntrack_info ctinfo, 82 enum ip_conntrack_info ctinfo,
83 unsigned int protoff,
80 unsigned char **data, int dataoff, 84 unsigned char **data, int dataoff,
81 TransportAddress *taddr, 85 TransportAddress *taddr,
82 __be16 port, 86 __be16 port,
83 struct nf_conntrack_expect *exp); 87 struct nf_conntrack_expect *exp);
84extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct, 88extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct,
85 enum ip_conntrack_info ctinfo, 89 enum ip_conntrack_info ctinfo,
90 unsigned int protoff,
86 unsigned char **data, TransportAddress *taddr, 91 unsigned char **data, TransportAddress *taddr,
87 int idx, __be16 port, 92 int idx, __be16 port,
88 struct nf_conntrack_expect *exp); 93 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_irc.h b/include/linux/netfilter/nf_conntrack_irc.h
index 36282bf71b63..4bb9bae67176 100644
--- a/include/linux/netfilter/nf_conntrack_irc.h
+++ b/include/linux/netfilter/nf_conntrack_irc.h
@@ -7,6 +7,7 @@
7 7
8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb, 8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,
9 enum ip_conntrack_info ctinfo, 9 enum ip_conntrack_info ctinfo,
10 unsigned int protoff,
10 unsigned int matchoff, 11 unsigned int matchoff,
11 unsigned int matchlen, 12 unsigned int matchlen,
12 struct nf_conntrack_expect *exp); 13 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
index 3bbde0c3a8a6..2ab2830316b7 100644
--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -303,12 +303,14 @@ struct nf_conntrack_expect;
303extern int 303extern int
304(*nf_nat_pptp_hook_outbound)(struct sk_buff *skb, 304(*nf_nat_pptp_hook_outbound)(struct sk_buff *skb,
305 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 305 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
306 unsigned int protoff,
306 struct PptpControlHeader *ctlh, 307 struct PptpControlHeader *ctlh,
307 union pptp_ctrl_union *pptpReq); 308 union pptp_ctrl_union *pptpReq);
308 309
309extern int 310extern int
310(*nf_nat_pptp_hook_inbound)(struct sk_buff *skb, 311(*nf_nat_pptp_hook_inbound)(struct sk_buff *skb,
311 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 312 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
313 unsigned int protoff,
312 struct PptpControlHeader *ctlh, 314 struct PptpControlHeader *ctlh,
313 union pptp_ctrl_union *pptpReq); 315 union pptp_ctrl_union *pptpReq);
314 316
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 89f2a627f3f0..387bdd02945d 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -37,10 +37,12 @@ struct sdp_media_type {
37struct sip_handler { 37struct sip_handler {
38 const char *method; 38 const char *method;
39 unsigned int len; 39 unsigned int len;
40 int (*request)(struct sk_buff *skb, unsigned int dataoff, 40 int (*request)(struct sk_buff *skb, unsigned int protoff,
41 unsigned int dataoff,
41 const char **dptr, unsigned int *datalen, 42 const char **dptr, unsigned int *datalen,
42 unsigned int cseq); 43 unsigned int cseq);
43 int (*response)(struct sk_buff *skb, unsigned int dataoff, 44 int (*response)(struct sk_buff *skb, unsigned int protoff,
45 unsigned int dataoff,
44 const char **dptr, unsigned int *datalen, 46 const char **dptr, unsigned int *datalen,
45 unsigned int cseq, unsigned int code); 47 unsigned int cseq, unsigned int code);
46}; 48};
@@ -97,19 +99,20 @@ enum sip_header_types {
97enum sdp_header_types { 99enum sdp_header_types {
98 SDP_HDR_UNSPEC, 100 SDP_HDR_UNSPEC,
99 SDP_HDR_VERSION, 101 SDP_HDR_VERSION,
100 SDP_HDR_OWNER_IP4, 102 SDP_HDR_OWNER,
101 SDP_HDR_CONNECTION_IP4, 103 SDP_HDR_CONNECTION,
102 SDP_HDR_OWNER_IP6,
103 SDP_HDR_CONNECTION_IP6,
104 SDP_HDR_MEDIA, 104 SDP_HDR_MEDIA,
105}; 105};
106 106
107extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 107extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
108 unsigned int protoff,
108 unsigned int dataoff, 109 unsigned int dataoff,
109 const char **dptr, 110 const char **dptr,
110 unsigned int *datalen); 111 unsigned int *datalen);
111extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, s16 off); 112extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb,
113 unsigned int protoff, s16 off);
112extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, 114extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
115 unsigned int protoff,
113 unsigned int dataoff, 116 unsigned int dataoff,
114 const char **dptr, 117 const char **dptr,
115 unsigned int *datalen, 118 unsigned int *datalen,
@@ -117,6 +120,7 @@ extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
117 unsigned int matchoff, 120 unsigned int matchoff,
118 unsigned int matchlen); 121 unsigned int matchlen);
119extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, 122extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
123 unsigned int protoff,
120 unsigned int dataoff, 124 unsigned int dataoff,
121 const char **dptr, 125 const char **dptr,
122 unsigned int *datalen, 126 unsigned int *datalen,
@@ -125,6 +129,7 @@ extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
125 enum sdp_header_types term, 129 enum sdp_header_types term,
126 const union nf_inet_addr *addr); 130 const union nf_inet_addr *addr);
127extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, 131extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
132 unsigned int protoff,
128 unsigned int dataoff, 133 unsigned int dataoff,
129 const char **dptr, 134 const char **dptr,
130 unsigned int *datalen, 135 unsigned int *datalen,
@@ -132,12 +137,14 @@ extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
132 unsigned int matchlen, 137 unsigned int matchlen,
133 u_int16_t port); 138 u_int16_t port);
134extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, 139extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
140 unsigned int protoff,
135 unsigned int dataoff, 141 unsigned int dataoff,
136 const char **dptr, 142 const char **dptr,
137 unsigned int *datalen, 143 unsigned int *datalen,
138 unsigned int sdpoff, 144 unsigned int sdpoff,
139 const union nf_inet_addr *addr); 145 const union nf_inet_addr *addr);
140extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, 146extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
147 unsigned int protoff,
141 unsigned int dataoff, 148 unsigned int dataoff,
142 const char **dptr, 149 const char **dptr,
143 unsigned int *datalen, 150 unsigned int *datalen,
diff --git a/include/linux/netfilter/nf_nat.h b/include/linux/netfilter/nf_nat.h
index 8df2d13730b2..bf0cc373ffb6 100644
--- a/include/linux/netfilter/nf_nat.h
+++ b/include/linux/netfilter/nf_nat.h
@@ -22,4 +22,12 @@ struct nf_nat_ipv4_multi_range_compat {
22 struct nf_nat_ipv4_range range[1]; 22 struct nf_nat_ipv4_range range[1];
23}; 23};
24 24
25struct nf_nat_range {
26 unsigned int flags;
27 union nf_inet_addr min_addr;
28 union nf_inet_addr max_addr;
29 union nf_conntrack_man_proto min_proto;
30 union nf_conntrack_man_proto max_proto;
31};
32
25#endif /* _NETFILTER_NF_NAT_H */ 33#endif /* _NETFILTER_NF_NAT_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index f649f7423ca2..43bfe3e1685b 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -142,9 +142,13 @@ enum ctattr_tstamp {
142 142
143enum ctattr_nat { 143enum ctattr_nat {
144 CTA_NAT_UNSPEC, 144 CTA_NAT_UNSPEC,
145 CTA_NAT_MINIP, 145 CTA_NAT_V4_MINIP,
146 CTA_NAT_MAXIP, 146#define CTA_NAT_MINIP CTA_NAT_V4_MINIP
147 CTA_NAT_V4_MAXIP,
148#define CTA_NAT_MAXIP CTA_NAT_V4_MAXIP
147 CTA_NAT_PROTO, 149 CTA_NAT_PROTO,
150 CTA_NAT_V6_MINIP,
151 CTA_NAT_V6_MAXIP,
148 __CTA_NAT_MAX 152 __CTA_NAT_MAX
149}; 153};
150#define CTA_NAT_MAX (__CTA_NAT_MAX - 1) 154#define CTA_NAT_MAX (__CTA_NAT_MAX - 1)
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 3b1c1360aedf..70ec8c2bc11a 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -44,6 +44,7 @@ enum nfqnl_attr_type {
44 NFQA_PAYLOAD, /* opaque data payload */ 44 NFQA_PAYLOAD, /* opaque data payload */
45 NFQA_CT, /* nf_conntrack_netlink.h */ 45 NFQA_CT, /* nf_conntrack_netlink.h */
46 NFQA_CT_INFO, /* enum ip_conntrack_info */ 46 NFQA_CT_INFO, /* enum ip_conntrack_info */
47 NFQA_CAP_LEN, /* __u32 length of captured packet */
47 48
48 __NFQA_MAX 49 __NFQA_MAX
49}; 50};
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h
index 7c37fac576c4..095886019396 100644
--- a/include/linux/netfilter/xt_time.h
+++ b/include/linux/netfilter/xt_time.h
@@ -17,6 +17,9 @@ enum {
17 /* Match against local time (instead of UTC) */ 17 /* Match against local time (instead of UTC) */
18 XT_TIME_LOCAL_TZ = 1 << 0, 18 XT_TIME_LOCAL_TZ = 1 << 0,
19 19
20 /* treat timestart > timestop (e.g. 23:00-01:00) as single period */
21 XT_TIME_CONTIGUOUS = 1 << 1,
22
20 /* Shortcuts */ 23 /* Shortcuts */
21 XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, 24 XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE,
22 XT_TIME_ALL_WEEKDAYS = 0xFE, 25 XT_TIME_ALL_WEEKDAYS = 0xFE,
@@ -24,4 +27,6 @@ enum {
24 XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, 27 XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1,
25}; 28};
26 29
30#define XT_TIME_ALL_FLAGS (XT_TIME_LOCAL_TZ|XT_TIME_CONTIGUOUS)
31
27#endif /* _XT_TIME_H */ 32#endif /* _XT_TIME_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index e2b12801378d..b962dfc695ae 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -79,7 +79,6 @@ enum nf_ip_hook_priorities {
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type); 81extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
82extern int ip_xfrm_me_harder(struct sk_buff *skb);
83extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 82extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
84 unsigned int dataoff, u_int8_t protocol); 83 unsigned int dataoff, u_int8_t protocol);
85#endif /*__KERNEL__*/ 84#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index bd095bc075e9..b88c0058bf73 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -1,6 +1,7 @@
1header-y += ip6_tables.h 1header-y += ip6_tables.h
2header-y += ip6t_HL.h 2header-y += ip6t_HL.h
3header-y += ip6t_LOG.h 3header-y += ip6t_LOG.h
4header-y += ip6t_NPT.h
4header-y += ip6t_REJECT.h 5header-y += ip6t_REJECT.h
5header-y += ip6t_ah.h 6header-y += ip6t_ah.h
6header-y += ip6t_frag.h 7header-y += ip6t_frag.h
diff --git a/include/linux/netfilter_ipv6/ip6t_NPT.h b/include/linux/netfilter_ipv6/ip6t_NPT.h
new file mode 100644
index 000000000000..f763355481b5
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_NPT.h
@@ -0,0 +1,16 @@
1#ifndef __NETFILTER_IP6T_NPT
2#define __NETFILTER_IP6T_NPT
3
4#include <linux/types.h>
5#include <linux/netfilter.h>
6
7struct ip6t_npt_tginfo {
8 union nf_inet_addr src_pfx;
9 union nf_inet_addr dst_pfx;
10 __u8 src_pfx_len;
11 __u8 dst_pfx_len;
12 /* Used internally by the kernel */
13 __sum16 adjustment;
14};
15
16#endif /* __NETFILTER_IP6T_NPT */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index f74dd133788f..f80c56ac4d82 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -153,6 +153,8 @@ struct nlattr {
153 153
154#include <linux/capability.h> 154#include <linux/capability.h>
155#include <linux/skbuff.h> 155#include <linux/skbuff.h>
156#include <linux/export.h>
157#include <net/scm.h>
156 158
157struct net; 159struct net;
158 160
@@ -162,9 +164,10 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
162} 164}
163 165
164struct netlink_skb_parms { 166struct netlink_skb_parms {
165 struct ucred creds; /* Skb credentials */ 167 struct scm_creds creds; /* Skb credentials */
166 __u32 pid; 168 __u32 portid;
167 __u32 dst_group; 169 __u32 dst_group;
170 struct sock *ssk;
168}; 171};
169 172
170#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 173#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
@@ -174,17 +177,27 @@ struct netlink_skb_parms {
174extern void netlink_table_grab(void); 177extern void netlink_table_grab(void);
175extern void netlink_table_ungrab(void); 178extern void netlink_table_ungrab(void);
176 179
180#define NL_CFG_F_NONROOT_RECV (1 << 0)
181#define NL_CFG_F_NONROOT_SEND (1 << 1)
182
177/* optional Netlink kernel configuration parameters */ 183/* optional Netlink kernel configuration parameters */
178struct netlink_kernel_cfg { 184struct netlink_kernel_cfg {
179 unsigned int groups; 185 unsigned int groups;
186 unsigned int flags;
180 void (*input)(struct sk_buff *skb); 187 void (*input)(struct sk_buff *skb);
181 struct mutex *cb_mutex; 188 struct mutex *cb_mutex;
182 void (*bind)(int group); 189 void (*bind)(int group);
183}; 190};
184 191
185extern struct sock *netlink_kernel_create(struct net *net, int unit, 192extern struct sock *__netlink_kernel_create(struct net *net, int unit,
186 struct module *module, 193 struct module *module,
187 struct netlink_kernel_cfg *cfg); 194 struct netlink_kernel_cfg *cfg);
195static inline struct sock *
196netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
197{
198 return __netlink_kernel_create(net, unit, THIS_MODULE, cfg);
199}
200
188extern void netlink_kernel_release(struct sock *sk); 201extern void netlink_kernel_release(struct sock *sk);
189extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); 202extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
190extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 203extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
@@ -192,14 +205,14 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)
192extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 205extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
193extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 206extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
194extern int netlink_has_listeners(struct sock *sk, unsigned int group); 207extern int netlink_has_listeners(struct sock *sk, unsigned int group);
195extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 208extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
196extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 209extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
197 __u32 group, gfp_t allocation); 210 __u32 group, gfp_t allocation);
198extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, 211extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
199 __u32 pid, __u32 group, gfp_t allocation, 212 __u32 portid, __u32 group, gfp_t allocation,
200 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), 213 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
201 void *filter_data); 214 void *filter_data);
202extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 215extern int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code);
203extern int netlink_register_notifier(struct notifier_block *nb); 216extern int netlink_register_notifier(struct notifier_block *nb);
204extern int netlink_unregister_notifier(struct notifier_block *nb); 217extern int netlink_unregister_notifier(struct notifier_block *nb);
205 218
@@ -240,12 +253,12 @@ struct netlink_callback {
240 253
241struct netlink_notify { 254struct netlink_notify {
242 struct net *net; 255 struct net *net;
243 int pid; 256 int portid;
244 int protocol; 257 int protocol;
245}; 258};
246 259
247struct nlmsghdr * 260struct nlmsghdr *
248__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); 261__nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
249 262
250struct netlink_dump_control { 263struct netlink_dump_control {
251 int (*dump)(struct sk_buff *skb, struct netlink_callback *); 264 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
@@ -258,11 +271,6 @@ extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
258 const struct nlmsghdr *nlh, 271 const struct nlmsghdr *nlh,
259 struct netlink_dump_control *control); 272 struct netlink_dump_control *control);
260 273
261
262#define NL_NONROOT_RECV 0x1
263#define NL_NONROOT_SEND 0x2
264extern void netlink_set_nonroot(int protocol, unsigned flag);
265
266#endif /* __KERNEL__ */ 274#endif /* __KERNEL__ */
267 275
268#endif /* __LINUX_NETLINK_H */ 276#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 2f3878806403..458416279347 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -565,6 +565,14 @@
565 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with 565 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with
566 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. 566 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
567 * 567 *
568 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
569 * its %NL80211_ATTR_WDEV identifier. It must have been created with
570 * %NL80211_CMD_NEW_INTERFACE previously. After it has been started, the
571 * P2P Device can be used for P2P operations, e.g. remain-on-channel and
572 * public action frame TX.
573 * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by
574 * its %NL80211_ATTR_WDEV identifier.
575 *
568 * @NL80211_CMD_MAX: highest used command number 576 * @NL80211_CMD_MAX: highest used command number
569 * @__NL80211_CMD_AFTER_LAST: internal use 577 * @__NL80211_CMD_AFTER_LAST: internal use
570 */ 578 */
@@ -708,6 +716,9 @@ enum nl80211_commands {
708 716
709 NL80211_CMD_CH_SWITCH_NOTIFY, 717 NL80211_CMD_CH_SWITCH_NOTIFY,
710 718
719 NL80211_CMD_START_P2P_DEVICE,
720 NL80211_CMD_STOP_P2P_DEVICE,
721
711 /* add new commands above here */ 722 /* add new commands above here */
712 723
713 /* used to define NL80211_CMD_MAX below */ 724 /* used to define NL80211_CMD_MAX below */
@@ -1575,6 +1586,10 @@ enum nl80211_attrs {
1575 * @NL80211_IFTYPE_MESH_POINT: mesh point 1586 * @NL80211_IFTYPE_MESH_POINT: mesh point
1576 * @NL80211_IFTYPE_P2P_CLIENT: P2P client 1587 * @NL80211_IFTYPE_P2P_CLIENT: P2P client
1577 * @NL80211_IFTYPE_P2P_GO: P2P group owner 1588 * @NL80211_IFTYPE_P2P_GO: P2P group owner
1589 * @NL80211_IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev
1590 * and therefore can't be created in the normal ways, use the
1591 * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
1592 * commands to create and destroy one
1578 * @NL80211_IFTYPE_MAX: highest interface type number currently defined 1593 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
1579 * @NUM_NL80211_IFTYPES: number of defined interface types 1594 * @NUM_NL80211_IFTYPES: number of defined interface types
1580 * 1595 *
@@ -1593,6 +1608,7 @@ enum nl80211_iftype {
1593 NL80211_IFTYPE_MESH_POINT, 1608 NL80211_IFTYPE_MESH_POINT,
1594 NL80211_IFTYPE_P2P_CLIENT, 1609 NL80211_IFTYPE_P2P_CLIENT,
1595 NL80211_IFTYPE_P2P_GO, 1610 NL80211_IFTYPE_P2P_GO,
1611 NL80211_IFTYPE_P2P_DEVICE,
1596 1612
1597 /* keep last */ 1613 /* keep last */
1598 NUM_NL80211_IFTYPES, 1614 NUM_NL80211_IFTYPES,
@@ -2994,12 +3010,18 @@ enum nl80211_ap_sme_features {
2994 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested 3010 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
2995 * to work properly to suppport receiving regulatory hints from 3011 * to work properly to suppport receiving regulatory hints from
2996 * cellular base stations. 3012 * cellular base stations.
3013 * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: If this is set, an active
3014 * P2P Device (%NL80211_IFTYPE_P2P_DEVICE) requires its own channel
3015 * in the interface combinations, even when it's only used for scan
3016 * and remain-on-channel. This could be due to, for example, the
3017 * remain-on-channel implementation requiring a channel context.
2997 */ 3018 */
2998enum nl80211_feature_flags { 3019enum nl80211_feature_flags {
2999 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3020 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
3000 NL80211_FEATURE_HT_IBSS = 1 << 1, 3021 NL80211_FEATURE_HT_IBSS = 1 << 1,
3001 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, 3022 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
3002 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, 3023 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
3024 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4,
3003}; 3025};
3004 3026
3005/** 3027/**
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 912c27a0f7ee..6ef49b803efb 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -12,6 +12,7 @@
12#include <linux/phy.h> 12#include <linux/phy.h>
13#include <linux/of.h> 13#include <linux/of.h>
14 14
15#ifdef CONFIG_OF
15extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); 16extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
16extern struct phy_device *of_phy_find_device(struct device_node *phy_np); 17extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
17extern struct phy_device *of_phy_connect(struct net_device *dev, 18extern struct phy_device *of_phy_connect(struct net_device *dev,
@@ -24,4 +25,36 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
24 25
25extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
26 27
28#else /* CONFIG_OF */
29int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
30{
31 return -ENOSYS;
32}
33
34struct phy_device *of_phy_find_device(struct device_node *phy_np)
35{
36 return NULL;
37}
38
39struct phy_device *of_phy_connect(struct net_device *dev,
40 struct device_node *phy_np,
41 void (*hndlr)(struct net_device *),
42 u32 flags, phy_interface_t iface)
43{
44 return NULL;
45}
46
47struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
48 void (*hndlr)(struct net_device *),
49 phy_interface_t iface)
50{
51 return NULL;
52}
53
54struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
55{
56 return NULL;
57}
58#endif /* CONFIG_OF */
59
27#endif /* __LINUX_OF_MDIO_H */ 60#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/packet_diag.h b/include/linux/packet_diag.h
new file mode 100644
index 000000000000..93f5fa94a431
--- /dev/null
+++ b/include/linux/packet_diag.h
@@ -0,0 +1,72 @@
1#ifndef __PACKET_DIAG_H__
2#define __PACKET_DIAG_H__
3
4#include <linux/types.h>
5
6struct packet_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 pdiag_ino;
11 __u32 pdiag_show;
12 __u32 pdiag_cookie[2];
13};
14
15#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */
16#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */
17#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */
18#define PACKET_SHOW_FANOUT 0x00000008
19
20struct packet_diag_msg {
21 __u8 pdiag_family;
22 __u8 pdiag_type;
23 __u16 pdiag_num;
24
25 __u32 pdiag_ino;
26 __u32 pdiag_cookie[2];
27};
28
29enum {
30 PACKET_DIAG_INFO,
31 PACKET_DIAG_MCLIST,
32 PACKET_DIAG_RX_RING,
33 PACKET_DIAG_TX_RING,
34 PACKET_DIAG_FANOUT,
35
36 PACKET_DIAG_MAX,
37};
38
39struct packet_diag_info {
40 __u32 pdi_index;
41 __u32 pdi_version;
42 __u32 pdi_reserve;
43 __u32 pdi_copy_thresh;
44 __u32 pdi_tstamp;
45 __u32 pdi_flags;
46
47#define PDI_RUNNING 0x1
48#define PDI_AUXDATA 0x2
49#define PDI_ORIGDEV 0x4
50#define PDI_VNETHDR 0x8
51#define PDI_LOSS 0x10
52};
53
54struct packet_diag_mclist {
55 __u32 pdmc_index;
56 __u32 pdmc_count;
57 __u16 pdmc_type;
58 __u16 pdmc_alen;
59 __u8 pdmc_addr[MAX_ADDR_LEN];
60};
61
62struct packet_diag_ring {
63 __u32 pdr_block_size;
64 __u32 pdr_block_nr;
65 __u32 pdr_frame_size;
66 __u32 pdr_frame_nr;
67 __u32 pdr_retire_tmo;
68 __u32 pdr_sizeof_priv;
69 __u32 pdr_features;
70};
71
72#endif
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 94048547f29a..0cc45ae1afd5 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -116,5 +116,14 @@ static inline void pps_get_ts(struct pps_event_time *ts)
116 116
117#endif /* CONFIG_NTP_PPS */ 117#endif /* CONFIG_NTP_PPS */
118 118
119/* Subtract known time delay from PPS event time(s) */
120static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec delta)
121{
122 ts->ts_real = timespec_sub(ts->ts_real, delta);
123#ifdef CONFIG_NTP_PPS
124 ts->ts_raw = timespec_sub(ts->ts_raw, delta);
125#endif
126}
127
119#endif /* LINUX_PPS_KERNEL_H */ 128#endif /* LINUX_PPS_KERNEL_H */
120 129
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 945704c2ed65..f2dc6d8fc680 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -21,6 +21,8 @@
21#ifndef _PTP_CLOCK_KERNEL_H_ 21#ifndef _PTP_CLOCK_KERNEL_H_
22#define _PTP_CLOCK_KERNEL_H_ 22#define _PTP_CLOCK_KERNEL_H_
23 23
24#include <linux/device.h>
25#include <linux/pps_kernel.h>
24#include <linux/ptp_clock.h> 26#include <linux/ptp_clock.h>
25 27
26 28
@@ -40,7 +42,9 @@ struct ptp_clock_request {
40 * struct ptp_clock_info - decribes a PTP hardware clock 42 * struct ptp_clock_info - decribes a PTP hardware clock
41 * 43 *
42 * @owner: The clock driver should set to THIS_MODULE. 44 * @owner: The clock driver should set to THIS_MODULE.
43 * @name: A short name to identify the clock. 45 * @name: A short "friendly name" to identify the clock and to
46 * help distinguish PHY based devices from MAC based ones.
47 * The string is not meant to be a unique id.
44 * @max_adj: The maximum possible frequency adjustment, in parts per billon. 48 * @max_adj: The maximum possible frequency adjustment, in parts per billon.
45 * @n_alarm: The number of programmable alarms. 49 * @n_alarm: The number of programmable alarms.
46 * @n_ext_ts: The number of external time stamp channels. 50 * @n_ext_ts: The number of external time stamp channels.
@@ -92,10 +96,12 @@ struct ptp_clock;
92/** 96/**
93 * ptp_clock_register() - register a PTP hardware clock driver 97 * ptp_clock_register() - register a PTP hardware clock driver
94 * 98 *
95 * @info: Structure describing the new clock. 99 * @info: Structure describing the new clock.
100 * @parent: Pointer to the parent device of the new clock.
96 */ 101 */
97 102
98extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info); 103extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
104 struct device *parent);
99 105
100/** 106/**
101 * ptp_clock_unregister() - unregister a PTP hardware clock driver 107 * ptp_clock_unregister() - unregister a PTP hardware clock driver
@@ -110,6 +116,7 @@ enum ptp_clock_events {
110 PTP_CLOCK_ALARM, 116 PTP_CLOCK_ALARM,
111 PTP_CLOCK_EXTTS, 117 PTP_CLOCK_EXTTS,
112 PTP_CLOCK_PPS, 118 PTP_CLOCK_PPS,
119 PTP_CLOCK_PPSUSR,
113}; 120};
114 121
115/** 122/**
@@ -117,13 +124,17 @@ enum ptp_clock_events {
117 * 124 *
118 * @type: One of the ptp_clock_events enumeration values. 125 * @type: One of the ptp_clock_events enumeration values.
119 * @index: Identifies the source of the event. 126 * @index: Identifies the source of the event.
120 * @timestamp: When the event occured. 127 * @timestamp: When the event occurred (%PTP_CLOCK_EXTTS only).
128 * @pps_times: When the event occurred (%PTP_CLOCK_PPSUSR only).
121 */ 129 */
122 130
123struct ptp_clock_event { 131struct ptp_clock_event {
124 int type; 132 int type;
125 int index; 133 int index;
126 u64 timestamp; 134 union {
135 u64 timestamp;
136 struct pps_event_time pps_times;
137 };
127}; 138};
128 139
129/** 140/**
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 6fdf02737e9d..0ec590bb3611 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -354,6 +354,37 @@ static inline bool rfkill_blocked(struct rfkill *rfkill)
354} 354}
355#endif /* RFKILL || RFKILL_MODULE */ 355#endif /* RFKILL || RFKILL_MODULE */
356 356
357
358#ifdef CONFIG_RFKILL_LEDS
359/**
360 * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED.
361 * This function might return a NULL pointer if registering of the
362 * LED trigger failed. Use this as "default_trigger" for the LED.
363 */
364const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
365
366/**
367 * rfkill_set_led_trigger_name -- set the LED trigger name
368 * @rfkill: rfkill struct
369 * @name: LED trigger name
370 *
371 * This function sets the LED trigger name of the radio LED
372 * trigger that rfkill creates. It is optional, but if called
373 * must be called before rfkill_register() to be effective.
374 */
375void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name);
376#else
377static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
378{
379 return NULL;
380}
381
382static inline void
383rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
384{
385}
386#endif
387
357#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
358 389
359#endif /* RFKILL_H */ 390#endif /* RFKILL_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 23bddac4bad8..439d35ab5673 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1529,6 +1529,9 @@ struct task_struct {
1529 * cache last used pipe for splice 1529 * cache last used pipe for splice
1530 */ 1530 */
1531 struct pipe_inode_info *splice_pipe; 1531 struct pipe_inode_info *splice_pipe;
1532
1533 struct page_frag task_frag;
1534
1532#ifdef CONFIG_TASK_DELAY_ACCT 1535#ifdef CONFIG_TASK_DELAY_ACCT
1533 struct task_delay_info *delays; 1536 struct task_delay_info *delays;
1534#endif 1537#endif
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 83c44eefe698..68a04a343cad 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -13,6 +13,7 @@ struct file;
13struct path; 13struct path;
14struct inode; 14struct inode;
15struct dentry; 15struct dentry;
16struct user_namespace;
16 17
17struct seq_file { 18struct seq_file {
18 char *buf; 19 char *buf;
@@ -25,6 +26,9 @@ struct seq_file {
25 struct mutex lock; 26 struct mutex lock;
26 const struct seq_operations *op; 27 const struct seq_operations *op;
27 int poll_event; 28 int poll_event;
29#ifdef CONFIG_USER_NS
30 struct user_namespace *user_ns;
31#endif
28 void *private; 32 void *private;
29}; 33};
30 34
@@ -128,6 +132,16 @@ int seq_put_decimal_ull(struct seq_file *m, char delimiter,
128int seq_put_decimal_ll(struct seq_file *m, char delimiter, 132int seq_put_decimal_ll(struct seq_file *m, char delimiter,
129 long long num); 133 long long num);
130 134
135static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
136{
137#ifdef CONFIG_USER_NS
138 return seq->user_ns;
139#else
140 extern struct user_namespace init_user_ns;
141 return &init_user_ns;
142#endif
143}
144
131#define SEQ_START_TOKEN ((void *)1) 145#define SEQ_START_TOKEN ((void *)1)
132/* 146/*
133 * Helpers for iteration over list_head-s in seq_files 147 * Helpers for iteration over list_head-s in seq_files
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7632c87da2c9..b33a3a1f205e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -846,13 +846,16 @@ static inline int skb_shared(const struct sk_buff *skb)
846 * 846 *
847 * NULL is returned on a memory allocation failure. 847 * NULL is returned on a memory allocation failure.
848 */ 848 */
849static inline struct sk_buff *skb_share_check(struct sk_buff *skb, 849static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri)
850 gfp_t pri)
851{ 850{
852 might_sleep_if(pri & __GFP_WAIT); 851 might_sleep_if(pri & __GFP_WAIT);
853 if (skb_shared(skb)) { 852 if (skb_shared(skb)) {
854 struct sk_buff *nskb = skb_clone(skb, pri); 853 struct sk_buff *nskb = skb_clone(skb, pri);
855 kfree_skb(skb); 854
855 if (likely(nskb))
856 consume_skb(skb);
857 else
858 kfree_skb(skb);
856 skb = nskb; 859 skb = nskb;
857 } 860 }
858 return skb; 861 return skb;
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 00bc189cb395..fdfba235f9f1 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -18,7 +18,14 @@
18enum 18enum
19{ 19{
20 IPSTATS_MIB_NUM = 0, 20 IPSTATS_MIB_NUM = 0,
21/* frequently written fields in fast path, kept in same cache line */
21 IPSTATS_MIB_INPKTS, /* InReceives */ 22 IPSTATS_MIB_INPKTS, /* InReceives */
23 IPSTATS_MIB_INOCTETS, /* InOctets */
24 IPSTATS_MIB_INDELIVERS, /* InDelivers */
25 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
26 IPSTATS_MIB_OUTPKTS, /* OutRequests */
27 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
28/* other fields */
22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ 29 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */
23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ 30 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */
24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ 31 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */
@@ -26,9 +33,6 @@ enum
26 IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ 33 IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */
27 IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ 34 IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */
28 IPSTATS_MIB_INDISCARDS, /* InDiscards */ 35 IPSTATS_MIB_INDISCARDS, /* InDiscards */
29 IPSTATS_MIB_INDELIVERS, /* InDelivers */
30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
31 IPSTATS_MIB_OUTPKTS, /* OutRequests */
32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ 36 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */
33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ 37 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */
34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ 38 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */
@@ -42,8 +46,6 @@ enum
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 46 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ 47 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ 48 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
45 IPSTATS_MIB_INOCTETS, /* InOctets */
46 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
47 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ 49 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */
48 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ 50 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
49 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ 51 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
@@ -239,6 +241,10 @@ enum
239 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */ 241 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */
240 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */ 242 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */
241 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */ 243 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */
244 LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/
245 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */
246 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
247 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
242 __LINUX_MIB_MAX 248 __LINUX_MIB_MAX
243}; 249};
244 250
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 1a6b0045b06b..c2b02a5c86ae 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -504,7 +504,9 @@
504#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */ 504#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */
505#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */ 505#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */
506#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */ 506#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */
507#define SSB_CHIPCO_FLASHCTL_ST_RSIG 0x03AB /* Read Electronic Signature */ 507#define SSB_CHIPCO_FLASHCTL_ST_RES 0x03AB /* Read Electronic Signature */
508#define SSB_CHIPCO_FLASHCTL_ST_CSA 0x1000 /* Keep chip select asserted */
509#define SSB_CHIPCO_FLASHCTL_ST_SSE 0x0220 /* Sub-sector Erase */
508 510
509/* Status register bits for ST flashes */ 511/* Status register bits for ST flashes */
510#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */ 512#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index b69bdb1e08b6..a1547ea3920d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -76,7 +76,6 @@
76/* Platfrom data for platform device structure's platform_data field */ 76/* Platfrom data for platform device structure's platform_data field */
77 77
78struct stmmac_mdio_bus_data { 78struct stmmac_mdio_bus_data {
79 int bus_id;
80 int (*phy_reset)(void *priv); 79 int (*phy_reset)(void *priv);
81 unsigned int phy_mask; 80 unsigned int phy_mask;
82 int *irqs; 81 int *irqs;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index eb125a4c30b3..67c789ae719c 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -110,6 +110,7 @@ enum {
110#define TCP_REPAIR_QUEUE 20 110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21 111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22 112#define TCP_REPAIR_OPTIONS 22
113#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
113 114
114struct tcp_repair_opt { 115struct tcp_repair_opt {
115 __u32 opt_code; 116 __u32 opt_code;
@@ -246,6 +247,7 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
246/* TCP Fast Open */ 247/* TCP Fast Open */
247#define TCP_FASTOPEN_COOKIE_MIN 4 /* Min Fast Open Cookie size in bytes */ 248#define TCP_FASTOPEN_COOKIE_MIN 4 /* Min Fast Open Cookie size in bytes */
248#define TCP_FASTOPEN_COOKIE_MAX 16 /* Max Fast Open Cookie size in bytes */ 249#define TCP_FASTOPEN_COOKIE_MAX 16 /* Max Fast Open Cookie size in bytes */
250#define TCP_FASTOPEN_COOKIE_SIZE 8 /* the size employed by this impl. */
249 251
250/* TCP Fast Open Cookie as stored in memory */ 252/* TCP Fast Open Cookie as stored in memory */
251struct tcp_fastopen_cookie { 253struct tcp_fastopen_cookie {
@@ -312,9 +314,14 @@ struct tcp_request_sock {
312 /* Only used by TCP MD5 Signature so far. */ 314 /* Only used by TCP MD5 Signature so far. */
313 const struct tcp_request_sock_ops *af_specific; 315 const struct tcp_request_sock_ops *af_specific;
314#endif 316#endif
317 struct sock *listener; /* needed for TFO */
315 u32 rcv_isn; 318 u32 rcv_isn;
316 u32 snt_isn; 319 u32 snt_isn;
317 u32 snt_synack; /* synack sent time */ 320 u32 snt_synack; /* synack sent time */
321 u32 rcv_nxt; /* the ack # by SYNACK. For
322 * FastOpen it's the seq#
323 * after data-in-SYN.
324 */
318}; 325};
319 326
320static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) 327static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
@@ -505,14 +512,18 @@ struct tcp_sock {
505 struct tcp_md5sig_info __rcu *md5sig_info; 512 struct tcp_md5sig_info __rcu *md5sig_info;
506#endif 513#endif
507 514
508/* TCP fastopen related information */
509 struct tcp_fastopen_request *fastopen_req;
510
511 /* When the cookie options are generated and exchanged, then this 515 /* When the cookie options are generated and exchanged, then this
512 * object holds a reference to them (cookie_values->kref). Also 516 * object holds a reference to them (cookie_values->kref). Also
513 * contains related tcp_cookie_transactions fields. 517 * contains related tcp_cookie_transactions fields.
514 */ 518 */
515 struct tcp_cookie_values *cookie_values; 519 struct tcp_cookie_values *cookie_values;
520
521/* TCP fastopen related information */
522 struct tcp_fastopen_request *fastopen_req;
523 /* fastopen_rsk points to request_sock that resulted in this big
524 * socket. Used to retransmit SYNACKs etc.
525 */
526 struct request_sock *fastopen_rsk;
516}; 527};
517 528
518enum tsq_flags { 529enum tsq_flags {
@@ -552,6 +563,38 @@ static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
552 return (struct tcp_timewait_sock *)sk; 563 return (struct tcp_timewait_sock *)sk;
553} 564}
554 565
566static inline bool tcp_passive_fastopen(const struct sock *sk)
567{
568 return (sk->sk_state == TCP_SYN_RECV &&
569 tcp_sk(sk)->fastopen_rsk != NULL);
570}
571
572static inline bool fastopen_cookie_present(struct tcp_fastopen_cookie *foc)
573{
574 return foc->len != -1;
575}
576
577extern void tcp_sock_destruct(struct sock *sk);
578
579static inline int fastopen_init_queue(struct sock *sk, int backlog)
580{
581 struct request_sock_queue *queue =
582 &inet_csk(sk)->icsk_accept_queue;
583
584 if (queue->fastopenq == NULL) {
585 queue->fastopenq = kzalloc(
586 sizeof(struct fastopen_queue),
587 sk->sk_allocation);
588 if (queue->fastopenq == NULL)
589 return -ENOMEM;
590
591 sk->sk_destruct = tcp_sock_destruct;
592 spin_lock_init(&queue->fastopenq->lock);
593 }
594 queue->fastopenq->max_qlen = backlog;
595 return 0;
596}
597
555#endif /* __KERNEL__ */ 598#endif /* __KERNEL__ */
556 599
557#endif /* _LINUX_TCP_H */ 600#endif /* _LINUX_TCP_H */
diff --git a/include/linux/tcp_metrics.h b/include/linux/tcp_metrics.h
new file mode 100644
index 000000000000..cb5157b55f32
--- /dev/null
+++ b/include/linux/tcp_metrics.h
@@ -0,0 +1,54 @@
1/* tcp_metrics.h - TCP Metrics Interface */
2
3#ifndef _LINUX_TCP_METRICS_H
4#define _LINUX_TCP_METRICS_H
5
6#include <linux/types.h>
7
8/* NETLINK_GENERIC related info
9 */
10#define TCP_METRICS_GENL_NAME "tcp_metrics"
11#define TCP_METRICS_GENL_VERSION 0x1
12
13enum tcp_metric_index {
14 TCP_METRIC_RTT,
15 TCP_METRIC_RTTVAR,
16 TCP_METRIC_SSTHRESH,
17 TCP_METRIC_CWND,
18 TCP_METRIC_REORDERING,
19
20 /* Always last. */
21 __TCP_METRIC_MAX,
22};
23
24#define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1)
25
26enum {
27 TCP_METRICS_ATTR_UNSPEC,
28 TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */
29 TCP_METRICS_ATTR_ADDR_IPV6, /* binary */
30 TCP_METRICS_ATTR_AGE, /* msecs */
31 TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */
32 TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */
33 TCP_METRICS_ATTR_VALS, /* nested +1, u32 */
34 TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */
35 TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */
36 TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */
37 TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */
38
39 __TCP_METRICS_ATTR_MAX,
40};
41
42#define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1)
43
44enum {
45 TCP_METRICS_CMD_UNSPEC,
46 TCP_METRICS_CMD_GET,
47 TCP_METRICS_CMD_DEL,
48
49 __TCP_METRICS_CMD_MAX,
50};
51
52#define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1)
53
54#endif /* _LINUX_TCP_METRICS_H */
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index c98928420100..0b1e3f218a36 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -89,8 +89,8 @@
89 89
90#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ 90#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
91#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ 91#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
92#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ 92#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */
93#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 93#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */
94#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ 94#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
95#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ 95#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
96#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ 96#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
@@ -115,8 +115,8 @@
115#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ 115#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
116#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ 116#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
117#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 117#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
118#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 118#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */
119#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 119#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */
120#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ 120#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
121#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ 121#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
122#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ 122#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 089a09d001d1..9e63e76b20e7 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -78,7 +78,7 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
78 int strict); 78 int strict);
79 79
80extern int ipv6_dev_get_saddr(struct net *net, 80extern int ipv6_dev_get_saddr(struct net *net,
81 struct net_device *dev, 81 const struct net_device *dev,
82 const struct in6_addr *daddr, 82 const struct in6_addr *daddr,
83 unsigned int srcprefs, 83 unsigned int srcprefs,
84 struct in6_addr *saddr); 84 struct in6_addr *saddr);
diff --git a/include/net/arp.h b/include/net/arp.h
index 7f7df93f37cd..b630dae03411 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -3,6 +3,7 @@
3#define _ARP_H 3#define _ARP_H
4 4
5#include <linux/if_arp.h> 5#include <linux/if_arp.h>
6#include <linux/hash.h>
6#include <net/neighbour.h> 7#include <net/neighbour.h>
7 8
8 9
@@ -10,7 +11,7 @@ extern struct neigh_table arp_tbl;
10 11
11static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) 12static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd)
12{ 13{
13 u32 val = key ^ dev->ifindex; 14 u32 val = key ^ hash32_ptr(dev);
14 15
15 return val * hash_rnd; 16 return val * hash_rnd;
16} 17}
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 5d2352154cf6..53539acbd81a 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -157,7 +157,7 @@ enum {
157typedef struct ax25_uid_assoc { 157typedef struct ax25_uid_assoc {
158 struct hlist_node uid_node; 158 struct hlist_node uid_node;
159 atomic_t refcount; 159 atomic_t refcount;
160 uid_t uid; 160 kuid_t uid;
161 ax25_address call; 161 ax25_address call;
162} ax25_uid_assoc; 162} ax25_uid_assoc;
163 163
@@ -434,7 +434,7 @@ extern unsigned long ax25_display_timer(struct timer_list *);
434 434
435/* ax25_uid.c */ 435/* ax25_uid.c */
436extern int ax25_uid_policy; 436extern int ax25_uid_policy;
437extern ax25_uid_assoc *ax25_findbyuid(uid_t); 437extern ax25_uid_assoc *ax25_findbyuid(kuid_t);
438extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); 438extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *);
439extern const struct file_operations ax25_uid_fops; 439extern const struct file_operations ax25_uid_fops;
440extern void ax25_uid_free(void); 440extern void ax25_uid_free(void);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 565d4bee1e49..ede036977ae8 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -27,6 +27,7 @@
27 27
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <net/sock.h> 29#include <net/sock.h>
30#include <linux/seq_file.h>
30 31
31#ifndef AF_BLUETOOTH 32#ifndef AF_BLUETOOTH
32#define AF_BLUETOOTH 31 33#define AF_BLUETOOTH 31
@@ -202,6 +203,10 @@ enum {
202struct bt_sock_list { 203struct bt_sock_list {
203 struct hlist_head head; 204 struct hlist_head head;
204 rwlock_t lock; 205 rwlock_t lock;
206#ifdef CONFIG_PROC_FS
207 struct file_operations fops;
208 int (* custom_seq_show)(struct seq_file *, void *);
209#endif
205}; 210};
206 211
207int bt_sock_register(int proto, const struct net_proto_family *ops); 212int bt_sock_register(int proto, const struct net_proto_family *ops);
@@ -292,6 +297,11 @@ extern void hci_sock_cleanup(void);
292extern int bt_sysfs_init(void); 297extern int bt_sysfs_init(void);
293extern void bt_sysfs_cleanup(void); 298extern void bt_sysfs_cleanup(void);
294 299
300extern int bt_procfs_init(struct module* module, struct net *net, const char *name,
301 struct bt_sock_list* sk_list,
302 int (* seq_show)(struct seq_file *, void *));
303extern void bt_procfs_cleanup(struct net *net, const char *name);
304
295extern struct dentry *bt_debugfs; 305extern struct dentry *bt_debugfs;
296 306
297int l2cap_init(void); 307int l2cap_init(void);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ccd723e0f783..23cf413e2acf 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -62,6 +62,15 @@
62/* First BR/EDR Controller shall have ID = 0 */ 62/* First BR/EDR Controller shall have ID = 0 */
63#define HCI_BREDR_ID 0 63#define HCI_BREDR_ID 0
64 64
65/* AMP controller status */
66#define AMP_CTRL_POWERED_DOWN 0x00
67#define AMP_CTRL_BLUETOOTH_ONLY 0x01
68#define AMP_CTRL_NO_CAPACITY 0x02
69#define AMP_CTRL_LOW_CAPACITY 0x03
70#define AMP_CTRL_MEDIUM_CAPACITY 0x04
71#define AMP_CTRL_HIGH_CAPACITY 0x05
72#define AMP_CTRL_FULL_CAPACITY 0x06
73
65/* HCI device quirks */ 74/* HCI device quirks */
66enum { 75enum {
67 HCI_QUIRK_RESET_ON_CLOSE, 76 HCI_QUIRK_RESET_ON_CLOSE,
@@ -1295,6 +1304,8 @@ struct hci_ev_num_comp_blocks {
1295} __packed; 1304} __packed;
1296 1305
1297/* Low energy meta events */ 1306/* Low energy meta events */
1307#define LE_CONN_ROLE_MASTER 0x00
1308
1298#define HCI_EV_LE_CONN_COMPLETE 0x01 1309#define HCI_EV_LE_CONN_COMPLETE 0x01
1299struct hci_ev_le_conn_complete { 1310struct hci_ev_le_conn_complete {
1300 __u8 status; 1311 __u8 status;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 475b8c04ba52..41d943926d2c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -115,12 +115,6 @@ struct oob_data {
115 u8 randomizer[16]; 115 u8 randomizer[16];
116}; 116};
117 117
118struct adv_entry {
119 struct list_head list;
120 bdaddr_t bdaddr;
121 u8 bdaddr_type;
122};
123
124struct le_scan_params { 118struct le_scan_params {
125 u8 type; 119 u8 type;
126 u16 interval; 120 u16 interval;
@@ -356,16 +350,16 @@ extern rwlock_t hci_cb_list_lock;
356 350
357/* ----- HCI interface to upper protocols ----- */ 351/* ----- HCI interface to upper protocols ----- */
358extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 352extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
359extern int l2cap_connect_cfm(struct hci_conn *hcon, u8 status); 353extern void l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
360extern int l2cap_disconn_ind(struct hci_conn *hcon); 354extern int l2cap_disconn_ind(struct hci_conn *hcon);
361extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); 355extern void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
362extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); 356extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
363extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 357extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
364 u16 flags); 358 u16 flags);
365 359
366extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 360extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
367extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status); 361extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
368extern int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 362extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
369extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); 363extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
370 364
371/* ----- Inquiry cache ----- */ 365/* ----- Inquiry cache ----- */
@@ -587,8 +581,7 @@ void hci_conn_put_device(struct hci_conn *conn);
587 581
588static inline void hci_conn_hold(struct hci_conn *conn) 582static inline void hci_conn_hold(struct hci_conn *conn)
589{ 583{
590 BT_DBG("hcon %p refcnt %d -> %d", conn, atomic_read(&conn->refcnt), 584 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt));
591 atomic_read(&conn->refcnt) + 1);
592 585
593 atomic_inc(&conn->refcnt); 586 atomic_inc(&conn->refcnt);
594 cancel_delayed_work(&conn->disc_work); 587 cancel_delayed_work(&conn->disc_work);
@@ -596,8 +589,7 @@ static inline void hci_conn_hold(struct hci_conn *conn)
596 589
597static inline void hci_conn_put(struct hci_conn *conn) 590static inline void hci_conn_put(struct hci_conn *conn)
598{ 591{
599 BT_DBG("hcon %p refcnt %d -> %d", conn, atomic_read(&conn->refcnt), 592 BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt));
600 atomic_read(&conn->refcnt) - 1);
601 593
602 if (atomic_dec_and_test(&conn->refcnt)) { 594 if (atomic_dec_and_test(&conn->refcnt)) {
603 unsigned long timeo; 595 unsigned long timeo;
@@ -1056,7 +1048,7 @@ int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1056int mgmt_interleaved_discovery(struct hci_dev *hdev); 1048int mgmt_interleaved_discovery(struct hci_dev *hdev);
1057int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1049int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1058int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1050int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1059 1051bool mgmt_valid_hdev(struct hci_dev *hdev);
1060int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1052int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
1061 1053
1062/* HCI info for socket */ 1054/* HCI info for socket */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index a7679f8913d2..d206296137e2 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -671,20 +671,8 @@ enum {
671 L2CAP_EV_RECV_FRAME, 671 L2CAP_EV_RECV_FRAME,
672}; 672};
673 673
674static inline void l2cap_chan_hold(struct l2cap_chan *c) 674void l2cap_chan_hold(struct l2cap_chan *c);
675{ 675void l2cap_chan_put(struct l2cap_chan *c);
676 BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->refcnt));
677
678 atomic_inc(&c->refcnt);
679}
680
681static inline void l2cap_chan_put(struct l2cap_chan *c)
682{
683 BT_DBG("chan %p orig refcnt %d", c, atomic_read(&c->refcnt));
684
685 if (atomic_dec_and_test(&c->refcnt))
686 kfree(c);
687}
688 676
689static inline void l2cap_chan_lock(struct l2cap_chan *chan) 677static inline void l2cap_chan_lock(struct l2cap_chan *chan)
690{ 678{
@@ -771,7 +759,6 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
771 759
772struct l2cap_chan *l2cap_chan_create(void); 760struct l2cap_chan *l2cap_chan_create(void);
773void l2cap_chan_close(struct l2cap_chan *chan, int reason); 761void l2cap_chan_close(struct l2cap_chan *chan, int reason);
774void l2cap_chan_destroy(struct l2cap_chan *chan);
775int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 762int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
776 bdaddr_t *dst, u8 dst_type); 763 bdaddr_t *dst, u8 dst_type);
777int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 764int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 8b27927b2a55..f8ba07f3e5fa 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -108,8 +108,8 @@ struct smp_cmd_security_req {
108#define SMP_CONFIRM_FAILED 0x04 108#define SMP_CONFIRM_FAILED 0x04
109#define SMP_PAIRING_NOTSUPP 0x05 109#define SMP_PAIRING_NOTSUPP 0x05
110#define SMP_ENC_KEY_SIZE 0x06 110#define SMP_ENC_KEY_SIZE 0x06
111#define SMP_CMD_NOTSUPP 0x07 111#define SMP_CMD_NOTSUPP 0x07
112#define SMP_UNSPECIFIED 0x08 112#define SMP_UNSPECIFIED 0x08
113#define SMP_REPEATED_ATTEMPTS 0x09 113#define SMP_REPEATED_ATTEMPTS 0x09
114 114
115#define SMP_MIN_ENC_KEY_SIZE 7 115#define SMP_MIN_ENC_KEY_SIZE 7
@@ -123,8 +123,8 @@ struct smp_chan {
123 struct l2cap_conn *conn; 123 struct l2cap_conn *conn;
124 u8 preq[7]; /* SMP Pairing Request */ 124 u8 preq[7]; /* SMP Pairing Request */
125 u8 prsp[7]; /* SMP Pairing Response */ 125 u8 prsp[7]; /* SMP Pairing Response */
126 u8 prnd[16]; /* SMP Pairing Random (local) */ 126 u8 prnd[16]; /* SMP Pairing Random (local) */
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
130 u8 enc_key_size; 130 u8 enc_key_size;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3d254e10ff30..a9a2be78e73c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -245,6 +245,7 @@ struct ieee80211_sta_vht_cap {
245 * rates" IE, i.e. CCK rates first, then OFDM. 245 * rates" IE, i.e. CCK rates first, then OFDM.
246 * @n_bitrates: Number of bitrates in @bitrates 246 * @n_bitrates: Number of bitrates in @bitrates
247 * @ht_cap: HT capabilities in this band 247 * @ht_cap: HT capabilities in this band
248 * @vht_cap: VHT capabilities in this band
248 */ 249 */
249struct ieee80211_supported_band { 250struct ieee80211_supported_band {
250 struct ieee80211_channel *channels; 251 struct ieee80211_channel *channels;
@@ -1439,7 +1440,8 @@ struct cfg80211_gtk_rekey_data {
1439 * @add_virtual_intf: create a new virtual interface with the given name, 1440 * @add_virtual_intf: create a new virtual interface with the given name,
1440 * must set the struct wireless_dev's iftype. Beware: You must create 1441 * must set the struct wireless_dev's iftype. Beware: You must create
1441 * the new netdev in the wiphy's network namespace! Returns the struct 1442 * the new netdev in the wiphy's network namespace! Returns the struct
1442 * wireless_dev, or an ERR_PTR. 1443 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
1444 * also set the address member in the wdev.
1443 * 1445 *
1444 * @del_virtual_intf: remove the virtual interface 1446 * @del_virtual_intf: remove the virtual interface
1445 * 1447 *
@@ -1618,6 +1620,9 @@ struct cfg80211_gtk_rekey_data {
1618 * @get_channel: Get the current operating channel for the virtual interface. 1620 * @get_channel: Get the current operating channel for the virtual interface.
1619 * For monitor interfaces, it should return %NULL unless there's a single 1621 * For monitor interfaces, it should return %NULL unless there's a single
1620 * current monitoring channel. 1622 * current monitoring channel.
1623 *
1624 * @start_p2p_device: Start the given P2P device.
1625 * @stop_p2p_device: Stop the given P2P device.
1621 */ 1626 */
1622struct cfg80211_ops { 1627struct cfg80211_ops {
1623 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1628 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1834,6 +1839,11 @@ struct cfg80211_ops {
1834 (*get_channel)(struct wiphy *wiphy, 1839 (*get_channel)(struct wiphy *wiphy,
1835 struct wireless_dev *wdev, 1840 struct wireless_dev *wdev,
1836 enum nl80211_channel_type *type); 1841 enum nl80211_channel_type *type);
1842
1843 int (*start_p2p_device)(struct wiphy *wiphy,
1844 struct wireless_dev *wdev);
1845 void (*stop_p2p_device)(struct wiphy *wiphy,
1846 struct wireless_dev *wdev);
1837}; 1847};
1838 1848
1839/* 1849/*
@@ -2397,6 +2407,8 @@ struct cfg80211_cached_keys;
2397 * @cleanup_work: work struct used for cleanup that can't be done directly 2407 * @cleanup_work: work struct used for cleanup that can't be done directly
2398 * @beacon_interval: beacon interval used on this device for transmitting 2408 * @beacon_interval: beacon interval used on this device for transmitting
2399 * beacons, 0 when not valid 2409 * beacons, 0 when not valid
2410 * @address: The address for this device, valid only if @netdev is %NULL
2411 * @p2p_started: true if this is a P2P Device that has been started
2400 */ 2412 */
2401struct wireless_dev { 2413struct wireless_dev {
2402 struct wiphy *wiphy; 2414 struct wiphy *wiphy;
@@ -2415,7 +2427,9 @@ struct wireless_dev {
2415 2427
2416 struct work_struct cleanup_work; 2428 struct work_struct cleanup_work;
2417 2429
2418 bool use_4addr; 2430 bool use_4addr, p2p_started;
2431
2432 u8 address[ETH_ALEN] __aligned(sizeof(u16));
2419 2433
2420 /* currently used for IBSS and SME - might be rearranged later */ 2434 /* currently used for IBSS and SME - might be rearranged later */
2421 u8 ssid[IEEE80211_MAX_SSID_LEN]; 2435 u8 ssid[IEEE80211_MAX_SSID_LEN];
@@ -2445,7 +2459,7 @@ struct wireless_dev {
2445 2459
2446 int beacon_interval; 2460 int beacon_interval;
2447 2461
2448 u32 ap_unexpected_nlpid; 2462 u32 ap_unexpected_nlportid;
2449 2463
2450#ifdef CONFIG_CFG80211_WEXT 2464#ifdef CONFIG_CFG80211_WEXT
2451 /* wext data */ 2465 /* wext data */
@@ -2463,6 +2477,13 @@ struct wireless_dev {
2463#endif 2477#endif
2464}; 2478};
2465 2479
2480static inline u8 *wdev_address(struct wireless_dev *wdev)
2481{
2482 if (wdev->netdev)
2483 return wdev->netdev->dev_addr;
2484 return wdev->address;
2485}
2486
2466/** 2487/**
2467 * wdev_priv - return wiphy priv from wireless_dev 2488 * wdev_priv - return wiphy priv from wireless_dev
2468 * 2489 *
@@ -3530,6 +3551,22 @@ void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
3530 */ 3551 */
3531u32 cfg80211_calculate_bitrate(struct rate_info *rate); 3552u32 cfg80211_calculate_bitrate(struct rate_info *rate);
3532 3553
3554/**
3555 * cfg80211_unregister_wdev - remove the given wdev
3556 * @wdev: struct wireless_dev to remove
3557 *
3558 * Call this function only for wdevs that have no netdev assigned,
3559 * e.g. P2P Devices. It removes the device from the list so that
3560 * it can no longer be used. It is necessary to call this function
3561 * even when cfg80211 requests the removal of the interface by
3562 * calling the del_virtual_intf() callback. The function must also
3563 * be called when the driver wishes to unregister the wdev, e.g.
3564 * when the device is unbound from the driver.
3565 *
3566 * Requires the RTNL to be held.
3567 */
3568void cfg80211_unregister_wdev(struct wireless_dev *wdev);
3569
3533/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3570/* Logging, debugging and troubleshooting/diagnostic helpers. */
3534 3571
3535/* wiphy_printk helpers, similar to dev_printk */ 3572/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index ba55d8b8c87c..600d1d705bb8 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -109,6 +109,9 @@ static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
109struct sk_buff; 109struct sk_buff;
110extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, 110extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
111 __be32 from, __be32 to, int pseudohdr); 111 __be32 from, __be32 to, int pseudohdr);
112extern void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
113 const __be32 *from, const __be32 *to,
114 int pseudohdr);
112 115
113static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, 116static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
114 __be16 from, __be16 to, 117 __be16 from, __be16 to,
diff --git a/include/net/dst.h b/include/net/dst.h
index 621e3513ef5e..9a7881066fb3 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -396,11 +396,15 @@ static inline void dst_confirm(struct dst_entry *dst)
396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n, 396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n,
397 struct sk_buff *skb) 397 struct sk_buff *skb)
398{ 398{
399 struct hh_cache *hh; 399 const struct hh_cache *hh;
400
401 if (dst->pending_confirm) {
402 unsigned long now = jiffies;
400 403
401 if (unlikely(dst->pending_confirm)) {
402 n->confirmed = jiffies;
403 dst->pending_confirm = 0; 404 dst->pending_confirm = 0;
405 /* avoid dirtying neighbour */
406 if (n->confirmed != now)
407 n->confirmed = now;
404 } 408 }
405 409
406 hh = &n->hh; 410 hh = &n->hh;
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 48905cd3884c..bdfbe68c1c3b 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -65,7 +65,7 @@ struct genl_family {
65/** 65/**
66 * struct genl_info - receiving information 66 * struct genl_info - receiving information
67 * @snd_seq: sending sequence number 67 * @snd_seq: sending sequence number
68 * @snd_pid: netlink pid of sender 68 * @snd_portid: netlink portid of sender
69 * @nlhdr: netlink message header 69 * @nlhdr: netlink message header
70 * @genlhdr: generic netlink message header 70 * @genlhdr: generic netlink message header
71 * @userhdr: user specific header 71 * @userhdr: user specific header
@@ -75,7 +75,7 @@ struct genl_family {
75 */ 75 */
76struct genl_info { 76struct genl_info {
77 u32 snd_seq; 77 u32 snd_seq;
78 u32 snd_pid; 78 u32 snd_portid;
79 struct nlmsghdr * nlhdr; 79 struct nlmsghdr * nlhdr;
80 struct genlmsghdr * genlhdr; 80 struct genlmsghdr * genlhdr;
81 void * userhdr; 81 void * userhdr;
@@ -130,10 +130,10 @@ extern int genl_register_mc_group(struct genl_family *family,
130 struct genl_multicast_group *grp); 130 struct genl_multicast_group *grp);
131extern void genl_unregister_mc_group(struct genl_family *family, 131extern void genl_unregister_mc_group(struct genl_family *family,
132 struct genl_multicast_group *grp); 132 struct genl_multicast_group *grp);
133extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, 133extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
134 u32 group, struct nlmsghdr *nlh, gfp_t flags); 134 u32 group, struct nlmsghdr *nlh, gfp_t flags);
135 135
136void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 136void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
137 struct genl_family *family, int flags, u8 cmd); 137 struct genl_family *family, int flags, u8 cmd);
138 138
139/** 139/**
@@ -183,7 +183,7 @@ static inline void *genlmsg_put_reply(struct sk_buff *skb,
183 struct genl_family *family, 183 struct genl_family *family,
184 int flags, u8 cmd) 184 int flags, u8 cmd)
185{ 185{
186 return genlmsg_put(skb, info->snd_pid, info->snd_seq, family, 186 return genlmsg_put(skb, info->snd_portid, info->snd_seq, family,
187 flags, cmd); 187 flags, cmd);
188} 188}
189 189
@@ -212,49 +212,49 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
212 * genlmsg_multicast_netns - multicast a netlink message to a specific netns 212 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
213 * @net: the net namespace 213 * @net: the net namespace
214 * @skb: netlink message as socket buffer 214 * @skb: netlink message as socket buffer
215 * @pid: own netlink pid to avoid sending to yourself 215 * @portid: own netlink portid to avoid sending to yourself
216 * @group: multicast group id 216 * @group: multicast group id
217 * @flags: allocation flags 217 * @flags: allocation flags
218 */ 218 */
219static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb, 219static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
220 u32 pid, unsigned int group, gfp_t flags) 220 u32 portid, unsigned int group, gfp_t flags)
221{ 221{
222 return nlmsg_multicast(net->genl_sock, skb, pid, group, flags); 222 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
223} 223}
224 224
225/** 225/**
226 * genlmsg_multicast - multicast a netlink message to the default netns 226 * genlmsg_multicast - multicast a netlink message to the default netns
227 * @skb: netlink message as socket buffer 227 * @skb: netlink message as socket buffer
228 * @pid: own netlink pid to avoid sending to yourself 228 * @portid: own netlink portid to avoid sending to yourself
229 * @group: multicast group id 229 * @group: multicast group id
230 * @flags: allocation flags 230 * @flags: allocation flags
231 */ 231 */
232static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 232static inline int genlmsg_multicast(struct sk_buff *skb, u32 portid,
233 unsigned int group, gfp_t flags) 233 unsigned int group, gfp_t flags)
234{ 234{
235 return genlmsg_multicast_netns(&init_net, skb, pid, group, flags); 235 return genlmsg_multicast_netns(&init_net, skb, portid, group, flags);
236} 236}
237 237
238/** 238/**
239 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces 239 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
240 * @skb: netlink message as socket buffer 240 * @skb: netlink message as socket buffer
241 * @pid: own netlink pid to avoid sending to yourself 241 * @portid: own netlink portid to avoid sending to yourself
242 * @group: multicast group id 242 * @group: multicast group id
243 * @flags: allocation flags 243 * @flags: allocation flags
244 * 244 *
245 * This function must hold the RTNL or rcu_read_lock(). 245 * This function must hold the RTNL or rcu_read_lock().
246 */ 246 */
247int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, 247int genlmsg_multicast_allns(struct sk_buff *skb, u32 portid,
248 unsigned int group, gfp_t flags); 248 unsigned int group, gfp_t flags);
249 249
250/** 250/**
251 * genlmsg_unicast - unicast a netlink message 251 * genlmsg_unicast - unicast a netlink message
252 * @skb: netlink message as socket buffer 252 * @skb: netlink message as socket buffer
253 * @pid: netlink pid of the destination socket 253 * @portid: netlink portid of the destination socket
254 */ 254 */
255static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid) 255static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid)
256{ 256{
257 return nlmsg_unicast(net->genl_sock, skb, pid); 257 return nlmsg_unicast(net->genl_sock, skb, portid);
258} 258}
259 259
260/** 260/**
@@ -264,7 +264,7 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
264 */ 264 */
265static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) 265static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
266{ 266{
267 return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid); 267 return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid);
268} 268}
269 269
270/** 270/**
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 71392545d0a1..7f0df133d119 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -183,6 +183,9 @@ struct ieee80211_radiotap_header {
183 * Contains a bitmap of known fields/flags, the flags, and 183 * Contains a bitmap of known fields/flags, the flags, and
184 * the MCS index. 184 * the MCS index.
185 * 185 *
186 * IEEE80211_RADIOTAP_AMPDU_STATUS u32, u16, u8, u8 unitless
187 *
188 * Contains the AMPDU information for the subframe.
186 */ 189 */
187enum ieee80211_radiotap_type { 190enum ieee80211_radiotap_type {
188 IEEE80211_RADIOTAP_TSFT = 0, 191 IEEE80211_RADIOTAP_TSFT = 0,
@@ -205,6 +208,7 @@ enum ieee80211_radiotap_type {
205 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 208 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
206 209
207 IEEE80211_RADIOTAP_MCS = 19, 210 IEEE80211_RADIOTAP_MCS = 19,
211 IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
208 212
209 /* valid in every it_present bitmap, even vendor namespaces */ 213 /* valid in every it_present bitmap, even vendor namespaces */
210 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, 214 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
@@ -270,6 +274,13 @@ enum ieee80211_radiotap_type {
270#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 274#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08
271#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 275#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
272 276
277/* For IEEE80211_RADIOTAP_AMPDU_STATUS */
278#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001
279#define IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN 0x0002
280#define IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN 0x0004
281#define IEEE80211_RADIOTAP_AMPDU_IS_LAST 0x0008
282#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR 0x0010
283#define IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN 0x0020
273 284
274/* helpers */ 285/* helpers */
275static inline int ieee80211_get_radiotap_len(unsigned char *data) 286static inline int ieee80211_get_radiotap_len(unsigned char *data)
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 2fa14691869c..aab73757bc4d 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -15,6 +15,8 @@ enum {
15 INET_ECN_MASK = 3, 15 INET_ECN_MASK = 3,
16}; 16};
17 17
18extern int sysctl_tunnel_ecn_log;
19
18static inline int INET_ECN_is_ce(__u8 dsfield) 20static inline int INET_ECN_is_ce(__u8 dsfield)
19{ 21{
20 return (dsfield & INET_ECN_MASK) == INET_ECN_CE; 22 return (dsfield & INET_ECN_MASK) == INET_ECN_CE;
@@ -145,4 +147,78 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
145 return 0; 147 return 0;
146} 148}
147 149
150/*
151 * RFC 6080 4.2
152 * To decapsulate the inner header at the tunnel egress, a compliant
153 * tunnel egress MUST set the outgoing ECN field to the codepoint at the
154 * intersection of the appropriate arriving inner header (row) and outer
155 * header (column) in Figure 4
156 *
157 * +---------+------------------------------------------------+
158 * |Arriving | Arriving Outer Header |
159 * | Inner +---------+------------+------------+------------+
160 * | Header | Not-ECT | ECT(0) | ECT(1) | CE |
161 * +---------+---------+------------+------------+------------+
162 * | Not-ECT | Not-ECT |Not-ECT(!!!)|Not-ECT(!!!)| <drop>(!!!)|
163 * | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE |
164 * | ECT(1) | ECT(1) | ECT(1) (!) | ECT(1) | CE |
165 * | CE | CE | CE | CE(!!!)| CE |
166 * +---------+---------+------------+------------+------------+
167 *
168 * Figure 4: New IP in IP Decapsulation Behaviour
169 *
170 * returns 0 on success
171 * 1 if something is broken and should be logged (!!! above)
172 * 2 if packet should be dropped
173 */
174static inline int INET_ECN_decapsulate(struct sk_buff *skb,
175 __u8 outer, __u8 inner)
176{
177 if (INET_ECN_is_not_ect(inner)) {
178 switch (outer & INET_ECN_MASK) {
179 case INET_ECN_NOT_ECT:
180 return 0;
181 case INET_ECN_ECT_0:
182 case INET_ECN_ECT_1:
183 return 1;
184 case INET_ECN_CE:
185 return 2;
186 }
187 }
188
189 if (INET_ECN_is_ce(outer))
190 INET_ECN_set_ce(skb);
191
192 return 0;
193}
194
195static inline int IP_ECN_decapsulate(const struct iphdr *oiph,
196 struct sk_buff *skb)
197{
198 __u8 inner;
199
200 if (skb->protocol == htons(ETH_P_IP))
201 inner = ip_hdr(skb)->tos;
202 else if (skb->protocol == htons(ETH_P_IPV6))
203 inner = ipv6_get_dsfield(ipv6_hdr(skb));
204 else
205 return 0;
206
207 return INET_ECN_decapsulate(skb, oiph->tos, inner);
208}
209
210static inline int IP6_ECN_decapsulate(const struct ipv6hdr *oipv6h,
211 struct sk_buff *skb)
212{
213 __u8 inner;
214
215 if (skb->protocol == htons(ETH_P_IP))
216 inner = ip_hdr(skb)->tos;
217 else if (skb->protocol == htons(ETH_P_IPV6))
218 inner = ipv6_get_dsfield(ipv6_hdr(skb));
219 else
220 return 0;
221
222 return INET_ECN_decapsulate(skb, ipv6_get_dsfield(oipv6h), inner);
223}
148#endif 224#endif
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 2431cf83aeca..32786a044718 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -29,6 +29,8 @@ struct inet_frag_queue {
29#define INET_FRAG_COMPLETE 4 29#define INET_FRAG_COMPLETE 4
30#define INET_FRAG_FIRST_IN 2 30#define INET_FRAG_FIRST_IN 2
31#define INET_FRAG_LAST_IN 1 31#define INET_FRAG_LAST_IN 1
32
33 u16 max_size;
32}; 34};
33 35
34#define INETFRAGS_HASHSZ 64 36#define INETFRAGS_HASHSZ 64
@@ -59,7 +61,7 @@ void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
59void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); 61void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
60void inet_frag_destroy(struct inet_frag_queue *q, 62void inet_frag_destroy(struct inet_frag_queue *q,
61 struct inet_frags *f, int *work); 63 struct inet_frags *f, int *work);
62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); 64int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force);
63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 65struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
64 struct inet_frags *f, void *key, unsigned int hash) 66 struct inet_frags *f, void *key, unsigned int hash)
65 __releases(&f->lock); 67 __releases(&f->lock);
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 613cfa401672..256c1ed2d69a 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -101,10 +101,8 @@ struct inet_cork {
101 __be32 addr; 101 __be32 addr;
102 struct ip_options *opt; 102 struct ip_options *opt;
103 unsigned int fragsize; 103 unsigned int fragsize;
104 struct dst_entry *dst;
105 int length; /* Total length of all frames */ 104 int length; /* Total length of all frames */
106 struct page *page; 105 struct dst_entry *dst;
107 u32 off;
108 u8 tx_flags; 106 u8 tx_flags;
109}; 107};
110 108
diff --git a/include/net/ip.h b/include/net/ip.h
index 5a5d84d3d2c6..0707fb9551aa 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -42,6 +42,8 @@ struct inet_skb_parm {
42#define IPSKB_XFRM_TRANSFORMED 4 42#define IPSKB_XFRM_TRANSFORMED 4
43#define IPSKB_FRAG_COMPLETE 8 43#define IPSKB_FRAG_COMPLETE 8
44#define IPSKB_REROUTED 16 44#define IPSKB_REROUTED 16
45
46 u16 frag_max_size;
45}; 47};
46 48
47static inline unsigned int ip_hdrlen(const struct sk_buff *skb) 49static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 9fc7114159e8..8a2a203eb15d 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -37,6 +37,7 @@ struct fib6_config {
37 int fc_ifindex; 37 int fc_ifindex;
38 u32 fc_flags; 38 u32 fc_flags;
39 u32 fc_protocol; 39 u32 fc_protocol;
40 u32 fc_type; /* only 8 bits are used */
40 41
41 struct in6_addr fc_dst; 42 struct in6_addr fc_dst;
42 struct in6_addr fc_src; 43 struct in6_addr fc_src;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 358fb86f57eb..e03047f7090b 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -5,6 +5,8 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/ip6_tunnel.h> 6#include <linux/ip6_tunnel.h>
7 7
8#define IP6TUNNEL_ERR_TIMEO (30*HZ)
9
8/* capable of sending packets */ 10/* capable of sending packets */
9#define IP6_TNL_F_CAP_XMIT 0x10000 11#define IP6_TNL_F_CAP_XMIT 0x10000
10/* capable of receiving packets */ 12/* capable of receiving packets */
@@ -12,15 +14,40 @@
12/* determine capability on a per-packet basis */ 14/* determine capability on a per-packet basis */
13#define IP6_TNL_F_CAP_PER_PACKET 0x40000 15#define IP6_TNL_F_CAP_PER_PACKET 0x40000
14 16
15/* IPv6 tunnel */ 17struct __ip6_tnl_parm {
18 char name[IFNAMSIZ]; /* name of tunnel device */
19 int link; /* ifindex of underlying L2 interface */
20 __u8 proto; /* tunnel protocol */
21 __u8 encap_limit; /* encapsulation limit for tunnel */
22 __u8 hop_limit; /* hop limit for tunnel */
23 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
24 __u32 flags; /* tunnel flags */
25 struct in6_addr laddr; /* local tunnel end-point address */
26 struct in6_addr raddr; /* remote tunnel end-point address */
27
28 __be16 i_flags;
29 __be16 o_flags;
30 __be32 i_key;
31 __be32 o_key;
32};
16 33
34/* IPv6 tunnel */
17struct ip6_tnl { 35struct ip6_tnl {
18 struct ip6_tnl __rcu *next; /* next tunnel in list */ 36 struct ip6_tnl __rcu *next; /* next tunnel in list */
19 struct net_device *dev; /* virtual device associated with tunnel */ 37 struct net_device *dev; /* virtual device associated with tunnel */
20 struct ip6_tnl_parm parms; /* tunnel configuration parameters */ 38 struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
21 struct flowi fl; /* flowi template for xmit */ 39 struct flowi fl; /* flowi template for xmit */
22 struct dst_entry *dst_cache; /* cached dst */ 40 struct dst_entry *dst_cache; /* cached dst */
23 u32 dst_cookie; 41 u32 dst_cookie;
42
43 int err_count;
44 unsigned long err_time;
45
46 /* These fields used only by GRE */
47 __u32 i_seqno; /* The last seen seqno */
48 __u32 o_seqno; /* The last output seqno */
49 int hlen; /* Precalculated GRE header length */
50 int mlink;
24}; 51};
25 52
26/* Tunnel encapsulation limit destination sub-option */ 53/* Tunnel encapsulation limit destination sub-option */
@@ -31,4 +58,14 @@ struct ipv6_tlv_tnl_enc_lim {
31 __u8 encap_limit; /* tunnel encapsulation limit */ 58 __u8 encap_limit; /* tunnel encapsulation limit */
32} __packed; 59} __packed;
33 60
61struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t);
62void ip6_tnl_dst_reset(struct ip6_tnl *t);
63void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst);
64int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
65 const struct in6_addr *raddr);
66int ip6_tnl_xmit_ctl(struct ip6_tnl *t);
67__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
68__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
69 const struct in6_addr *raddr);
70
34#endif 71#endif
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 95374d1696a1..ee75ccdf5188 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -808,8 +808,6 @@ struct netns_ipvs {
808 struct list_head rs_table[IP_VS_RTAB_SIZE]; 808 struct list_head rs_table[IP_VS_RTAB_SIZE];
809 /* ip_vs_app */ 809 /* ip_vs_app */
810 struct list_head app_list; 810 struct list_head app_list;
811 /* ip_vs_ftp */
812 struct ip_vs_app *ftp_app;
813 /* ip_vs_proto */ 811 /* ip_vs_proto */
814 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */ 812 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
815 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE]; 813 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
@@ -890,6 +888,7 @@ struct netns_ipvs {
890 unsigned int sysctl_sync_refresh_period; 888 unsigned int sysctl_sync_refresh_period;
891 int sysctl_sync_retries; 889 int sysctl_sync_retries;
892 int sysctl_nat_icmp_send; 890 int sysctl_nat_icmp_send;
891 int sysctl_pmtu_disc;
893 892
894 /* ip_vs_lblc */ 893 /* ip_vs_lblc */
895 int sysctl_lblc_expiration; 894 int sysctl_lblc_expiration;
@@ -976,6 +975,11 @@ static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
976 return ipvs->sysctl_sync_sock_size; 975 return ipvs->sysctl_sync_sock_size;
977} 976}
978 977
978static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs)
979{
980 return ipvs->sysctl_pmtu_disc;
981}
982
979#else 983#else
980 984
981static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) 985static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -1018,6 +1022,11 @@ static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
1018 return 0; 1022 return 0;
1019} 1023}
1020 1024
1025static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs)
1026{
1027 return 1;
1028}
1029
1021#endif 1030#endif
1022 1031
1023/* 1032/*
@@ -1179,7 +1188,8 @@ extern void ip_vs_service_net_cleanup(struct net *net);
1179 * (from ip_vs_app.c) 1188 * (from ip_vs_app.c)
1180 */ 1189 */
1181#define IP_VS_APP_MAX_PORTS 8 1190#define IP_VS_APP_MAX_PORTS 8
1182extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app); 1191extern struct ip_vs_app *register_ip_vs_app(struct net *net,
1192 struct ip_vs_app *app);
1183extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); 1193extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
1184extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1194extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
1185extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 1195extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 01c34b363a34..979bf6c13141 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -34,6 +34,7 @@
34#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */ 34#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
35#define NEXTHDR_ROUTING 43 /* Routing header. */ 35#define NEXTHDR_ROUTING 43 /* Routing header. */
36#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */ 36#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
37#define NEXTHDR_GRE 47 /* GRE header. */
37#define NEXTHDR_ESP 50 /* Encapsulating security payload. */ 38#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
38#define NEXTHDR_AUTH 51 /* Authentication header. */ 39#define NEXTHDR_AUTH 51 /* Authentication header. */
39#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ 40#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
@@ -222,7 +223,10 @@ struct ip6_flowlabel {
222 struct ipv6_txoptions *opt; 223 struct ipv6_txoptions *opt;
223 unsigned long linger; 224 unsigned long linger;
224 u8 share; 225 u8 share;
225 u32 owner; 226 union {
227 struct pid *pid;
228 kuid_t uid;
229 } owner;
226 unsigned long lastuse; 230 unsigned long lastuse;
227 unsigned long expires; 231 unsigned long expires;
228 struct net *fl_net; 232 struct net *fl_net;
@@ -267,8 +271,17 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
267 271
268extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 272extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
269 273
270int ip6_frag_nqueues(struct net *net); 274#if IS_ENABLED(CONFIG_IPV6)
271int ip6_frag_mem(struct net *net); 275static inline int ip6_frag_nqueues(struct net *net)
276{
277 return net->ipv6.frags.nqueues;
278}
279
280static inline int ip6_frag_mem(struct net *net)
281{
282 return atomic_read(&net->ipv6.frags.mem);
283}
284#endif
272 285
273#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */ 286#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */
274#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */ 287#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */
@@ -407,6 +420,25 @@ struct ip6_create_arg {
407void ip6_frag_init(struct inet_frag_queue *q, void *a); 420void ip6_frag_init(struct inet_frag_queue *q, void *a);
408bool ip6_frag_match(struct inet_frag_queue *q, void *a); 421bool ip6_frag_match(struct inet_frag_queue *q, void *a);
409 422
423/*
424 * Equivalent of ipv4 struct ip
425 */
426struct frag_queue {
427 struct inet_frag_queue q;
428
429 __be32 id; /* fragment id */
430 u32 user;
431 struct in6_addr saddr;
432 struct in6_addr daddr;
433
434 int iif;
435 unsigned int csum;
436 __u16 nhoffset;
437};
438
439void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
440 struct inet_frags *frags);
441
410static inline bool ipv6_addr_any(const struct in6_addr *a) 442static inline bool ipv6_addr_any(const struct in6_addr *a)
411{ 443{
412#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 444#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
diff --git a/include/net/llc.h b/include/net/llc.h
index f2d0fc570527..9e7d7f08ef77 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -151,7 +151,6 @@ extern int sysctl_llc2_ack_timeout;
151extern int sysctl_llc2_busy_timeout; 151extern int sysctl_llc2_busy_timeout;
152extern int sysctl_llc2_p_timeout; 152extern int sysctl_llc2_p_timeout;
153extern int sysctl_llc2_rej_timeout; 153extern int sysctl_llc2_rej_timeout;
154extern int sysctl_llc_station_ack_timeout;
155#else 154#else
156#define llc_sysctl_init() (0) 155#define llc_sysctl_init() (0)
157#define llc_sysctl_exit() do { } while(0) 156#define llc_sysctl_exit() do { } while(0)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bb86aa6f98dd..71f8262fc1df 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -171,6 +171,7 @@ struct ieee80211_low_level_stats {
171 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. 171 * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
172 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) 172 * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode)
173 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) 173 * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
174 * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
174 */ 175 */
175enum ieee80211_bss_change { 176enum ieee80211_bss_change {
176 BSS_CHANGED_ASSOC = 1<<0, 177 BSS_CHANGED_ASSOC = 1<<0,
@@ -190,6 +191,7 @@ enum ieee80211_bss_change {
190 BSS_CHANGED_IDLE = 1<<14, 191 BSS_CHANGED_IDLE = 1<<14,
191 BSS_CHANGED_SSID = 1<<15, 192 BSS_CHANGED_SSID = 1<<15,
192 BSS_CHANGED_AP_PROBE_RESP = 1<<16, 193 BSS_CHANGED_AP_PROBE_RESP = 1<<16,
194 BSS_CHANGED_PS = 1<<17,
193 195
194 /* when adding here, make sure to change ieee80211_reconfig */ 196 /* when adding here, make sure to change ieee80211_reconfig */
195}; 197};
@@ -266,6 +268,8 @@ enum ieee80211_rssi_event {
266 * @idle: This interface is idle. There's also a global idle flag in the 268 * @idle: This interface is idle. There's also a global idle flag in the
267 * hardware config which may be more appropriate depending on what 269 * hardware config which may be more appropriate depending on what
268 * your driver/device needs to do. 270 * your driver/device needs to do.
271 * @ps: power-save mode (STA only). This flag is NOT affected by
272 * offchannel/dynamic_ps operations.
269 * @ssid: The SSID of the current vif. Only valid in AP-mode. 273 * @ssid: The SSID of the current vif. Only valid in AP-mode.
270 * @ssid_len: Length of SSID given in @ssid. 274 * @ssid_len: Length of SSID given in @ssid.
271 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. 275 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
@@ -296,6 +300,7 @@ struct ieee80211_bss_conf {
296 bool arp_filter_enabled; 300 bool arp_filter_enabled;
297 bool qos; 301 bool qos;
298 bool idle; 302 bool idle;
303 bool ps;
299 u8 ssid[IEEE80211_MAX_SSID_LEN]; 304 u8 ssid[IEEE80211_MAX_SSID_LEN];
300 size_t ssid_len; 305 size_t ssid_len;
301 bool hidden_ssid; 306 bool hidden_ssid;
@@ -522,9 +527,6 @@ struct ieee80211_tx_rate {
522 * (2) driver internal use (if applicable) 527 * (2) driver internal use (if applicable)
523 * (3) TX status information - driver tells mac80211 what happened 528 * (3) TX status information - driver tells mac80211 what happened
524 * 529 *
525 * The TX control's sta pointer is only valid during the ->tx call,
526 * it may be NULL.
527 *
528 * @flags: transmit info flags, defined above 530 * @flags: transmit info flags, defined above
529 * @band: the band to transmit on (use for checking for races) 531 * @band: the band to transmit on (use for checking for races)
530 * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC 532 * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
@@ -555,6 +557,7 @@ struct ieee80211_tx_info {
555 struct ieee80211_tx_rate rates[ 557 struct ieee80211_tx_rate rates[
556 IEEE80211_TX_MAX_RATES]; 558 IEEE80211_TX_MAX_RATES];
557 s8 rts_cts_rate_idx; 559 s8 rts_cts_rate_idx;
560 /* 3 bytes free */
558 }; 561 };
559 /* only needed before rate control */ 562 /* only needed before rate control */
560 unsigned long jiffies; 563 unsigned long jiffies;
@@ -562,7 +565,7 @@ struct ieee80211_tx_info {
562 /* NB: vif can be NULL for injected frames */ 565 /* NB: vif can be NULL for injected frames */
563 struct ieee80211_vif *vif; 566 struct ieee80211_vif *vif;
564 struct ieee80211_key_conf *hw_key; 567 struct ieee80211_key_conf *hw_key;
565 struct ieee80211_sta *sta; 568 /* 8 bytes free */
566 } control; 569 } control;
567 struct { 570 struct {
568 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 571 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
@@ -673,21 +676,41 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
673 * @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if 676 * @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if
674 * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT 677 * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT
675 * to hw.radiotap_mcs_details to advertise that fact 678 * to hw.radiotap_mcs_details to advertise that fact
679 * @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference
680 * number (@ampdu_reference) must be populated and be a distinct number for
681 * each A-MPDU
682 * @RX_FLAG_AMPDU_REPORT_ZEROLEN: driver reports 0-length subframes
683 * @RX_FLAG_AMPDU_IS_ZEROLEN: This is a zero-length subframe, for
684 * monitoring purposes only
685 * @RX_FLAG_AMPDU_LAST_KNOWN: last subframe is known, should be set on all
686 * subframes of a single A-MPDU
687 * @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU
688 * @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected
689 * on this subframe
690 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
691 * is stored in the @ampdu_delimiter_crc field)
676 */ 692 */
677enum mac80211_rx_flags { 693enum mac80211_rx_flags {
678 RX_FLAG_MMIC_ERROR = 1<<0, 694 RX_FLAG_MMIC_ERROR = BIT(0),
679 RX_FLAG_DECRYPTED = 1<<1, 695 RX_FLAG_DECRYPTED = BIT(1),
680 RX_FLAG_MMIC_STRIPPED = 1<<3, 696 RX_FLAG_MMIC_STRIPPED = BIT(3),
681 RX_FLAG_IV_STRIPPED = 1<<4, 697 RX_FLAG_IV_STRIPPED = BIT(4),
682 RX_FLAG_FAILED_FCS_CRC = 1<<5, 698 RX_FLAG_FAILED_FCS_CRC = BIT(5),
683 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 699 RX_FLAG_FAILED_PLCP_CRC = BIT(6),
684 RX_FLAG_MACTIME_MPDU = 1<<7, 700 RX_FLAG_MACTIME_MPDU = BIT(7),
685 RX_FLAG_SHORTPRE = 1<<8, 701 RX_FLAG_SHORTPRE = BIT(8),
686 RX_FLAG_HT = 1<<9, 702 RX_FLAG_HT = BIT(9),
687 RX_FLAG_40MHZ = 1<<10, 703 RX_FLAG_40MHZ = BIT(10),
688 RX_FLAG_SHORT_GI = 1<<11, 704 RX_FLAG_SHORT_GI = BIT(11),
689 RX_FLAG_NO_SIGNAL_VAL = 1<<12, 705 RX_FLAG_NO_SIGNAL_VAL = BIT(12),
690 RX_FLAG_HT_GF = 1<<13, 706 RX_FLAG_HT_GF = BIT(13),
707 RX_FLAG_AMPDU_DETAILS = BIT(14),
708 RX_FLAG_AMPDU_REPORT_ZEROLEN = BIT(15),
709 RX_FLAG_AMPDU_IS_ZEROLEN = BIT(16),
710 RX_FLAG_AMPDU_LAST_KNOWN = BIT(17),
711 RX_FLAG_AMPDU_IS_LAST = BIT(18),
712 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19),
713 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20),
691}; 714};
692 715
693/** 716/**
@@ -711,17 +734,22 @@ enum mac80211_rx_flags {
711 * HT rates are use (RX_FLAG_HT) 734 * HT rates are use (RX_FLAG_HT)
712 * @flag: %RX_FLAG_* 735 * @flag: %RX_FLAG_*
713 * @rx_flags: internal RX flags for mac80211 736 * @rx_flags: internal RX flags for mac80211
737 * @ampdu_reference: A-MPDU reference number, must be a different value for
738 * each A-MPDU but the same for each subframe within one A-MPDU
739 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
714 */ 740 */
715struct ieee80211_rx_status { 741struct ieee80211_rx_status {
716 u64 mactime; 742 u64 mactime;
717 u32 device_timestamp; 743 u32 device_timestamp;
718 u16 flag; 744 u32 ampdu_reference;
745 u32 flag;
719 u16 freq; 746 u16 freq;
720 u8 rate_idx; 747 u8 rate_idx;
721 u8 rx_flags; 748 u8 rx_flags;
722 u8 band; 749 u8 band;
723 u8 antenna; 750 u8 antenna;
724 s8 signal; 751 s8 signal;
752 u8 ampdu_delimiter_crc;
725}; 753};
726 754
727/** 755/**
@@ -1074,6 +1102,16 @@ enum sta_notify_cmd {
1074}; 1102};
1075 1103
1076/** 1104/**
1105 * struct ieee80211_tx_control - TX control data
1106 *
1107 * @sta: station table entry, this sta pointer may be NULL and
1108 * it is not allowed to copy the pointer, due to RCU.
1109 */
1110struct ieee80211_tx_control {
1111 struct ieee80211_sta *sta;
1112};
1113
1114/**
1077 * enum ieee80211_hw_flags - hardware flags 1115 * enum ieee80211_hw_flags - hardware flags
1078 * 1116 *
1079 * These flags are used to indicate hardware capabilities to 1117 * These flags are used to indicate hardware capabilities to
@@ -1203,6 +1241,10 @@ enum sta_notify_cmd {
1203 * queue mapping in order to use different queues (not just one per AC) 1241 * queue mapping in order to use different queues (not just one per AC)
1204 * for different virtual interfaces. See the doc section on HW queue 1242 * for different virtual interfaces. See the doc section on HW queue
1205 * control for more details. 1243 * control for more details.
1244 *
1245 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
1246 * P2P Interface. This will be honoured even if more than one interface
1247 * is supported.
1206 */ 1248 */
1207enum ieee80211_hw_flags { 1249enum ieee80211_hw_flags {
1208 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1250 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1230,6 +1272,7 @@ enum ieee80211_hw_flags {
1230 IEEE80211_HW_AP_LINK_PS = 1<<22, 1272 IEEE80211_HW_AP_LINK_PS = 1<<22,
1231 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1273 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1232 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, 1274 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1275 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1233}; 1276};
1234 1277
1235/** 1278/**
@@ -1884,10 +1927,14 @@ enum ieee80211_frame_release_type {
1884 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit 1927 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
1885 * to this station changed. 1928 * to this station changed.
1886 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed. 1929 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
1930 * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer
1931 * changed (in IBSS mode) due to discovering more information about
1932 * the peer.
1887 */ 1933 */
1888enum ieee80211_rate_control_changed { 1934enum ieee80211_rate_control_changed {
1889 IEEE80211_RC_BW_CHANGED = BIT(0), 1935 IEEE80211_RC_BW_CHANGED = BIT(0),
1890 IEEE80211_RC_SMPS_CHANGED = BIT(1), 1936 IEEE80211_RC_SMPS_CHANGED = BIT(1),
1937 IEEE80211_RC_SUPP_RATES_CHANGED = BIT(2),
1891}; 1938};
1892 1939
1893/** 1940/**
@@ -2264,7 +2311,9 @@ enum ieee80211_rate_control_changed {
2264 * The callback is optional and can (should!) sleep. 2311 * The callback is optional and can (should!) sleep.
2265 */ 2312 */
2266struct ieee80211_ops { 2313struct ieee80211_ops {
2267 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 2314 void (*tx)(struct ieee80211_hw *hw,
2315 struct ieee80211_tx_control *control,
2316 struct sk_buff *skb);
2268 int (*start)(struct ieee80211_hw *hw); 2317 int (*start)(struct ieee80211_hw *hw);
2269 void (*stop)(struct ieee80211_hw *hw); 2318 void (*stop)(struct ieee80211_hw *hw);
2270#ifdef CONFIG_PM 2319#ifdef CONFIG_PM
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 96a3b5c03e37..980d263765cf 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -49,6 +49,7 @@ enum {
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/if_arp.h> 50#include <linux/if_arp.h>
51#include <linux/netdevice.h> 51#include <linux/netdevice.h>
52#include <linux/hash.h>
52 53
53#include <net/neighbour.h> 54#include <net/neighbour.h>
54 55
@@ -134,7 +135,7 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
134{ 135{
135 const u32 *p32 = pkey; 136 const u32 *p32 = pkey;
136 137
137 return (((p32[0] ^ dev->ifindex) * hash_rnd[0]) + 138 return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) +
138 (p32[1] * hash_rnd[1]) + 139 (p32[1] * hash_rnd[1]) +
139 (p32[2] * hash_rnd[2]) + 140 (p32[2] * hash_rnd[2]) +
140 (p32[3] * hash_rnd[3])); 141 (p32[3] * hash_rnd[3]));
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 344d8988842a..0dab173e27da 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -334,18 +334,22 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
334} 334}
335#endif 335#endif
336 336
337static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 337static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb)
338{ 338{
339 unsigned int seq; 339 unsigned int seq;
340 int hh_len; 340 int hh_len;
341 341
342 do { 342 do {
343 int hh_alen;
344
345 seq = read_seqbegin(&hh->hh_lock); 343 seq = read_seqbegin(&hh->hh_lock);
346 hh_len = hh->hh_len; 344 hh_len = hh->hh_len;
347 hh_alen = HH_DATA_ALIGN(hh_len); 345 if (likely(hh_len <= HH_DATA_MOD)) {
348 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); 346 /* this is inlined by gcc */
347 memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);
348 } else {
349 int hh_alen = HH_DATA_ALIGN(hh_len);
350
351 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
352 }
349 } while (read_seqretry(&hh->hh_lock, seq)); 353 } while (read_seqretry(&hh->hh_lock, seq));
350 354
351 skb_push(skb, hh_len); 355 skb_push(skb, hh_len);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index fd87963a0ea5..4faf6612ecac 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -15,6 +15,7 @@
15#include <net/netns/packet.h> 15#include <net/netns/packet.h>
16#include <net/netns/ipv4.h> 16#include <net/netns/ipv4.h>
17#include <net/netns/ipv6.h> 17#include <net/netns/ipv6.h>
18#include <net/netns/sctp.h>
18#include <net/netns/dccp.h> 19#include <net/netns/dccp.h>
19#include <net/netns/x_tables.h> 20#include <net/netns/x_tables.h>
20#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 21#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -66,6 +67,7 @@ struct net {
66 struct hlist_head *dev_name_head; 67 struct hlist_head *dev_name_head;
67 struct hlist_head *dev_index_head; 68 struct hlist_head *dev_index_head;
68 unsigned int dev_base_seq; /* protected by rtnl_mutex */ 69 unsigned int dev_base_seq; /* protected by rtnl_mutex */
70 int ifindex;
69 71
70 /* core fib_rules */ 72 /* core fib_rules */
71 struct list_head rules_ops; 73 struct list_head rules_ops;
@@ -80,6 +82,9 @@ struct net {
80#if IS_ENABLED(CONFIG_IPV6) 82#if IS_ENABLED(CONFIG_IPV6)
81 struct netns_ipv6 ipv6; 83 struct netns_ipv6 ipv6;
82#endif 84#endif
85#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
86 struct netns_sctp sctp;
87#endif
83#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 88#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
84 struct netns_dccp dccp; 89 struct netns_dccp dccp;
85#endif 90#endif
@@ -88,6 +93,9 @@ struct net {
88#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 93#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
89 struct netns_ct ct; 94 struct netns_ct ct;
90#endif 95#endif
96#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
97 struct netns_nf_frag nf_frag;
98#endif
91 struct sock *nfnl; 99 struct sock *nfnl;
92 struct sock *nfnl_stash; 100 struct sock *nfnl_stash;
93#endif 101#endif
@@ -105,6 +113,13 @@ struct net {
105 atomic_t rt_genid; 113 atomic_t rt_genid;
106}; 114};
107 115
116/*
117 * ifindex generation is per-net namespace, and loopback is
118 * always the 1st device in ns (see net_dev_init), thus any
119 * loopback device should get ifindex 1
120 */
121
122#define LOOPBACK_IFINDEX 1
108 123
109#include <linux/seq_file_net.h> 124#include <linux/seq_file_net.h>
110 125
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 4a045cda9c60..5654d292efd4 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -17,7 +17,7 @@ struct nf_conntrack_ecache {
17 unsigned long missed; /* missed events */ 17 unsigned long missed; /* missed events */
18 u16 ctmask; /* bitmask of ct events to be delivered */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */ 19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 pid; /* netlink pid of destroyer */ 20 u32 portid; /* netlink portid of destroyer */
21 struct timer_list timeout; 21 struct timer_list timeout;
22}; 22};
23 23
@@ -60,7 +60,7 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
60/* This structure is passed to event handler */ 60/* This structure is passed to event handler */
61struct nf_ct_event { 61struct nf_ct_event {
62 struct nf_conn *ct; 62 struct nf_conn *ct;
63 u32 pid; 63 u32 portid;
64 int report; 64 int report;
65}; 65};
66 66
@@ -92,7 +92,7 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
92static inline int 92static inline int
93nf_conntrack_eventmask_report(unsigned int eventmask, 93nf_conntrack_eventmask_report(unsigned int eventmask,
94 struct nf_conn *ct, 94 struct nf_conn *ct,
95 u32 pid, 95 u32 portid,
96 int report) 96 int report)
97{ 97{
98 int ret = 0; 98 int ret = 0;
@@ -112,11 +112,11 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
112 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) { 112 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
113 struct nf_ct_event item = { 113 struct nf_ct_event item = {
114 .ct = ct, 114 .ct = ct,
115 .pid = e->pid ? e->pid : pid, 115 .portid = e->portid ? e->portid : portid,
116 .report = report 116 .report = report
117 }; 117 };
118 /* This is a resent of a destroy event? If so, skip missed */ 118 /* This is a resent of a destroy event? If so, skip missed */
119 unsigned long missed = e->pid ? 0 : e->missed; 119 unsigned long missed = e->portid ? 0 : e->missed;
120 120
121 if (!((eventmask | missed) & e->ctmask)) 121 if (!((eventmask | missed) & e->ctmask))
122 goto out_unlock; 122 goto out_unlock;
@@ -126,11 +126,11 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
126 spin_lock_bh(&ct->lock); 126 spin_lock_bh(&ct->lock);
127 if (ret < 0) { 127 if (ret < 0) {
128 /* This is a destroy event that has been 128 /* This is a destroy event that has been
129 * triggered by a process, we store the PID 129 * triggered by a process, we store the PORTID
130 * to include it in the retransmission. */ 130 * to include it in the retransmission. */
131 if (eventmask & (1 << IPCT_DESTROY) && 131 if (eventmask & (1 << IPCT_DESTROY) &&
132 e->pid == 0 && pid != 0) 132 e->portid == 0 && portid != 0)
133 e->pid = pid; 133 e->portid = portid;
134 else 134 else
135 e->missed |= eventmask; 135 e->missed |= eventmask;
136 } else 136 } else
@@ -145,9 +145,9 @@ out_unlock:
145 145
146static inline int 146static inline int
147nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, 147nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
148 u32 pid, int report) 148 u32 portid, int report)
149{ 149{
150 return nf_conntrack_eventmask_report(1 << event, ct, pid, report); 150 return nf_conntrack_eventmask_report(1 << event, ct, portid, report);
151} 151}
152 152
153static inline int 153static inline int
@@ -158,7 +158,7 @@ nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
158 158
159struct nf_exp_event { 159struct nf_exp_event {
160 struct nf_conntrack_expect *exp; 160 struct nf_conntrack_expect *exp;
161 u32 pid; 161 u32 portid;
162 int report; 162 int report;
163}; 163};
164 164
@@ -172,7 +172,7 @@ extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_even
172static inline void 172static inline void
173nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 173nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
174 struct nf_conntrack_expect *exp, 174 struct nf_conntrack_expect *exp,
175 u32 pid, 175 u32 portid,
176 int report) 176 int report)
177{ 177{
178 struct net *net = nf_ct_exp_net(exp); 178 struct net *net = nf_ct_exp_net(exp);
@@ -191,7 +191,7 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
191 if (e->expmask & (1 << event)) { 191 if (e->expmask & (1 << event)) {
192 struct nf_exp_event item = { 192 struct nf_exp_event item = {
193 .exp = exp, 193 .exp = exp,
194 .pid = pid, 194 .portid = portid,
195 .report = report 195 .report = report
196 }; 196 };
197 notify->fcn(1 << event, &item); 197 notify->fcn(1 << event, &item);
@@ -216,20 +216,20 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
216 struct nf_conn *ct) {} 216 struct nf_conn *ct) {}
217static inline int nf_conntrack_eventmask_report(unsigned int eventmask, 217static inline int nf_conntrack_eventmask_report(unsigned int eventmask,
218 struct nf_conn *ct, 218 struct nf_conn *ct,
219 u32 pid, 219 u32 portid,
220 int report) { return 0; } 220 int report) { return 0; }
221static inline int nf_conntrack_event(enum ip_conntrack_events event, 221static inline int nf_conntrack_event(enum ip_conntrack_events event,
222 struct nf_conn *ct) { return 0; } 222 struct nf_conn *ct) { return 0; }
223static inline int nf_conntrack_event_report(enum ip_conntrack_events event, 223static inline int nf_conntrack_event_report(enum ip_conntrack_events event,
224 struct nf_conn *ct, 224 struct nf_conn *ct,
225 u32 pid, 225 u32 portid,
226 int report) { return 0; } 226 int report) { return 0; }
227static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 227static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
228static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 228static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
229 struct nf_conntrack_expect *exp) {} 229 struct nf_conntrack_expect *exp) {}
230static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e, 230static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
231 struct nf_conntrack_expect *exp, 231 struct nf_conntrack_expect *exp,
232 u32 pid, 232 u32 portid,
233 int report) {} 233 int report) {}
234 234
235static inline int nf_conntrack_ecache_init(struct net *net) 235static inline int nf_conntrack_ecache_init(struct net *net)
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 983f00263243..cc13f377a705 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -43,7 +43,7 @@ struct nf_conntrack_expect {
43 unsigned int class; 43 unsigned int class;
44 44
45#ifdef CONFIG_NF_NAT_NEEDED 45#ifdef CONFIG_NF_NAT_NEEDED
46 __be32 saved_ip; 46 union nf_inet_addr saved_addr;
47 /* This is the original per-proto part, used to map the 47 /* This is the original per-proto part, used to map the
48 * expected connection the way the recipient expects. */ 48 * expected connection the way the recipient expects. */
49 union nf_conntrack_man_proto saved_proto; 49 union nf_conntrack_man_proto saved_proto;
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index 34ec89f8dbf9..e41e472d08f2 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -55,6 +55,26 @@ struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
55#endif 55#endif
56}; 56};
57 57
58static inline unsigned int *
59nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
60 struct nf_conntrack_l4proto *l4proto)
61{
62#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
63 struct nf_conn_timeout *timeout_ext;
64 unsigned int *timeouts;
65
66 timeout_ext = nf_ct_timeout_find(ct);
67 if (timeout_ext)
68 timeouts = NF_CT_TIMEOUT_EXT_DATA(timeout_ext);
69 else
70 timeouts = l4proto->get_timeouts(net);
71
72 return timeouts;
73#else
74 return l4proto->get_timeouts(net);
75#endif
76}
77
58#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
59extern int nf_conntrack_timeout_init(struct net *net); 79extern int nf_conntrack_timeout_init(struct net *net);
60extern void nf_conntrack_timeout_fini(struct net *net); 80extern void nf_conntrack_timeout_fini(struct net *net);
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index b4de990b55f1..bd8eea720f2e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -43,14 +43,16 @@ struct nf_conn_nat {
43 struct nf_conn *ct; 43 struct nf_conn *ct;
44 union nf_conntrack_nat_help help; 44 union nf_conntrack_nat_help help;
45#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ 45#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
46 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) 46 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) || \
47 defined(CONFIG_IP6_NF_TARGET_MASQUERADE) || \
48 defined(CONFIG_IP6_NF_TARGET_MASQUERADE_MODULE)
47 int masq_index; 49 int masq_index;
48#endif 50#endif
49}; 51};
50 52
51/* Set up the info structure to map into this range. */ 53/* Set up the info structure to map into this range. */
52extern unsigned int nf_nat_setup_info(struct nf_conn *ct, 54extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
53 const struct nf_nat_ipv4_range *range, 55 const struct nf_nat_range *range,
54 enum nf_nat_manip_type maniptype); 56 enum nf_nat_manip_type maniptype);
55 57
56/* Is this tuple already taken? (not by us)*/ 58/* Is this tuple already taken? (not by us)*/
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index b13d8d18d595..972e1e47ec79 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -12,10 +12,7 @@ extern unsigned int nf_nat_packet(struct nf_conn *ct,
12 unsigned int hooknum, 12 unsigned int hooknum,
13 struct sk_buff *skb); 13 struct sk_buff *skb);
14 14
15extern int nf_nat_icmp_reply_translation(struct nf_conn *ct, 15extern int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family);
16 enum ip_conntrack_info ctinfo,
17 unsigned int hooknum,
18 struct sk_buff *skb);
19 16
20static inline int nf_nat_initialized(struct nf_conn *ct, 17static inline int nf_nat_initialized(struct nf_conn *ct,
21 enum nf_nat_manip_type manip) 18 enum nf_nat_manip_type manip)
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 7d8fb7b46c44..b4d6bfc2af03 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -10,6 +10,7 @@ struct sk_buff;
10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11 struct nf_conn *ct, 11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo, 12 enum ip_conntrack_info ctinfo,
13 unsigned int protoff,
13 unsigned int match_offset, 14 unsigned int match_offset,
14 unsigned int match_len, 15 unsigned int match_len,
15 const char *rep_buffer, 16 const char *rep_buffer,
@@ -18,12 +19,13 @@ extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
18static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 19static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
19 struct nf_conn *ct, 20 struct nf_conn *ct,
20 enum ip_conntrack_info ctinfo, 21 enum ip_conntrack_info ctinfo,
22 unsigned int protoff,
21 unsigned int match_offset, 23 unsigned int match_offset,
22 unsigned int match_len, 24 unsigned int match_len,
23 const char *rep_buffer, 25 const char *rep_buffer,
24 unsigned int rep_len) 26 unsigned int rep_len)
25{ 27{
26 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, 28 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
27 match_offset, match_len, 29 match_offset, match_len,
28 rep_buffer, rep_len, true); 30 rep_buffer, rep_len, true);
29} 31}
@@ -31,6 +33,7 @@ static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
31extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 33extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
32 struct nf_conn *ct, 34 struct nf_conn *ct,
33 enum ip_conntrack_info ctinfo, 35 enum ip_conntrack_info ctinfo,
36 unsigned int protoff,
34 unsigned int match_offset, 37 unsigned int match_offset,
35 unsigned int match_len, 38 unsigned int match_len,
36 const char *rep_buffer, 39 const char *rep_buffer,
@@ -41,10 +44,12 @@ extern void nf_nat_set_seq_adjust(struct nf_conn *ct,
41 __be32 seq, s16 off); 44 __be32 seq, s16 off);
42extern int nf_nat_seq_adjust(struct sk_buff *skb, 45extern int nf_nat_seq_adjust(struct sk_buff *skb,
43 struct nf_conn *ct, 46 struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo); 47 enum ip_conntrack_info ctinfo,
48 unsigned int protoff);
45extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb, 49extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
46 struct nf_conn *ct, 50 struct nf_conn *ct,
47 enum ip_conntrack_info ctinfo); 51 enum ip_conntrack_info ctinfo,
52 unsigned int protoff);
48 53
49/* Setup NAT on this expected conntrack so it follows master, but goes 54/* Setup NAT on this expected conntrack so it follows master, but goes
50 * to port ct->master->saved_proto. */ 55 * to port ct->master->saved_proto. */
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
new file mode 100644
index 000000000000..bd3b97e02c82
--- /dev/null
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -0,0 +1,52 @@
1#ifndef _NF_NAT_L3PROTO_H
2#define _NF_NAT_L3PROTO_H
3
4struct nf_nat_l4proto;
5struct nf_nat_l3proto {
6 u8 l3proto;
7
8 bool (*in_range)(const struct nf_conntrack_tuple *t,
9 const struct nf_nat_range *range);
10
11 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
12
13 bool (*manip_pkt)(struct sk_buff *skb,
14 unsigned int iphdroff,
15 const struct nf_nat_l4proto *l4proto,
16 const struct nf_conntrack_tuple *target,
17 enum nf_nat_manip_type maniptype);
18
19 void (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
20 __sum16 *check,
21 const struct nf_conntrack_tuple *t,
22 enum nf_nat_manip_type maniptype);
23
24 void (*csum_recalc)(struct sk_buff *skb, u8 proto,
25 void *data, __sum16 *check,
26 int datalen, int oldlen);
27
28 void (*decode_session)(struct sk_buff *skb,
29 const struct nf_conn *ct,
30 enum ip_conntrack_dir dir,
31 unsigned long statusbit,
32 struct flowi *fl);
33
34 int (*nlattr_to_range)(struct nlattr *tb[],
35 struct nf_nat_range *range);
36};
37
38extern int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
39extern void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
40extern const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
41
42extern int nf_nat_icmp_reply_translation(struct sk_buff *skb,
43 struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo,
45 unsigned int hooknum);
46extern int nf_nat_icmpv6_reply_translation(struct sk_buff *skb,
47 struct nf_conn *ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned int hooknum,
50 unsigned int hdrlen);
51
52#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
new file mode 100644
index 000000000000..24feb68d1bcc
--- /dev/null
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -0,0 +1,72 @@
1/* Header for use in defining a given protocol. */
2#ifndef _NF_NAT_L4PROTO_H
3#define _NF_NAT_L4PROTO_H
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct nf_nat_range;
8struct nf_nat_l3proto;
9
10struct nf_nat_l4proto {
11 /* Protocol number. */
12 u8 l4proto;
13
14 /* Translate a packet to the target according to manip type.
15 * Return true if succeeded.
16 */
17 bool (*manip_pkt)(struct sk_buff *skb,
18 const struct nf_nat_l3proto *l3proto,
19 unsigned int iphdroff, unsigned int hdroff,
20 const struct nf_conntrack_tuple *tuple,
21 enum nf_nat_manip_type maniptype);
22
23 /* Is the manipable part of the tuple between min and max incl? */
24 bool (*in_range)(const struct nf_conntrack_tuple *tuple,
25 enum nf_nat_manip_type maniptype,
26 const union nf_conntrack_man_proto *min,
27 const union nf_conntrack_man_proto *max);
28
29 /* Alter the per-proto part of the tuple (depending on
30 * maniptype), to give a unique tuple in the given range if
31 * possible. Per-protocol part of tuple is initialized to the
32 * incoming packet.
33 */
34 void (*unique_tuple)(const struct nf_nat_l3proto *l3proto,
35 struct nf_conntrack_tuple *tuple,
36 const struct nf_nat_range *range,
37 enum nf_nat_manip_type maniptype,
38 const struct nf_conn *ct);
39
40 int (*nlattr_to_range)(struct nlattr *tb[],
41 struct nf_nat_range *range);
42};
43
44/* Protocol registration. */
45extern int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto);
46extern void nf_nat_l4proto_unregister(u8 l3proto, const struct nf_nat_l4proto *l4proto);
47
48extern const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);
49
50/* Built-in protocols. */
51extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;
52extern const struct nf_nat_l4proto nf_nat_l4proto_udp;
53extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
55extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
56
57extern bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
58 enum nf_nat_manip_type maniptype,
59 const union nf_conntrack_man_proto *min,
60 const union nf_conntrack_man_proto *max);
61
62extern void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
63 struct nf_conntrack_tuple *tuple,
64 const struct nf_nat_range *range,
65 enum nf_nat_manip_type maniptype,
66 const struct nf_conn *ct,
67 u16 *rover);
68
69extern int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
70 struct nf_nat_range *range);
71
72#endif /*_NF_NAT_L4PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
deleted file mode 100644
index 7b0b51165f70..000000000000
--- a/include/net/netfilter/nf_nat_protocol.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/* Header for use in defining a given protocol. */
2#ifndef _NF_NAT_PROTOCOL_H
3#define _NF_NAT_PROTOCOL_H
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct nf_nat_ipv4_range;
8
9struct nf_nat_protocol {
10 /* Protocol number. */
11 unsigned int protonum;
12
13 /* Translate a packet to the target according to manip type.
14 Return true if succeeded. */
15 bool (*manip_pkt)(struct sk_buff *skb,
16 unsigned int iphdroff,
17 const struct nf_conntrack_tuple *tuple,
18 enum nf_nat_manip_type maniptype);
19
20 /* Is the manipable part of the tuple between min and max incl? */
21 bool (*in_range)(const struct nf_conntrack_tuple *tuple,
22 enum nf_nat_manip_type maniptype,
23 const union nf_conntrack_man_proto *min,
24 const union nf_conntrack_man_proto *max);
25
26 /* Alter the per-proto part of the tuple (depending on
27 maniptype), to give a unique tuple in the given range if
28 possible. Per-protocol part of tuple is initialized to the
29 incoming packet. */
30 void (*unique_tuple)(struct nf_conntrack_tuple *tuple,
31 const struct nf_nat_ipv4_range *range,
32 enum nf_nat_manip_type maniptype,
33 const struct nf_conn *ct);
34
35 int (*nlattr_to_range)(struct nlattr *tb[],
36 struct nf_nat_ipv4_range *range);
37};
38
39/* Protocol registration. */
40extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto);
41extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto);
42
43/* Built-in protocols. */
44extern const struct nf_nat_protocol nf_nat_protocol_tcp;
45extern const struct nf_nat_protocol nf_nat_protocol_udp;
46extern const struct nf_nat_protocol nf_nat_protocol_icmp;
47extern const struct nf_nat_protocol nf_nat_unknown_protocol;
48
49extern int init_protocols(void) __init;
50extern void cleanup_protocols(void);
51extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
52
53extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
54 enum nf_nat_manip_type maniptype,
55 const union nf_conntrack_man_proto *min,
56 const union nf_conntrack_man_proto *max);
57
58extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
59 const struct nf_nat_ipv4_range *range,
60 enum nf_nat_manip_type maniptype,
61 const struct nf_conn *ct,
62 u_int16_t *rover);
63
64extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
65 struct nf_nat_ipv4_range *range);
66
67#endif /*_NF_NAT_PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
deleted file mode 100644
index 2890bdc4cd92..000000000000
--- a/include/net/netfilter/nf_nat_rule.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _NF_NAT_RULE_H
2#define _NF_NAT_RULE_H
3#include <net/netfilter/nf_conntrack.h>
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h>
6
7extern int nf_nat_rule_init(void) __init;
8extern void nf_nat_rule_cleanup(void);
9extern int nf_nat_rule_find(struct sk_buff *skb,
10 unsigned int hooknum,
11 const struct net_device *in,
12 const struct net_device *out,
13 struct nf_conn *ct);
14
15#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 785f37a3b44e..9690b0f6698a 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -98,6 +98,10 @@
98 * nla_put_u16(skb, type, value) add u16 attribute to skb 98 * nla_put_u16(skb, type, value) add u16 attribute to skb
99 * nla_put_u32(skb, type, value) add u32 attribute to skb 99 * nla_put_u32(skb, type, value) add u32 attribute to skb
100 * nla_put_u64(skb, type, value) add u64 attribute to skb 100 * nla_put_u64(skb, type, value) add u64 attribute to skb
101 * nla_put_s8(skb, type, value) add s8 attribute to skb
102 * nla_put_s16(skb, type, value) add s16 attribute to skb
103 * nla_put_s32(skb, type, value) add s32 attribute to skb
104 * nla_put_s64(skb, type, value) add s64 attribute to skb
101 * nla_put_string(skb, type, str) add string attribute to skb 105 * nla_put_string(skb, type, str) add string attribute to skb
102 * nla_put_flag(skb, type) add flag attribute to skb 106 * nla_put_flag(skb, type) add flag attribute to skb
103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 107 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
@@ -121,6 +125,10 @@
121 * nla_get_u16(nla) get payload for a u16 attribute 125 * nla_get_u16(nla) get payload for a u16 attribute
122 * nla_get_u32(nla) get payload for a u32 attribute 126 * nla_get_u32(nla) get payload for a u32 attribute
123 * nla_get_u64(nla) get payload for a u64 attribute 127 * nla_get_u64(nla) get payload for a u64 attribute
128 * nla_get_s8(nla) get payload for a s8 attribute
129 * nla_get_s16(nla) get payload for a s16 attribute
130 * nla_get_s32(nla) get payload for a s32 attribute
131 * nla_get_s64(nla) get payload for a s64 attribute
124 * nla_get_flag(nla) return 1 if flag is true 132 * nla_get_flag(nla) return 1 if flag is true
125 * nla_get_msecs(nla) get payload for a msecs attribute 133 * nla_get_msecs(nla) get payload for a msecs attribute
126 * 134 *
@@ -160,6 +168,10 @@ enum {
160 NLA_NESTED_COMPAT, 168 NLA_NESTED_COMPAT,
161 NLA_NUL_STRING, 169 NLA_NUL_STRING,
162 NLA_BINARY, 170 NLA_BINARY,
171 NLA_S8,
172 NLA_S16,
173 NLA_S32,
174 NLA_S64,
163 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
164}; 176};
165 177
@@ -183,6 +195,8 @@ enum {
183 * NLA_NESTED_COMPAT Minimum length of structure payload 195 * NLA_NESTED_COMPAT Minimum length of structure payload
184 * NLA_U8, NLA_U16, 196 * NLA_U8, NLA_U16,
185 * NLA_U32, NLA_U64, 197 * NLA_U32, NLA_U64,
198 * NLA_S8, NLA_S16,
199 * NLA_S32, NLA_S64,
186 * NLA_MSECS Leaving the length field zero will verify the 200 * NLA_MSECS Leaving the length field zero will verify the
187 * given type fits, using it verifies minimum length 201 * given type fits, using it verifies minimum length
188 * just like "All other" 202 * just like "All other"
@@ -203,19 +217,19 @@ struct nla_policy {
203/** 217/**
204 * struct nl_info - netlink source information 218 * struct nl_info - netlink source information
205 * @nlh: Netlink message header of original request 219 * @nlh: Netlink message header of original request
206 * @pid: Netlink PID of requesting application 220 * @portid: Netlink PORTID of requesting application
207 */ 221 */
208struct nl_info { 222struct nl_info {
209 struct nlmsghdr *nlh; 223 struct nlmsghdr *nlh;
210 struct net *nl_net; 224 struct net *nl_net;
211 u32 pid; 225 u32 portid;
212}; 226};
213 227
214extern int netlink_rcv_skb(struct sk_buff *skb, 228extern int netlink_rcv_skb(struct sk_buff *skb,
215 int (*cb)(struct sk_buff *, 229 int (*cb)(struct sk_buff *,
216 struct nlmsghdr *)); 230 struct nlmsghdr *));
217extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
218 u32 pid, unsigned int group, int report, 232 u32 portid, unsigned int group, int report,
219 gfp_t flags); 233 gfp_t flags);
220 234
221extern int nla_validate(const struct nlattr *head, 235extern int nla_validate(const struct nlattr *head,
@@ -430,7 +444,7 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
430/** 444/**
431 * nlmsg_put - Add a new netlink message to an skb 445 * nlmsg_put - Add a new netlink message to an skb
432 * @skb: socket buffer to store message in 446 * @skb: socket buffer to store message in
433 * @pid: netlink process id 447 * @portid: netlink process id
434 * @seq: sequence number of message 448 * @seq: sequence number of message
435 * @type: message type 449 * @type: message type
436 * @payload: length of message payload 450 * @payload: length of message payload
@@ -439,13 +453,13 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
439 * Returns NULL if the tailroom of the skb is insufficient to store 453 * Returns NULL if the tailroom of the skb is insufficient to store
440 * the message header and payload. 454 * the message header and payload.
441 */ 455 */
442static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 456static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
443 int type, int payload, int flags) 457 int type, int payload, int flags)
444{ 458{
445 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload))) 459 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload)))
446 return NULL; 460 return NULL;
447 461
448 return __nlmsg_put(skb, pid, seq, type, payload, flags); 462 return __nlmsg_put(skb, portid, seq, type, payload, flags);
449} 463}
450 464
451/** 465/**
@@ -464,7 +478,7 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
464 int type, int payload, 478 int type, int payload,
465 int flags) 479 int flags)
466{ 480{
467 return nlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, 481 return nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
468 type, payload, flags); 482 type, payload, flags);
469} 483}
470 484
@@ -549,18 +563,18 @@ static inline void nlmsg_free(struct sk_buff *skb)
549 * nlmsg_multicast - multicast a netlink message 563 * nlmsg_multicast - multicast a netlink message
550 * @sk: netlink socket to spread messages to 564 * @sk: netlink socket to spread messages to
551 * @skb: netlink message as socket buffer 565 * @skb: netlink message as socket buffer
552 * @pid: own netlink pid to avoid sending to yourself 566 * @portid: own netlink portid to avoid sending to yourself
553 * @group: multicast group id 567 * @group: multicast group id
554 * @flags: allocation flags 568 * @flags: allocation flags
555 */ 569 */
556static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, 570static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
557 u32 pid, unsigned int group, gfp_t flags) 571 u32 portid, unsigned int group, gfp_t flags)
558{ 572{
559 int err; 573 int err;
560 574
561 NETLINK_CB(skb).dst_group = group; 575 NETLINK_CB(skb).dst_group = group;
562 576
563 err = netlink_broadcast(sk, skb, pid, group, flags); 577 err = netlink_broadcast(sk, skb, portid, group, flags);
564 if (err > 0) 578 if (err > 0)
565 err = 0; 579 err = 0;
566 580
@@ -571,13 +585,13 @@ static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
571 * nlmsg_unicast - unicast a netlink message 585 * nlmsg_unicast - unicast a netlink message
572 * @sk: netlink socket to spread message to 586 * @sk: netlink socket to spread message to
573 * @skb: netlink message as socket buffer 587 * @skb: netlink message as socket buffer
574 * @pid: netlink pid of the destination socket 588 * @portid: netlink portid of the destination socket
575 */ 589 */
576static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid) 590static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid)
577{ 591{
578 int err; 592 int err;
579 593
580 err = netlink_unicast(sk, skb, pid, MSG_DONTWAIT); 594 err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT);
581 if (err > 0) 595 if (err > 0)
582 err = 0; 596 err = 0;
583 597
@@ -879,6 +893,50 @@ static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
879} 893}
880 894
881/** 895/**
896 * nla_put_s8 - Add a s8 netlink attribute to a socket buffer
897 * @skb: socket buffer to add attribute to
898 * @attrtype: attribute type
899 * @value: numeric value
900 */
901static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value)
902{
903 return nla_put(skb, attrtype, sizeof(s8), &value);
904}
905
906/**
907 * nla_put_s16 - Add a s16 netlink attribute to a socket buffer
908 * @skb: socket buffer to add attribute to
909 * @attrtype: attribute type
910 * @value: numeric value
911 */
912static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value)
913{
914 return nla_put(skb, attrtype, sizeof(s16), &value);
915}
916
917/**
918 * nla_put_s32 - Add a s32 netlink attribute to a socket buffer
919 * @skb: socket buffer to add attribute to
920 * @attrtype: attribute type
921 * @value: numeric value
922 */
923static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value)
924{
925 return nla_put(skb, attrtype, sizeof(s32), &value);
926}
927
928/**
929 * nla_put_s64 - Add a s64 netlink attribute to a socket buffer
930 * @skb: socket buffer to add attribute to
931 * @attrtype: attribute type
932 * @value: numeric value
933 */
934static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value)
935{
936 return nla_put(skb, attrtype, sizeof(s64), &value);
937}
938
939/**
882 * nla_put_string - Add a string netlink attribute to a socket buffer 940 * nla_put_string - Add a string netlink attribute to a socket buffer
883 * @skb: socket buffer to add attribute to 941 * @skb: socket buffer to add attribute to
884 * @attrtype: attribute type 942 * @attrtype: attribute type
@@ -994,6 +1052,46 @@ static inline __be64 nla_get_be64(const struct nlattr *nla)
994} 1052}
995 1053
996/** 1054/**
1055 * nla_get_s32 - return payload of s32 attribute
1056 * @nla: s32 netlink attribute
1057 */
1058static inline s32 nla_get_s32(const struct nlattr *nla)
1059{
1060 return *(s32 *) nla_data(nla);
1061}
1062
1063/**
1064 * nla_get_s16 - return payload of s16 attribute
1065 * @nla: s16 netlink attribute
1066 */
1067static inline s16 nla_get_s16(const struct nlattr *nla)
1068{
1069 return *(s16 *) nla_data(nla);
1070}
1071
1072/**
1073 * nla_get_s8 - return payload of s8 attribute
1074 * @nla: s8 netlink attribute
1075 */
1076static inline s8 nla_get_s8(const struct nlattr *nla)
1077{
1078 return *(s8 *) nla_data(nla);
1079}
1080
1081/**
1082 * nla_get_s64 - return payload of s64 attribute
1083 * @nla: s64 netlink attribute
1084 */
1085static inline s64 nla_get_s64(const struct nlattr *nla)
1086{
1087 s64 tmp;
1088
1089 nla_memcpy(&tmp, nla, sizeof(tmp));
1090
1091 return tmp;
1092}
1093
1094/**
997 * nla_get_flag - return payload of flag attribute 1095 * nla_get_flag - return payload of flag attribute
998 * @nla: flag netlink attribute 1096 * @nla: flag netlink attribute
999 */ 1097 */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 3aecdc7a84fb..a1d83cc8bf85 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -83,6 +83,10 @@ struct netns_ct {
83 int sysctl_auto_assign_helper; 83 int sysctl_auto_assign_helper;
84 bool auto_assign_helper_warned; 84 bool auto_assign_helper_warned;
85 struct nf_ip_net nf_ct_proto; 85 struct nf_ip_net nf_ct_proto;
86#ifdef CONFIG_NF_NAT_NEEDED
87 struct hlist_head *nat_bysource;
88 unsigned int nat_htable_size;
89#endif
86#ifdef CONFIG_SYSCTL 90#ifdef CONFIG_SYSCTL
87 struct ctl_table_header *sysctl_header; 91 struct ctl_table_header *sysctl_header;
88 struct ctl_table_header *acct_sysctl_header; 92 struct ctl_table_header *acct_sysctl_header;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index eb24dbccd81e..2ae2b8372cfd 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -5,6 +5,7 @@
5#ifndef __NETNS_IPV4_H__ 5#ifndef __NETNS_IPV4_H__
6#define __NETNS_IPV4_H__ 6#define __NETNS_IPV4_H__
7 7
8#include <linux/uidgid.h>
8#include <net/inet_frag.h> 9#include <net/inet_frag.h>
9 10
10struct tcpm_hash_bucket; 11struct tcpm_hash_bucket;
@@ -51,8 +52,6 @@ struct netns_ipv4 {
51 struct xt_table *iptable_security; 52 struct xt_table *iptable_security;
52#endif 53#endif
53 struct xt_table *nat_table; 54 struct xt_table *nat_table;
54 struct hlist_head *nat_bysource;
55 unsigned int nat_htable_size;
56#endif 55#endif
57 56
58 int sysctl_icmp_echo_ignore_all; 57 int sysctl_icmp_echo_ignore_all;
@@ -62,7 +61,7 @@ struct netns_ipv4 {
62 int sysctl_icmp_ratemask; 61 int sysctl_icmp_ratemask;
63 int sysctl_icmp_errors_use_inbound_ifaddr; 62 int sysctl_icmp_errors_use_inbound_ifaddr;
64 63
65 unsigned int sysctl_ping_group_range[2]; 64 kgid_t sysctl_ping_group_range[2];
66 long sysctl_tcp_mem[3]; 65 long sysctl_tcp_mem[3];
67 66
68 atomic_t dev_addr_genid; 67 atomic_t dev_addr_genid;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index df0a5456a3fd..214cb0a53359 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -42,6 +42,7 @@ struct netns_ipv6 {
42#ifdef CONFIG_SECURITY 42#ifdef CONFIG_SECURITY
43 struct xt_table *ip6table_security; 43 struct xt_table *ip6table_security;
44#endif 44#endif
45 struct xt_table *ip6table_nat;
45#endif 46#endif
46 struct rt6_info *ip6_null_entry; 47 struct rt6_info *ip6_null_entry;
47 struct rt6_statistics *rt6_stats; 48 struct rt6_statistics *rt6_stats;
@@ -70,4 +71,12 @@ struct netns_ipv6 {
70#endif 71#endif
71#endif 72#endif
72}; 73};
74
75#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
76struct netns_nf_frag {
77 struct netns_sysctl_ipv6 sysctl;
78 struct netns_frags frags;
79};
80#endif
81
73#endif 82#endif
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index cb4e894c0f8d..17ec2b95c062 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -5,10 +5,10 @@
5#define __NETNS_PACKET_H__ 5#define __NETNS_PACKET_H__
6 6
7#include <linux/rculist.h> 7#include <linux/rculist.h>
8#include <linux/spinlock.h> 8#include <linux/mutex.h>
9 9
10struct netns_packet { 10struct netns_packet {
11 spinlock_t sklist_lock; 11 struct mutex sklist_lock;
12 struct hlist_head sklist; 12 struct hlist_head sklist;
13}; 13};
14 14
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
new file mode 100644
index 000000000000..5e5eb1f9f14b
--- /dev/null
+++ b/include/net/netns/sctp.h
@@ -0,0 +1,131 @@
1#ifndef __NETNS_SCTP_H__
2#define __NETNS_SCTP_H__
3
4struct sock;
5struct proc_dir_entry;
6struct sctp_mib;
7struct ctl_table_header;
8
9struct netns_sctp {
10 DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
11
12#ifdef CONFIG_PROC_FS
13 struct proc_dir_entry *proc_net_sctp;
14#endif
15#ifdef CONFIG_SYSCTL
16 struct ctl_table_header *sysctl_header;
17#endif
18 /* This is the global socket data structure used for responding to
19 * the Out-of-the-blue (OOTB) packets. A control sock will be created
20 * for this socket at the initialization time.
21 */
22 struct sock *ctl_sock;
23
24 /* This is the global local address list.
25 * We actively maintain this complete list of addresses on
26 * the system by catching address add/delete events.
27 *
28 * It is a list of sctp_sockaddr_entry.
29 */
30 struct list_head local_addr_list;
31 struct list_head addr_waitq;
32 struct timer_list addr_wq_timer;
33 struct list_head auto_asconf_splist;
34 spinlock_t addr_wq_lock;
35
36 /* Lock that protects the local_addr_list writers */
37 spinlock_t local_addr_lock;
38
39 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
40 *
41 * The following protocol parameters are RECOMMENDED:
42 *
43 * RTO.Initial - 3 seconds
44 * RTO.Min - 1 second
45 * RTO.Max - 60 seconds
46 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
47 * RTO.Beta - 1/4 (2 when converted to right shifts.)
48 */
49 unsigned int rto_initial;
50 unsigned int rto_min;
51 unsigned int rto_max;
52
53 /* Note: rto_alpha and rto_beta are really defined as inverse
54 * powers of two to facilitate integer operations.
55 */
56 int rto_alpha;
57 int rto_beta;
58
59 /* Max.Burst - 4 */
60 int max_burst;
61
62 /* Whether Cookie Preservative is enabled(1) or not(0) */
63 int cookie_preserve_enable;
64
65 /* Valid.Cookie.Life - 60 seconds */
66 unsigned int valid_cookie_life;
67
68 /* Delayed SACK timeout 200ms default*/
69 unsigned int sack_timeout;
70
71 /* HB.interval - 30 seconds */
72 unsigned int hb_interval;
73
74 /* Association.Max.Retrans - 10 attempts
75 * Path.Max.Retrans - 5 attempts (per destination address)
76 * Max.Init.Retransmits - 8 attempts
77 */
78 int max_retrans_association;
79 int max_retrans_path;
80 int max_retrans_init;
81 /* Potentially-Failed.Max.Retrans sysctl value
82 * taken from:
83 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
84 */
85 int pf_retrans;
86
87 /*
88 * Policy for preforming sctp/socket accounting
89 * 0 - do socket level accounting, all assocs share sk_sndbuf
90 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
91 */
92 int sndbuf_policy;
93
94 /*
95 * Policy for preforming sctp/socket accounting
96 * 0 - do socket level accounting, all assocs share sk_rcvbuf
97 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
98 */
99 int rcvbuf_policy;
100
101 int default_auto_asconf;
102
103 /* Flag to indicate if addip is enabled. */
104 int addip_enable;
105 int addip_noauth;
106
107 /* Flag to indicate if PR-SCTP is enabled. */
108 int prsctp_enable;
109
110 /* Flag to idicate if SCTP-AUTH is enabled */
111 int auth_enable;
112
113 /*
114 * Policy to control SCTP IPv4 address scoping
115 * 0 - Disable IPv4 address scoping
116 * 1 - Enable IPv4 address scoping
117 * 2 - Selectively allow only IPv4 private addresses
118 * 3 - Selectively allow only IPv4 link local address
119 */
120 int scope_policy;
121
122 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
123 * bits is an indicator of when to send and window update SACK.
124 */
125 int rwnd_upd_shift;
126
127 /* Threshold for autoclose timeout, in seconds. */
128 unsigned long max_autoclose;
129};
130
131#endif /* __NETNS_SCTP_H__ */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 6431f5e39022..6735909f826d 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -89,7 +89,7 @@ struct nfc_target {
89}; 89};
90 90
91struct nfc_genl_data { 91struct nfc_genl_data {
92 u32 poll_req_pid; 92 u32 poll_req_portid;
93 struct mutex genl_data_mutex; 93 struct mutex genl_data_mutex;
94}; 94};
95 95
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 4c0766e201e3..b01d8dd9ee7c 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -106,6 +106,34 @@ struct listen_sock {
106 struct request_sock *syn_table[0]; 106 struct request_sock *syn_table[0];
107}; 107};
108 108
109/*
110 * For a TCP Fast Open listener -
111 * lock - protects the access to all the reqsk, which is co-owned by
112 * the listener and the child socket.
113 * qlen - pending TFO requests (still in TCP_SYN_RECV).
114 * max_qlen - max TFO reqs allowed before TFO is disabled.
115 *
116 * XXX (TFO) - ideally these fields can be made as part of "listen_sock"
117 * structure above. But there is some implementation difficulty due to
118 * listen_sock being part of request_sock_queue hence will be freed when
119 * a listener is stopped. But TFO related fields may continue to be
120 * accessed even after a listener is closed, until its sk_refcnt drops
121 * to 0 implying no more outstanding TFO reqs. One solution is to keep
122 * listen_opt around until sk_refcnt drops to 0. But there is some other
123 * complexity that needs to be resolved. E.g., a listener can be disabled
124 * temporarily through shutdown()->tcp_disconnect(), and re-enabled later.
125 */
126struct fastopen_queue {
127 struct request_sock *rskq_rst_head; /* Keep track of past TFO */
128 struct request_sock *rskq_rst_tail; /* requests that caused RST.
129 * This is part of the defense
130 * against spoofing attack.
131 */
132 spinlock_t lock;
133 int qlen; /* # of pending (TCP_SYN_RECV) reqs */
134 int max_qlen; /* != 0 iff TFO is currently enabled */
135};
136
109/** struct request_sock_queue - queue of request_socks 137/** struct request_sock_queue - queue of request_socks
110 * 138 *
111 * @rskq_accept_head - FIFO head of established children 139 * @rskq_accept_head - FIFO head of established children
@@ -129,6 +157,12 @@ struct request_sock_queue {
129 u8 rskq_defer_accept; 157 u8 rskq_defer_accept;
130 /* 3 bytes hole, try to pack */ 158 /* 3 bytes hole, try to pack */
131 struct listen_sock *listen_opt; 159 struct listen_sock *listen_opt;
160 struct fastopen_queue *fastopenq; /* This is non-NULL iff TFO has been
161 * enabled on this listener. Check
162 * max_qlen != 0 in fastopen_queue
163 * to determine if TFO is enabled
164 * right at this moment.
165 */
132}; 166};
133 167
134extern int reqsk_queue_alloc(struct request_sock_queue *queue, 168extern int reqsk_queue_alloc(struct request_sock_queue *queue,
@@ -136,6 +170,8 @@ extern int reqsk_queue_alloc(struct request_sock_queue *queue,
136 170
137extern void __reqsk_queue_destroy(struct request_sock_queue *queue); 171extern void __reqsk_queue_destroy(struct request_sock_queue *queue);
138extern void reqsk_queue_destroy(struct request_sock_queue *queue); 172extern void reqsk_queue_destroy(struct request_sock_queue *queue);
173extern void reqsk_fastopen_remove(struct sock *sk,
174 struct request_sock *req, bool reset);
139 175
140static inline struct request_sock * 176static inline struct request_sock *
141 reqsk_queue_yank_acceptq(struct request_sock_queue *queue) 177 reqsk_queue_yank_acceptq(struct request_sock_queue *queue)
@@ -190,19 +226,6 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue
190 return req; 226 return req;
191} 227}
192 228
193static inline struct sock *reqsk_queue_get_child(struct request_sock_queue *queue,
194 struct sock *parent)
195{
196 struct request_sock *req = reqsk_queue_remove(queue);
197 struct sock *child = req->sk;
198
199 WARN_ON(child == NULL);
200
201 sk_acceptq_removed(parent);
202 __reqsk_free(req);
203 return child;
204}
205
206static inline int reqsk_queue_removed(struct request_sock_queue *queue, 229static inline int reqsk_queue_removed(struct request_sock_queue *queue,
207 struct request_sock *req) 230 struct request_sock *req)
208{ 231{
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d9611e032418..4616f468d599 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -188,7 +188,8 @@ struct tcf_proto_ops {
188 188
189 unsigned long (*get)(struct tcf_proto*, u32 handle); 189 unsigned long (*get)(struct tcf_proto*, u32 handle);
190 void (*put)(struct tcf_proto*, unsigned long); 190 void (*put)(struct tcf_proto*, unsigned long);
191 int (*change)(struct tcf_proto*, unsigned long, 191 int (*change)(struct sk_buff *,
192 struct tcf_proto*, unsigned long,
192 u32 handle, struct nlattr **, 193 u32 handle, struct nlattr **,
193 unsigned long *); 194 unsigned long *);
194 int (*delete)(struct tcf_proto*, unsigned long); 195 int (*delete)(struct tcf_proto*, unsigned long);
diff --git a/include/net/scm.h b/include/net/scm.h
index 7dc0854f0b38..975cca01048b 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -12,6 +12,12 @@
12 */ 12 */
13#define SCM_MAX_FD 253 13#define SCM_MAX_FD 253
14 14
15struct scm_creds {
16 u32 pid;
17 kuid_t uid;
18 kgid_t gid;
19};
20
15struct scm_fp_list { 21struct scm_fp_list {
16 short count; 22 short count;
17 short max; 23 short max;
@@ -22,7 +28,7 @@ struct scm_cookie {
22 struct pid *pid; /* Skb credentials */ 28 struct pid *pid; /* Skb credentials */
23 const struct cred *cred; 29 const struct cred *cred;
24 struct scm_fp_list *fp; /* Passed files */ 30 struct scm_fp_list *fp; /* Passed files */
25 struct ucred creds; /* Skb credentials */ 31 struct scm_creds creds; /* Skb credentials */
26#ifdef CONFIG_SECURITY_NETWORK 32#ifdef CONFIG_SECURITY_NETWORK
27 u32 secid; /* Passed security ID */ 33 u32 secid; /* Passed security ID */
28#endif 34#endif
@@ -49,7 +55,9 @@ static __inline__ void scm_set_cred(struct scm_cookie *scm,
49{ 55{
50 scm->pid = get_pid(pid); 56 scm->pid = get_pid(pid);
51 scm->cred = cred ? get_cred(cred) : NULL; 57 scm->cred = cred ? get_cred(cred) : NULL;
52 cred_to_ucred(pid, cred, &scm->creds); 58 scm->creds.pid = pid_vnr(pid);
59 scm->creds.uid = cred ? cred->euid : INVALID_UID;
60 scm->creds.gid = cred ? cred->egid : INVALID_GID;
53} 61}
54 62
55static __inline__ void scm_destroy_cred(struct scm_cookie *scm) 63static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
@@ -65,7 +73,7 @@ static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
65static __inline__ void scm_destroy(struct scm_cookie *scm) 73static __inline__ void scm_destroy(struct scm_cookie *scm)
66{ 74{
67 scm_destroy_cred(scm); 75 scm_destroy_cred(scm);
68 if (scm && scm->fp) 76 if (scm->fp)
69 __scm_destroy(scm); 77 __scm_destroy(scm);
70} 78}
71 79
@@ -112,8 +120,15 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
112 return; 120 return;
113 } 121 }
114 122
115 if (test_bit(SOCK_PASSCRED, &sock->flags)) 123 if (test_bit(SOCK_PASSCRED, &sock->flags)) {
116 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); 124 struct user_namespace *current_ns = current_user_ns();
125 struct ucred ucreds = {
126 .pid = scm->creds.pid,
127 .uid = from_kuid_munged(current_ns, scm->creds.uid),
128 .gid = from_kgid_munged(current_ns, scm->creds.gid),
129 };
130 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(ucreds), &ucreds);
131 }
117 132
118 scm_destroy_cred(scm); 133 scm_destroy_cred(scm);
119 134
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ff499640528b..9c6414f553f9 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -114,13 +114,12 @@
114/* 114/*
115 * sctp/protocol.c 115 * sctp/protocol.c
116 */ 116 */
117extern struct sock *sctp_get_ctl_sock(void); 117extern int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *,
118extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
119 sctp_scope_t, gfp_t gfp, 118 sctp_scope_t, gfp_t gfp,
120 int flags); 119 int flags);
121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 120extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
122extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 121extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
123extern void sctp_addr_wq_mgmt(struct sctp_sockaddr_entry *, int); 122extern void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
124 123
125/* 124/*
126 * sctp/socket.c 125 * sctp/socket.c
@@ -140,12 +139,12 @@ extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
140/* 139/*
141 * sctp/primitive.c 140 * sctp/primitive.c
142 */ 141 */
143int sctp_primitive_ASSOCIATE(struct sctp_association *, void *arg); 142int sctp_primitive_ASSOCIATE(struct net *, struct sctp_association *, void *arg);
144int sctp_primitive_SHUTDOWN(struct sctp_association *, void *arg); 143int sctp_primitive_SHUTDOWN(struct net *, struct sctp_association *, void *arg);
145int sctp_primitive_ABORT(struct sctp_association *, void *arg); 144int sctp_primitive_ABORT(struct net *, struct sctp_association *, void *arg);
146int sctp_primitive_SEND(struct sctp_association *, void *arg); 145int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg);
147int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg); 146int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg);
148int sctp_primitive_ASCONF(struct sctp_association *, void *arg); 147int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg);
149 148
150/* 149/*
151 * sctp/input.c 150 * sctp/input.c
@@ -156,7 +155,7 @@ void sctp_hash_established(struct sctp_association *);
156void sctp_unhash_established(struct sctp_association *); 155void sctp_unhash_established(struct sctp_association *);
157void sctp_hash_endpoint(struct sctp_endpoint *); 156void sctp_hash_endpoint(struct sctp_endpoint *);
158void sctp_unhash_endpoint(struct sctp_endpoint *); 157void sctp_unhash_endpoint(struct sctp_endpoint *);
159struct sock *sctp_err_lookup(int family, struct sk_buff *, 158struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *,
160 struct sctphdr *, struct sctp_association **, 159 struct sctphdr *, struct sctp_association **,
161 struct sctp_transport **); 160 struct sctp_transport **);
162void sctp_err_finish(struct sock *, struct sctp_association *); 161void sctp_err_finish(struct sock *, struct sctp_association *);
@@ -173,14 +172,14 @@ void sctp_backlog_migrate(struct sctp_association *assoc,
173/* 172/*
174 * sctp/proc.c 173 * sctp/proc.c
175 */ 174 */
176int sctp_snmp_proc_init(void); 175int sctp_snmp_proc_init(struct net *net);
177void sctp_snmp_proc_exit(void); 176void sctp_snmp_proc_exit(struct net *net);
178int sctp_eps_proc_init(void); 177int sctp_eps_proc_init(struct net *net);
179void sctp_eps_proc_exit(void); 178void sctp_eps_proc_exit(struct net *net);
180int sctp_assocs_proc_init(void); 179int sctp_assocs_proc_init(struct net *net);
181void sctp_assocs_proc_exit(void); 180void sctp_assocs_proc_exit(struct net *net);
182int sctp_remaddr_proc_init(void); 181int sctp_remaddr_proc_init(struct net *net);
183void sctp_remaddr_proc_exit(void); 182void sctp_remaddr_proc_exit(struct net *net);
184 183
185 184
186/* 185/*
@@ -222,11 +221,10 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
222#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) 221#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk)
223 222
224/* SCTP SNMP MIB stats handlers */ 223/* SCTP SNMP MIB stats handlers */
225DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); 224#define SCTP_INC_STATS(net, field) SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
226#define SCTP_INC_STATS(field) SNMP_INC_STATS(sctp_statistics, field) 225#define SCTP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->sctp.sctp_statistics, field)
227#define SCTP_INC_STATS_BH(field) SNMP_INC_STATS_BH(sctp_statistics, field) 226#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field)
228#define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field) 227#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
229#define SCTP_DEC_STATS(field) SNMP_DEC_STATS(sctp_statistics, field)
230 228
231#endif /* !TEST_FRAME */ 229#endif /* !TEST_FRAME */
232 230
@@ -361,25 +359,29 @@ atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0)
361#define SCTP_DBG_OBJCNT_ENTRY(name) \ 359#define SCTP_DBG_OBJCNT_ENTRY(name) \
362{.label= #name, .counter= &sctp_dbg_objcnt_## name} 360{.label= #name, .counter= &sctp_dbg_objcnt_## name}
363 361
364void sctp_dbg_objcnt_init(void); 362void sctp_dbg_objcnt_init(struct net *);
365void sctp_dbg_objcnt_exit(void); 363void sctp_dbg_objcnt_exit(struct net *);
366 364
367#else 365#else
368 366
369#define SCTP_DBG_OBJCNT_INC(name) 367#define SCTP_DBG_OBJCNT_INC(name)
370#define SCTP_DBG_OBJCNT_DEC(name) 368#define SCTP_DBG_OBJCNT_DEC(name)
371 369
372static inline void sctp_dbg_objcnt_init(void) { return; } 370static inline void sctp_dbg_objcnt_init(struct net *net) { return; }
373static inline void sctp_dbg_objcnt_exit(void) { return; } 371static inline void sctp_dbg_objcnt_exit(struct net *net) { return; }
374 372
375#endif /* CONFIG_SCTP_DBG_OBJCOUNT */ 373#endif /* CONFIG_SCTP_DBG_OBJCOUNT */
376 374
377#if defined CONFIG_SYSCTL 375#if defined CONFIG_SYSCTL
378void sctp_sysctl_register(void); 376void sctp_sysctl_register(void);
379void sctp_sysctl_unregister(void); 377void sctp_sysctl_unregister(void);
378int sctp_sysctl_net_register(struct net *net);
379void sctp_sysctl_net_unregister(struct net *net);
380#else 380#else
381static inline void sctp_sysctl_register(void) { return; } 381static inline void sctp_sysctl_register(void) { return; }
382static inline void sctp_sysctl_unregister(void) { return; } 382static inline void sctp_sysctl_unregister(void) { return; }
383static inline int sctp_sysctl_net_register(struct net *net) { return 0; }
384static inline void sctp_sysctl_net_unregister(struct net *net) { return; }
383#endif 385#endif
384 386
385/* Size of Supported Address Parameter for 'x' address types. */ 387/* Size of Supported Address Parameter for 'x' address types. */
@@ -586,7 +588,6 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
586 588
587extern struct proto sctp_prot; 589extern struct proto sctp_prot;
588extern struct proto sctpv6_prot; 590extern struct proto sctpv6_prot;
589extern struct proc_dir_entry *proc_net_sctp;
590void sctp_put_port(struct sock *sk); 591void sctp_put_port(struct sock *sk);
591 592
592extern struct idr sctp_assocs_id; 593extern struct idr sctp_assocs_id;
@@ -632,21 +633,21 @@ static inline int sctp_sanity_check(void)
632 633
633/* Warning: The following hash functions assume a power of two 'size'. */ 634/* Warning: The following hash functions assume a power of two 'size'. */
634/* This is the hash function for the SCTP port hash table. */ 635/* This is the hash function for the SCTP port hash table. */
635static inline int sctp_phashfn(__u16 lport) 636static inline int sctp_phashfn(struct net *net, __u16 lport)
636{ 637{
637 return lport & (sctp_port_hashsize - 1); 638 return (net_hash_mix(net) + lport) & (sctp_port_hashsize - 1);
638} 639}
639 640
640/* This is the hash function for the endpoint hash table. */ 641/* This is the hash function for the endpoint hash table. */
641static inline int sctp_ep_hashfn(__u16 lport) 642static inline int sctp_ep_hashfn(struct net *net, __u16 lport)
642{ 643{
643 return lport & (sctp_ep_hashsize - 1); 644 return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1);
644} 645}
645 646
646/* This is the hash function for the association hash table. */ 647/* This is the hash function for the association hash table. */
647static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) 648static inline int sctp_assoc_hashfn(struct net *net, __u16 lport, __u16 rport)
648{ 649{
649 int h = (lport << 16) + rport; 650 int h = (lport << 16) + rport + net_hash_mix(net);
650 h ^= h>>8; 651 h ^= h>>8;
651 return h & (sctp_assoc_hashsize - 1); 652 return h & (sctp_assoc_hashsize - 1);
652} 653}
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 9148632b8204..b5887e1677e4 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -77,7 +77,8 @@ typedef struct {
77 int action; 77 int action;
78} sctp_sm_command_t; 78} sctp_sm_command_t;
79 79
80typedef sctp_disposition_t (sctp_state_fn_t) (const struct sctp_endpoint *, 80typedef sctp_disposition_t (sctp_state_fn_t) (struct net *,
81 const struct sctp_endpoint *,
81 const struct sctp_association *, 82 const struct sctp_association *,
82 const sctp_subtype_t type, 83 const sctp_subtype_t type,
83 void *arg, 84 void *arg,
@@ -178,7 +179,8 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;
178 179
179/* Prototypes for utility support functions. */ 180/* Prototypes for utility support functions. */
180__u8 sctp_get_chunk_type(struct sctp_chunk *chunk); 181__u8 sctp_get_chunk_type(struct sctp_chunk *chunk);
181const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t, 182const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *,
183 sctp_event_t,
182 sctp_state_t, 184 sctp_state_t,
183 sctp_subtype_t); 185 sctp_subtype_t);
184int sctp_chunk_iif(const struct sctp_chunk *); 186int sctp_chunk_iif(const struct sctp_chunk *);
@@ -268,7 +270,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *);
268 270
269/* Prototypes for statetable processing. */ 271/* Prototypes for statetable processing. */
270 272
271int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, 273int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
272 sctp_state_t state, 274 sctp_state_t state,
273 struct sctp_endpoint *, 275 struct sctp_endpoint *,
274 struct sctp_association *asoc, 276 struct sctp_association *asoc,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index fc5e60016e37..0fef00f5d3ce 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -102,6 +102,7 @@ struct sctp_bind_bucket {
102 unsigned short fastreuse; 102 unsigned short fastreuse;
103 struct hlist_node node; 103 struct hlist_node node;
104 struct hlist_head owner; 104 struct hlist_head owner;
105 struct net *net;
105}; 106};
106 107
107struct sctp_bind_hashbucket { 108struct sctp_bind_hashbucket {
@@ -118,69 +119,6 @@ struct sctp_hashbucket {
118 119
119/* The SCTP globals structure. */ 120/* The SCTP globals structure. */
120extern struct sctp_globals { 121extern struct sctp_globals {
121 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
122 *
123 * The following protocol parameters are RECOMMENDED:
124 *
125 * RTO.Initial - 3 seconds
126 * RTO.Min - 1 second
127 * RTO.Max - 60 seconds
128 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
129 * RTO.Beta - 1/4 (2 when converted to right shifts.)
130 */
131 unsigned int rto_initial;
132 unsigned int rto_min;
133 unsigned int rto_max;
134
135 /* Note: rto_alpha and rto_beta are really defined as inverse
136 * powers of two to facilitate integer operations.
137 */
138 int rto_alpha;
139 int rto_beta;
140
141 /* Max.Burst - 4 */
142 int max_burst;
143
144 /* Whether Cookie Preservative is enabled(1) or not(0) */
145 int cookie_preserve_enable;
146
147 /* Valid.Cookie.Life - 60 seconds */
148 unsigned int valid_cookie_life;
149
150 /* Delayed SACK timeout 200ms default*/
151 unsigned int sack_timeout;
152
153 /* HB.interval - 30 seconds */
154 unsigned int hb_interval;
155
156 /* Association.Max.Retrans - 10 attempts
157 * Path.Max.Retrans - 5 attempts (per destination address)
158 * Max.Init.Retransmits - 8 attempts
159 */
160 int max_retrans_association;
161 int max_retrans_path;
162 int max_retrans_init;
163
164 /* Potentially-Failed.Max.Retrans sysctl value
165 * taken from:
166 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
167 */
168 int pf_retrans;
169
170 /*
171 * Policy for preforming sctp/socket accounting
172 * 0 - do socket level accounting, all assocs share sk_sndbuf
173 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
174 */
175 int sndbuf_policy;
176
177 /*
178 * Policy for preforming sctp/socket accounting
179 * 0 - do socket level accounting, all assocs share sk_rcvbuf
180 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
181 */
182 int rcvbuf_policy;
183
184 /* The following variables are implementation specific. */ 122 /* The following variables are implementation specific. */
185 123
186 /* Default initialization values to be applied to new associations. */ 124 /* Default initialization values to be applied to new associations. */
@@ -204,70 +142,11 @@ extern struct sctp_globals {
204 int port_hashsize; 142 int port_hashsize;
205 struct sctp_bind_hashbucket *port_hashtable; 143 struct sctp_bind_hashbucket *port_hashtable;
206 144
207 /* This is the global local address list.
208 * We actively maintain this complete list of addresses on
209 * the system by catching address add/delete events.
210 *
211 * It is a list of sctp_sockaddr_entry.
212 */
213 struct list_head local_addr_list;
214 int default_auto_asconf;
215 struct list_head addr_waitq;
216 struct timer_list addr_wq_timer;
217 struct list_head auto_asconf_splist;
218 spinlock_t addr_wq_lock;
219
220 /* Lock that protects the local_addr_list writers */
221 spinlock_t addr_list_lock;
222
223 /* Flag to indicate if addip is enabled. */
224 int addip_enable;
225 int addip_noauth_enable;
226
227 /* Flag to indicate if PR-SCTP is enabled. */
228 int prsctp_enable;
229
230 /* Flag to idicate if SCTP-AUTH is enabled */
231 int auth_enable;
232
233 /*
234 * Policy to control SCTP IPv4 address scoping
235 * 0 - Disable IPv4 address scoping
236 * 1 - Enable IPv4 address scoping
237 * 2 - Selectively allow only IPv4 private addresses
238 * 3 - Selectively allow only IPv4 link local address
239 */
240 int ipv4_scope_policy;
241
242 /* Flag to indicate whether computing and verifying checksum 145 /* Flag to indicate whether computing and verifying checksum
243 * is disabled. */ 146 * is disabled. */
244 bool checksum_disable; 147 bool checksum_disable;
245
246 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
247 * bits is an indicator of when to send and window update SACK.
248 */
249 int rwnd_update_shift;
250
251 /* Threshold for autoclose timeout, in seconds. */
252 unsigned long max_autoclose;
253} sctp_globals; 148} sctp_globals;
254 149
255#define sctp_rto_initial (sctp_globals.rto_initial)
256#define sctp_rto_min (sctp_globals.rto_min)
257#define sctp_rto_max (sctp_globals.rto_max)
258#define sctp_rto_alpha (sctp_globals.rto_alpha)
259#define sctp_rto_beta (sctp_globals.rto_beta)
260#define sctp_max_burst (sctp_globals.max_burst)
261#define sctp_valid_cookie_life (sctp_globals.valid_cookie_life)
262#define sctp_cookie_preserve_enable (sctp_globals.cookie_preserve_enable)
263#define sctp_max_retrans_association (sctp_globals.max_retrans_association)
264#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy)
265#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy)
266#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
267#define sctp_pf_retrans (sctp_globals.pf_retrans)
268#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
269#define sctp_sack_timeout (sctp_globals.sack_timeout)
270#define sctp_hb_interval (sctp_globals.hb_interval)
271#define sctp_max_instreams (sctp_globals.max_instreams) 150#define sctp_max_instreams (sctp_globals.max_instreams)
272#define sctp_max_outstreams (sctp_globals.max_outstreams) 151#define sctp_max_outstreams (sctp_globals.max_outstreams)
273#define sctp_address_families (sctp_globals.address_families) 152#define sctp_address_families (sctp_globals.address_families)
@@ -277,21 +156,7 @@ extern struct sctp_globals {
277#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) 156#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
278#define sctp_port_hashsize (sctp_globals.port_hashsize) 157#define sctp_port_hashsize (sctp_globals.port_hashsize)
279#define sctp_port_hashtable (sctp_globals.port_hashtable) 158#define sctp_port_hashtable (sctp_globals.port_hashtable)
280#define sctp_local_addr_list (sctp_globals.local_addr_list)
281#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
282#define sctp_auto_asconf_splist (sctp_globals.auto_asconf_splist)
283#define sctp_addr_waitq (sctp_globals.addr_waitq)
284#define sctp_addr_wq_timer (sctp_globals.addr_wq_timer)
285#define sctp_addr_wq_lock (sctp_globals.addr_wq_lock)
286#define sctp_default_auto_asconf (sctp_globals.default_auto_asconf)
287#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
288#define sctp_addip_enable (sctp_globals.addip_enable)
289#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
290#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
291#define sctp_auth_enable (sctp_globals.auth_enable)
292#define sctp_checksum_disable (sctp_globals.checksum_disable) 159#define sctp_checksum_disable (sctp_globals.checksum_disable)
293#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
294#define sctp_max_autoclose (sctp_globals.max_autoclose)
295 160
296/* SCTP Socket type: UDP or TCP style. */ 161/* SCTP Socket type: UDP or TCP style. */
297typedef enum { 162typedef enum {
@@ -1085,7 +950,7 @@ struct sctp_transport {
1085 __u64 hb_nonce; 950 __u64 hb_nonce;
1086}; 951};
1087 952
1088struct sctp_transport *sctp_transport_new(const union sctp_addr *, 953struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
1089 gfp_t); 954 gfp_t);
1090void sctp_transport_set_owner(struct sctp_transport *, 955void sctp_transport_set_owner(struct sctp_transport *,
1091 struct sctp_association *); 956 struct sctp_association *);
@@ -1240,7 +1105,7 @@ struct sctp_bind_addr {
1240 1105
1241void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); 1106void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1242void sctp_bind_addr_free(struct sctp_bind_addr *); 1107void sctp_bind_addr_free(struct sctp_bind_addr *);
1243int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 1108int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
1244 const struct sctp_bind_addr *src, 1109 const struct sctp_bind_addr *src,
1245 sctp_scope_t scope, gfp_t gfp, 1110 sctp_scope_t scope, gfp_t gfp,
1246 int flags); 1111 int flags);
@@ -1267,7 +1132,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1267 __u16 port, gfp_t gfp); 1132 __u16 port, gfp_t gfp);
1268 1133
1269sctp_scope_t sctp_scope(const union sctp_addr *); 1134sctp_scope_t sctp_scope(const union sctp_addr *);
1270int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1135int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope);
1271int sctp_is_any(struct sock *sk, const union sctp_addr *addr); 1136int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1272int sctp_addr_is_valid(const union sctp_addr *addr); 1137int sctp_addr_is_valid(const union sctp_addr *addr);
1273int sctp_is_ep_boundall(struct sock *sk); 1138int sctp_is_ep_boundall(struct sock *sk);
@@ -1425,13 +1290,13 @@ struct sctp_association *sctp_endpoint_lookup_assoc(
1425int sctp_endpoint_is_peeled_off(struct sctp_endpoint *, 1290int sctp_endpoint_is_peeled_off(struct sctp_endpoint *,
1426 const union sctp_addr *); 1291 const union sctp_addr *);
1427struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, 1292struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
1428 const union sctp_addr *); 1293 struct net *, const union sctp_addr *);
1429int sctp_has_association(const union sctp_addr *laddr, 1294int sctp_has_association(struct net *net, const union sctp_addr *laddr,
1430 const union sctp_addr *paddr); 1295 const union sctp_addr *paddr);
1431 1296
1432int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, 1297int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
1433 sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, 1298 sctp_cid_t, sctp_init_chunk_t *peer_init,
1434 struct sctp_chunk **err_chunk); 1299 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
1435int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, 1300int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
1436 const union sctp_addr *peer, 1301 const union sctp_addr *peer,
1437 sctp_init_chunk_t *init, gfp_t gfp); 1302 sctp_init_chunk_t *init, gfp_t gfp);
@@ -2013,6 +1878,7 @@ void sctp_assoc_control_transport(struct sctp_association *,
2013 sctp_transport_cmd_t, sctp_sn_error_t); 1878 sctp_transport_cmd_t, sctp_sn_error_t);
2014struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); 1879struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32);
2015struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, 1880struct sctp_transport *sctp_assoc_is_match(struct sctp_association *,
1881 struct net *,
2016 const union sctp_addr *, 1882 const union sctp_addr *,
2017 const union sctp_addr *); 1883 const union sctp_addr *);
2018void sctp_assoc_migrate(struct sctp_association *, struct sock *); 1884void sctp_assoc_migrate(struct sctp_association *, struct sock *);
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 0147b901e79c..71596261fa99 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -154,13 +154,15 @@ struct linux_xfrm_mib {
154 */ 154 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 156 do { \
157 this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 157 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
158 this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 158 this_cpu_inc(ptr[basefield##PKTS]); \
159 this_cpu_add(ptr[basefield##OCTETS], addend); \
159 } while (0) 160 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 161#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 162 do { \
162 __this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 163 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
163 __this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 164 __this_cpu_inc(ptr[basefield##PKTS]); \
165 __this_cpu_add(ptr[basefield##OCTETS], addend); \
164 } while (0) 166 } while (0)
165 167
166 168
diff --git a/include/net/sock.h b/include/net/sock.h
index adb7da20b5a1..c9175562039f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -247,8 +247,7 @@ struct cg_proto;
247 * @sk_stamp: time stamp of last packet received 247 * @sk_stamp: time stamp of last packet received
248 * @sk_socket: Identd and reporting IO signals 248 * @sk_socket: Identd and reporting IO signals
249 * @sk_user_data: RPC layer private data 249 * @sk_user_data: RPC layer private data
250 * @sk_sndmsg_page: cached page for sendmsg 250 * @sk_frag: cached page frag
251 * @sk_sndmsg_off: cached offset for sendmsg
252 * @sk_peek_off: current peek_offset value 251 * @sk_peek_off: current peek_offset value
253 * @sk_send_head: front of stuff to transmit 252 * @sk_send_head: front of stuff to transmit
254 * @sk_security: used by security modules 253 * @sk_security: used by security modules
@@ -362,9 +361,8 @@ struct sock {
362 ktime_t sk_stamp; 361 ktime_t sk_stamp;
363 struct socket *sk_socket; 362 struct socket *sk_socket;
364 void *sk_user_data; 363 void *sk_user_data;
365 struct page *sk_sndmsg_page; 364 struct page_frag sk_frag;
366 struct sk_buff *sk_send_head; 365 struct sk_buff *sk_send_head;
367 __u32 sk_sndmsg_off;
368 __s32 sk_peek_off; 366 __s32 sk_peek_off;
369 int sk_write_pending; 367 int sk_write_pending;
370#ifdef CONFIG_SECURITY 368#ifdef CONFIG_SECURITY
@@ -606,6 +604,15 @@ static inline void sk_add_bind_node(struct sock *sk,
606#define sk_for_each_bound(__sk, node, list) \ 604#define sk_for_each_bound(__sk, node, list) \
607 hlist_for_each_entry(__sk, node, list, sk_bind_node) 605 hlist_for_each_entry(__sk, node, list, sk_bind_node)
608 606
607static inline struct user_namespace *sk_user_ns(struct sock *sk)
608{
609 /* Careful only use this in a context where these parameters
610 * can not change and must all be valid, such as recvmsg from
611 * userspace.
612 */
613 return sk->sk_socket->file->f_cred->user_ns;
614}
615
609/* Sock flags */ 616/* Sock flags */
610enum sock_flags { 617enum sock_flags {
611 SOCK_DEAD, 618 SOCK_DEAD,
@@ -1670,7 +1677,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1670 write_unlock_bh(&sk->sk_callback_lock); 1677 write_unlock_bh(&sk->sk_callback_lock);
1671} 1678}
1672 1679
1673extern int sock_i_uid(struct sock *sk); 1680extern kuid_t sock_i_uid(struct sock *sk);
1674extern unsigned long sock_i_ino(struct sock *sk); 1681extern unsigned long sock_i_ino(struct sock *sk);
1675 1682
1676static inline struct dst_entry * 1683static inline struct dst_entry *
@@ -2025,18 +2032,23 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
2025 2032
2026struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp); 2033struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp);
2027 2034
2028static inline struct page *sk_stream_alloc_page(struct sock *sk) 2035/**
2036 * sk_page_frag - return an appropriate page_frag
2037 * @sk: socket
2038 *
2039 * If socket allocation mode allows current thread to sleep, it means its
2040 * safe to use the per task page_frag instead of the per socket one.
2041 */
2042static inline struct page_frag *sk_page_frag(struct sock *sk)
2029{ 2043{
2030 struct page *page = NULL; 2044 if (sk->sk_allocation & __GFP_WAIT)
2045 return &current->task_frag;
2031 2046
2032 page = alloc_pages(sk->sk_allocation, 0); 2047 return &sk->sk_frag;
2033 if (!page) {
2034 sk_enter_memory_pressure(sk);
2035 sk_stream_moderate_sndbuf(sk);
2036 }
2037 return page;
2038} 2048}
2039 2049
2050extern bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2051
2040/* 2052/*
2041 * Default write policy as shown to user space via poll/select/SIGIO 2053 * Default write policy as shown to user space via poll/select/SIGIO
2042 */ 2054 */
@@ -2217,8 +2229,6 @@ extern int net_msg_warn;
2217extern __u32 sysctl_wmem_max; 2229extern __u32 sysctl_wmem_max;
2218extern __u32 sysctl_rmem_max; 2230extern __u32 sysctl_rmem_max;
2219 2231
2220extern void sk_init(void);
2221
2222extern int sysctl_optmem_max; 2232extern int sysctl_optmem_max;
2223 2233
2224extern __u32 sysctl_wmem_default; 2234extern __u32 sysctl_wmem_default;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 1f000ffe7075..6feeccd83dd7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -98,11 +98,21 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
98 * 15 is ~13-30min depending on RTO. 98 * 15 is ~13-30min depending on RTO.
99 */ 99 */
100 100
101#define TCP_SYN_RETRIES 5 /* number of times to retry active opening a 101#define TCP_SYN_RETRIES 6 /* This is how many retries are done
102 * connection: ~180sec is RFC minimum */ 102 * when active opening a connection.
103 * RFC1122 says the minimum retry MUST
104 * be at least 180secs. Nevertheless
105 * this value is corresponding to
106 * 63secs of retransmission with the
107 * current initial RTO.
108 */
103 109
104#define TCP_SYNACK_RETRIES 5 /* number of times to retry passive opening a 110#define TCP_SYNACK_RETRIES 5 /* This is how may retries are done
105 * connection: ~180sec is RFC minimum */ 111 * when passive opening a connection.
112 * This is corresponding to 31secs of
113 * retransmission with the current
114 * initial RTO.
115 */
106 116
107#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT 117#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
108 * state, about 60 seconds */ 118 * state, about 60 seconds */
@@ -214,8 +224,24 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
214 224
215/* Bit Flags for sysctl_tcp_fastopen */ 225/* Bit Flags for sysctl_tcp_fastopen */
216#define TFO_CLIENT_ENABLE 1 226#define TFO_CLIENT_ENABLE 1
227#define TFO_SERVER_ENABLE 2
217#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ 228#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
218 229
230/* Process SYN data but skip cookie validation */
231#define TFO_SERVER_COOKIE_NOT_CHKED 0x100
232/* Accept SYN data w/o any cookie option */
233#define TFO_SERVER_COOKIE_NOT_REQD 0x200
234
235/* Force enable TFO on all listeners, i.e., not requiring the
236 * TCP_FASTOPEN socket option. SOCKOPT1/2 determine how to set max_qlen.
237 */
238#define TFO_SERVER_WO_SOCKOPT1 0x400
239#define TFO_SERVER_WO_SOCKOPT2 0x800
240/* Always create TFO child sockets on a TFO listener even when
241 * cookie/data not present. (For testing purpose!)
242 */
243#define TFO_SERVER_ALWAYS 0x1000
244
219extern struct inet_timewait_death_row tcp_death_row; 245extern struct inet_timewait_death_row tcp_death_row;
220 246
221/* sysctl variables for tcp */ 247/* sysctl variables for tcp */
@@ -398,7 +424,8 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *
398 const struct tcphdr *th); 424 const struct tcphdr *th);
399extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 425extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
400 struct request_sock *req, 426 struct request_sock *req,
401 struct request_sock **prev); 427 struct request_sock **prev,
428 bool fastopen);
402extern int tcp_child_process(struct sock *parent, struct sock *child, 429extern int tcp_child_process(struct sock *parent, struct sock *child,
403 struct sk_buff *skb); 430 struct sk_buff *skb);
404extern bool tcp_use_frto(struct sock *sk); 431extern bool tcp_use_frto(struct sock *sk);
@@ -411,12 +438,6 @@ extern void tcp_metrics_init(void);
411extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); 438extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check);
412extern bool tcp_remember_stamp(struct sock *sk); 439extern bool tcp_remember_stamp(struct sock *sk);
413extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 440extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
414extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
415 struct tcp_fastopen_cookie *cookie,
416 int *syn_loss, unsigned long *last_syn_loss);
417extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
418 struct tcp_fastopen_cookie *cookie,
419 bool syn_lost);
420extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 441extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
421extern void tcp_disable_fack(struct tcp_sock *tp); 442extern void tcp_disable_fack(struct tcp_sock *tp);
422extern void tcp_close(struct sock *sk, long timeout); 443extern void tcp_close(struct sock *sk, long timeout);
@@ -458,7 +479,8 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
458extern int tcp_connect(struct sock *sk); 479extern int tcp_connect(struct sock *sk);
459extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 480extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
460 struct request_sock *req, 481 struct request_sock *req,
461 struct request_values *rvp); 482 struct request_values *rvp,
483 struct tcp_fastopen_cookie *foc);
462extern int tcp_disconnect(struct sock *sk, int flags); 484extern int tcp_disconnect(struct sock *sk, int flags);
463 485
464void tcp_connect_init(struct sock *sk); 486void tcp_connect_init(struct sock *sk);
@@ -527,6 +549,7 @@ extern void tcp_send_delayed_ack(struct sock *sk);
527extern void tcp_cwnd_application_limited(struct sock *sk); 549extern void tcp_cwnd_application_limited(struct sock *sk);
528extern void tcp_resume_early_retransmit(struct sock *sk); 550extern void tcp_resume_early_retransmit(struct sock *sk);
529extern void tcp_rearm_rto(struct sock *sk); 551extern void tcp_rearm_rto(struct sock *sk);
552extern void tcp_reset(struct sock *sk);
530 553
531/* tcp_timer.c */ 554/* tcp_timer.c */
532extern void tcp_init_xmit_timers(struct sock *); 555extern void tcp_init_xmit_timers(struct sock *);
@@ -576,6 +599,7 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
576extern int tcp_mss_to_mtu(struct sock *sk, int mss); 599extern int tcp_mss_to_mtu(struct sock *sk, int mss);
577extern void tcp_mtup_init(struct sock *sk); 600extern void tcp_mtup_init(struct sock *sk);
578extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); 601extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
602extern void tcp_init_buffer_space(struct sock *sk);
579 603
580static inline void tcp_bound_rto(const struct sock *sk) 604static inline void tcp_bound_rto(const struct sock *sk)
581{ 605{
@@ -889,15 +913,21 @@ static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp)
889 return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH; 913 return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH;
890} 914}
891 915
916static inline bool tcp_in_cwnd_reduction(const struct sock *sk)
917{
918 return (TCPF_CA_CWR | TCPF_CA_Recovery) &
919 (1 << inet_csk(sk)->icsk_ca_state);
920}
921
892/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 922/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
893 * The exception is rate halving phase, when cwnd is decreasing towards 923 * The exception is cwnd reduction phase, when cwnd is decreasing towards
894 * ssthresh. 924 * ssthresh.
895 */ 925 */
896static inline __u32 tcp_current_ssthresh(const struct sock *sk) 926static inline __u32 tcp_current_ssthresh(const struct sock *sk)
897{ 927{
898 const struct tcp_sock *tp = tcp_sk(sk); 928 const struct tcp_sock *tp = tcp_sk(sk);
899 929
900 if ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_CWR | TCPF_CA_Recovery)) 930 if (tcp_in_cwnd_reduction(sk))
901 return tp->snd_ssthresh; 931 return tp->snd_ssthresh;
902 else 932 else
903 return max(tp->snd_ssthresh, 933 return max(tp->snd_ssthresh,
@@ -1094,6 +1124,8 @@ static inline void tcp_openreq_init(struct request_sock *req,
1094 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ 1124 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
1095 req->cookie_ts = 0; 1125 req->cookie_ts = 0;
1096 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 1126 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1127 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1128 tcp_rsk(req)->snt_synack = 0;
1097 req->mss = rx_opt->mss_clamp; 1129 req->mss = rx_opt->mss_clamp;
1098 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 1130 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1099 ireq->tstamp_ok = rx_opt->tstamp_ok; 1131 ireq->tstamp_ok = rx_opt->tstamp_ok;
@@ -1106,6 +1138,15 @@ static inline void tcp_openreq_init(struct request_sock *req,
1106 ireq->loc_port = tcp_hdr(skb)->dest; 1138 ireq->loc_port = tcp_hdr(skb)->dest;
1107} 1139}
1108 1140
1141/* Compute time elapsed between SYNACK and the ACK completing 3WHS */
1142static inline void tcp_synack_rtt_meas(struct sock *sk,
1143 struct request_sock *req)
1144{
1145 if (tcp_rsk(req)->snt_synack)
1146 tcp_valid_rtt_meas(sk,
1147 tcp_time_stamp - tcp_rsk(req)->snt_synack);
1148}
1149
1109extern void tcp_enter_memory_pressure(struct sock *sk); 1150extern void tcp_enter_memory_pressure(struct sock *sk);
1110 1151
1111static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1152static inline int keepalive_intvl_when(const struct tcp_sock *tp)
@@ -1298,15 +1339,34 @@ extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff
1298extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1339extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1299 const struct tcp_md5sig_key *key); 1340 const struct tcp_md5sig_key *key);
1300 1341
1342/* From tcp_fastopen.c */
1343extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1344 struct tcp_fastopen_cookie *cookie,
1345 int *syn_loss, unsigned long *last_syn_loss);
1346extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1347 struct tcp_fastopen_cookie *cookie,
1348 bool syn_lost);
1301struct tcp_fastopen_request { 1349struct tcp_fastopen_request {
1302 /* Fast Open cookie. Size 0 means a cookie request */ 1350 /* Fast Open cookie. Size 0 means a cookie request */
1303 struct tcp_fastopen_cookie cookie; 1351 struct tcp_fastopen_cookie cookie;
1304 struct msghdr *data; /* data in MSG_FASTOPEN */ 1352 struct msghdr *data; /* data in MSG_FASTOPEN */
1305 u16 copied; /* queued in tcp_connect() */ 1353 u16 copied; /* queued in tcp_connect() */
1306}; 1354};
1307
1308void tcp_free_fastopen_req(struct tcp_sock *tp); 1355void tcp_free_fastopen_req(struct tcp_sock *tp);
1309 1356
1357extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1358int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1359void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc);
1360
1361#define TCP_FASTOPEN_KEY_LENGTH 16
1362
1363/* Fastopen key context */
1364struct tcp_fastopen_context {
1365 struct crypto_cipher __rcu *tfm;
1366 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1367 struct rcu_head rcu;
1368};
1369
1310/* write queue abstraction */ 1370/* write queue abstraction */
1311static inline void tcp_write_queue_purge(struct sock *sk) 1371static inline void tcp_write_queue_purge(struct sock *sk)
1312{ 1372{
@@ -1510,7 +1570,8 @@ struct tcp_iter_state {
1510 sa_family_t family; 1570 sa_family_t family;
1511 enum tcp_seq_states state; 1571 enum tcp_seq_states state;
1512 struct sock *syn_wait_sk; 1572 struct sock *syn_wait_sk;
1513 int bucket, offset, sbucket, num, uid; 1573 int bucket, offset, sbucket, num;
1574 kuid_t uid;
1514 loff_t last_pos; 1575 loff_t last_pos;
1515}; 1576};
1516 1577
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 639dd1316d37..a3083bf209db 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -263,7 +263,7 @@ struct km_event {
263 } data; 263 } data;
264 264
265 u32 seq; 265 u32 seq;
266 u32 pid; 266 u32 portid;
267 u32 event; 267 u32 event;
268 struct net *net; 268 struct net *net;
269}; 269};
@@ -313,7 +313,7 @@ extern void km_state_notify(struct xfrm_state *x, const struct km_event *c);
313 313
314struct xfrm_tmpl; 314struct xfrm_tmpl;
315extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 315extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
316extern void km_state_expired(struct xfrm_state *x, int hard, u32 pid); 316extern void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
317extern int __xfrm_state_delete(struct xfrm_state *x); 317extern int __xfrm_state_delete(struct xfrm_state *x);
318 318
319struct xfrm_state_afinfo { 319struct xfrm_state_afinfo {
@@ -576,7 +576,7 @@ struct xfrm_mgr {
576 struct list_head list; 576 struct list_head list;
577 char *id; 577 char *id;
578 int (*notify)(struct xfrm_state *x, const struct km_event *c); 578 int (*notify)(struct xfrm_state *x, const struct km_event *c);
579 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 579 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp);
580 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 580 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
581 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 581 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
582 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c); 582 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c);
@@ -1557,7 +1557,7 @@ extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1557#endif 1557#endif
1558 1558
1559extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1559extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1560extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1560extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid);
1561extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1561extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1562 1562
1563extern void xfrm_input_init(void); 1563extern void xfrm_input_init(void);
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 5cb20ccb1956..62b4edab15d3 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -119,29 +119,5 @@ struct scsi_nl_host_vendor_msg {
119 (hdr)->msglen = mlen; \ 119 (hdr)->msglen = mlen; \
120 } 120 }
121 121
122
123#ifdef __KERNEL__
124
125#include <scsi/scsi_host.h>
126
127/* Exported Kernel Interfaces */
128int scsi_nl_add_transport(u8 tport,
129 int (*msg_handler)(struct sk_buff *),
130 void (*event_handler)(struct notifier_block *, unsigned long, void *));
131void scsi_nl_remove_transport(u8 tport);
132
133int scsi_nl_add_driver(u64 vendor_id, struct scsi_host_template *hostt,
134 int (*nlmsg_handler)(struct Scsi_Host *shost, void *payload,
135 u32 len, u32 pid),
136 void (*nlevt_handler)(struct notifier_block *nb,
137 unsigned long event, void *notify_ptr));
138void scsi_nl_remove_driver(u64 vendor_id);
139
140void scsi_nl_send_transport_msg(u32 pid, struct scsi_nl_hdr *hdr);
141int scsi_nl_send_vendor_msg(u32 pid, unsigned short host_no, u64 vendor_id,
142 char *data_buf, u32 data_len);
143
144#endif /* __KERNEL__ */
145
146#endif /* SCSI_NETLINK_H */ 122#endif /* SCSI_NETLINK_H */
147 123