Benoit Goby [Tue, 6 Nov 2012 02:47:08 +0000 (18:47 -0800)]
usb: gadget: Fix android gadget driver build
Removed obsolete f_adb function
Change-Id: Idfb4110429bc0ea63f493c68ad667f49ca471987
Signed-off-by: Benoit Goby <benoit@android.com>
Arve Hjønnevåg [Wed, 28 Nov 2012 03:29:04 +0000 (19:29 -0800)]
usb: gadget: android: Fixes and hacks to make android usb gadget compile on 3.8
Change-Id: I332a6802dbd49b4018b9318b8621d26ed94c955d
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Arve Hjønnevåg [Tue, 27 Nov 2012 00:09:13 +0000 (16:09 -0800)]
usb: otg: otg-wakelock: Fix build for 3.7
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Todd Poynor [Wed, 28 Nov 2012 21:03:40 +0000 (13:03 -0800)]
usb: gadget: accessory: Fix section mismatch (again)
create_bulk_endpoints should not be __init since it is called when
accessory is enabled.
Change-Id: Iac6e9f29d53c93760e926efd8e7603432632acb4
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Mike Lockwood [Fri, 11 May 2012 16:01:08 +0000 (09:01 -0700)]
USB: gadget: f_audio_source: New gadget driver for audio output
This driver presents a standard USB audio class interface to the host
and an ALSA PCM device to userspace
Change-Id: If16b14a5ff27045f9cb2daaf1ae9195c5eeab7d0
Signed-off-by: Mike Lockwood <lockwood@google.com>
Mike Lockwood [Mon, 26 Mar 2012 18:03:55 +0000 (11:03 -0700)]
USB: gadget: f_accessory: Add support for HID input devices
Change-Id: I4f1452db32508382df52acdc47c0eb395ae328c7
Signed-off-by: Mike Lockwood <lockwood@google.com>
Mike Lockwood [Fri, 11 May 2012 16:00:40 +0000 (09:00 -0700)]
USB: gadget: Add ACCESSORY_SET_AUDIO_MODE control request and ioctl
The control request will be used by the host to enable/disable USB audio
and the ioctl will be used by userspace to read the audio mode
Change-Id: I81c38611b588451e80eacdccc417ca6e11c60cab
Signed-off-by: Mike Lockwood <lockwood@google.com>
Benoit Goby [Sat, 23 Jun 2012 01:17:10 +0000 (18:17 -0700)]
usb: gadget: accessory: Fix section mismatch
create_bulk_endpoints should not be __init since it is called when
accessory is enabled
Change-Id: If827a4531f0f6c15af938345163923186368e2a5
Signed-off-by: Benoit Goby <benoit@android.com>
Benoit Goby [Thu, 10 May 2012 23:41:40 +0000 (16:41 -0700)]
usb: otg: otg-wakelock: Fix build for 3.4
Change-Id: I97e21e9e6645bf18522675039e512f85fe836794
Signed-off-by: Benoit Goby <benoit@android.com>
Benoit Goby [Tue, 20 Mar 2012 01:56:52 +0000 (18:56 -0700)]
usb: gadget: adb: Only enable the gadget when adbd is ready
When adb is enabled, only connect the gadget when adbd is ready. If adbd
dies or is restarted (e.g. "adb root"), the gadget is disconnected when
the adb device is close, and it is re-connected once adb re-open the
device.
- Add callbacks to adb, similar to FunctionFs callbacks, to notify the
gadget when the daemon is ready or closed.
- Refcount calls to android_enable/android_disable to enable the gadget
only once all the function daemons are ready.
- Add enable/disble to android_usb_function to notify the function when
it is added/removed from the list of enabled functions.
Change-Id: Id54ff85aec9cf8715c94b4f9bd6137a79ad58bfc
Signed-off-by: Benoit Goby <benoit@android.com>
Colin Cross [Fri, 9 Mar 2012 01:57:51 +0000 (17:57 -0800)]
usb: gadget: adb: do not set error flag when dequeuing req
When an ep_out req is dequeued because of userspace freezing,
don't set the error flag.
Change-Id: I680f1a1059b8ac2244aaa069e7d42dc44abf98e9
Signed-off-by: Colin Cross <ccross@android.com>
Colin Cross [Mon, 5 Mar 2012 21:29:45 +0000 (13:29 -0800)]
usb: gadget: adb: allow freezing in adb_read
wait_event_interruptible in adb_read might return -ERESTARTSYS if
userspace is frozen during adb_read or another signal is delivered
to adb. If so, don't set dev->error to avoid resetting the adb
connection.
Change-Id: I5a7baa013a9a3a3b5305de7e6a0d18546a560018
Signed-off-by: Colin Cross <ccross@android.com>
Benoit Goby [Mon, 19 Dec 2011 22:39:37 +0000 (14:39 -0800)]
usb: gadget: accessory: Add Android Accessory function
USB accessory mode allows users to connect USB host hardware
specifically designed for Android-powered devices. The accessories
must adhere to the Android accessory protocol outlined in the
http://accessories.android.com documentation. This allows
Android devices that cannot act as a USB host to still interact with
USB hardware. When an Android device is in USB accessory mode, the
attached Android USB accessory acts as the host, provides power
to the USB bus, and enumerates connected devices.
Change-Id: I67964b50d278f3c0471d47efbb7b0973a3502681
Signed-off-by: Mike Lockwood <lockwood@android.com>
Benoit Goby [Mon, 19 Dec 2011 22:38:41 +0000 (14:38 -0800)]
usb: gadget: adb: Add ADB function
Android Debug Bridge (adb) is a command line tool that lets
users communicate with a Android-powered device. It is used
mainly to debug applications and tranfer files. f_adb implements
the transport layer between the ADB Server (on the host) and the
ADBD daemon (on the device).
Change-Id: Ib11672fa3439dcb3a6588774b132b5a85e03e8ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
Benoit Goby [Mon, 19 Dec 2011 22:37:50 +0000 (14:37 -0800)]
usb: gadget: mtp: Add MTP/PTP function
USB gadget function driver used by the Android framework to
implement the MTP and PTP protocols. It creates a character device
that provides an interface for fast transfer of files and
supports transferring files greater than 4GB.
Change-Id: I2d8f2c37029fb37d8deb791d04eb7346f94f5adb
Signed-off-by: Mike Lockwood <lockwood@android.com>
Colin Cross [Wed, 1 Feb 2012 22:23:15 +0000 (14:23 -0800)]
usb: otg: otg-wakelock: fix build for 3.3
Add missing module.h include
Change-Id: Ib0538ca569c9e0713ceefcd1f91c6bc089d2f2ba
Signed-off-by: Colin Cross <ccross@android.com>
Todd Poynor [Tue, 27 Sep 2011 03:35:30 +0000 (20:35 -0700)]
usb: otg: Temporarily grab wakelock on charger and disconnect events
Change-Id: If995d4af4adcb08e8369009483f2956ad9627267
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Todd Poynor [Sat, 2 Jul 2011 00:19:56 +0000 (17:19 -0700)]
USB: OTG: Take wakelock when VBUS present
Enabled by default, can disable with:
echo N > /sys/module/otg_wakelock/parameters/enabled
Change-Id: I34974624c52ae23490852b44c270d2f326cf6116
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Dmitry Shmidt [Mon, 12 Jan 2015 21:42:05 +0000 (13:42 -0800)]
wlan: Add get_wake_irq functionality
Change-Id: Ic41f06c509b2e625dc9ec4131903db6920c5fd4e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Dmitry Shmidt [Fri, 22 Aug 2014 21:40:18 +0000 (14:40 -0700)]
Add flags parameter to get_country_code template
Change-Id: Ic3f173db144a301ea104f544fc8ec723241c1d59
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Dmitry Shmidt [Tue, 15 Feb 2011 00:58:48 +0000 (16:58 -0800)]
net: wireless: Add get_country_code functionality to platform
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Dmitry Shmidt [Thu, 3 Jun 2010 17:55:33 +0000 (10:55 -0700)]
network: wireless: Add get_mac_addr functionality to platform
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Dmitry Shmidt [Thu, 18 Mar 2010 23:04:18 +0000 (16:04 -0700)]
wlan: Create generic wlan platform data header
Change-Id: I233559218cc40acb28b57315ea25c08a9c866725
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Dmitry Shmidt [Tue, 24 Jun 2014 16:36:50 +0000 (09:36 -0700)]
net: wireless: Decrease scan entry expiration to avoid stall results
Change-Id: I0e23ce45d78d7c17633670973f49943a5ed6032d
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Ashish Sharma [Sat, 8 Oct 2011 00:54:16 +0000 (17:54 -0700)]
bridge: Have tx_bytes count headers like rx_bytes.
Since rx_bytes accounting does not include Ethernet Headers in
br_input.c, excluding ETH_HLEN on the transmit path for consistent
measurement of packet length on both the Tx and Rx chains.
The clean way would be for Rx to include the eth header, but the
skb len has already been adjusted by the time the br code sees the skb.
This is only a temporary workaround until we can completely ignore or
cleanly fix the skb->len handling.
Change-Id: I910de95a4686b2119da7f1f326e2154ef31f9972
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
Nick Pelly [Fri, 5 Dec 2008 01:37:05 +0000 (17:37 -0800)]
rfkill: Introduce CONFIG_RFKILL_PM and use instead of CONFIG_PM to power down
Some platforms do not want to power down rfkill devices on suspend.
Change-Id: I62a11630521c636d54a4a02ab9037a43435925f5
Signed-off-by: Nick Pelly <npelly@google.com>
Tushar Behera [Wed, 26 Mar 2014 09:57:05 +0000 (15:27 +0530)]
tcp: Fix IPV6 module build errors
If CONFIG_IPV6=m is selected, we are getting following build errors.
net/built-in.o: In function `tcp_is_local6':
net/ipv4/tcp.c:3261: undefined reference to `rt6_lookup'
Making the code conditional upon only CONFIG_IPV6=y fixes this issue.
Also export tcp_nuke_addr to build IPv6 modules. Otherwise
we run into following build error:
CC [M] lib/zlib_deflate/deftree.o
CC [M] lib/zlib_deflate/deflate_syms.o
LD [M] lib/zlib_deflate/zlib_deflate.o
Building modules, stage 2.
MODPOST 46 modules
ERROR: "tcp_nuke_addr" [net/ipv6/ipv6.ko] undefined!
make[2]: *** [__modpost] Error 1
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
CC: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Amit Pundir [Wed, 15 Apr 2015 14:59:09 +0000 (20:29 +0530)]
net: ipv6: fix virtual tunneling build
IPv6 PMTUD has been updated to support UID-based routing.
Pass INVALID_UID as the socket UID to ip6_update_pmtu(),
otherwise we run into following build error:
----------------
CC net/ipv6/ip6_vti.o
net/ipv6/ip6_vti.c: In function ‘vti6_err’:
net/ipv6/ip6_vti.c:559:3: error: too few arguments to function ‘ip6_update_pmtu’
In file included from include/net/ip_tunnels.h:19:0,
from net/ipv6/ip6_vti.c:44:
include/net/ip6_route.h:110:6: note: declared here
make[2]: *** [net/ipv6/ip6_vti.o] Error 1
----------------
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Lorenzo Colitti [Wed, 28 Oct 2015 06:56:59 +0000 (15:56 +0900)]
Don't kill IPv4 sockets when killing IPv6 sockets was requested.
c7c3ec4903d32c60423ee013d96e94602f66042c cherry-picked the
tcp_nuke_addr ioctl, but omitted a check that ensures that a
socket is an IPv6 socket. This makes it so that if we issue a
SIOCKILLADDR on ::, it kills IPv4 sockets as well.
This is because every IPv4 socket has an IPv6 source address
(sk_v6_rcv_saddr) of ::. Thus, when we iterate over an IPv4
socket, and compare the source address of the socket to the
source address in the ioctl, it matches the :: that was passed
in, and we kill the socket.
Change-Id: I736431a898e6ec91536536d352936a210aa10100
Dmitry Shmidt [Wed, 28 Oct 2015 01:09:40 +0000 (18:09 -0700)]
tcp: fix tcp_default_init_rwnd() for 4.1
Change-Id: If3ecf5f59acf379ffcc468f28434830a92b0383d
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Lorenzo Colitti [Wed, 26 Mar 2014 04:03:12 +0000 (13:03 +0900)]
net: support marking accepting TCP sockets
When using mark-based routing, sockets returned from accept()
may need to be marked differently depending on the incoming
connection request.
This is the case, for example, if different socket marks identify
different networks: a listening socket may want to accept
connections from all networks, but each connection should be
marked with the network that the request came in on, so that
subsequent packets are sent on the correct network.
This patch adds a sysctl to mark TCP sockets based on the fwmark
of the incoming SYN packet. If enabled, and an unmarked socket
receives a SYN, then the SYN packet's fwmark is written to the
connection's inet_request_sock, and later written back to the
accepted socket when the connection is established. If the
socket already has a nonzero mark, then the behaviour is the same
as it is today, i.e., the listening socket's fwmark is used.
Black-box tested using user-mode linux:
- IPv4/IPv6 SYN+ACK, FIN, etc. packets are routed based on the
mark of the incoming SYN packet.
- The socket returned by accept() is marked with the mark of the
incoming SYN packet.
- Tested with syncookies=1 and syncookies=2.
Change-Id: I26bc1eceefd2c588d73b921865ab70e4645ade57
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
JP Abgrall [Sat, 8 Feb 2014 02:40:10 +0000 (18:40 -0800)]
tcp: add a sysctl to config the tcp_default_init_rwnd
The default initial rwnd is hardcoded to 10.
Now we allow it to be controlled via
/proc/sys/net/ipv4/tcp_default_init_rwnd
which limits the values from 3 to 100
This is somewhat needed because ipv6 routes are
autoconfigured by the kernel.
See "An Argument for Increasing TCP's Initial Congestion Window"
in https://developers.google.com/speed/articles/tcp_initcwnd_paper.pdf
Change-Id: I386b2a9d62de0ebe05c1ebe1b4bd91b314af5c54
Signed-off-by: JP Abgrall <jpa@google.com>
Conflicts:
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_input.c
Arve Hjønnevåg [Tue, 14 May 2013 03:39:30 +0000 (20:39 -0700)]
net: activity_stats: Stop using obsolete create_proc_read_entry api
Convert to use seq_read
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Mike Chan [Fri, 28 May 2010 21:32:19 +0000 (14:32 -0700)]
net: activity_stats: Add statistics for network transmission activity
When enabled, tracks the frequency of network transmissions
(inbound and outbound) and buckets them accordingly.
Buckets are determined by time between network activity.
Each bucket represents the number of network transmisions that were
N sec or longer apart. Where N is defined as 1 << bucket index.
This network pattern tracking is particularly useful for wireless
networks (ie: 3G) where batching network activity closely together
is more power efficient than far apart.
New file: /proc/net/stat/activity
output:
Min Bucket(sec) Count
1 7
2 0
4 1
8 0
16 0
32 2
64 1
128 0
Change-Id: I4c4cd8627b872a55f326b1715c51bc3bdd6e8d92
Signed-off-by: Mike Chan <mike@android.com>
liping.zhang [Mon, 11 Jan 2016 05:31:01 +0000 (13:31 +0800)]
xt_qtaguid: fix a race condition in if_tag_stat_update
Miss a lock protection in if_tag_stat_update while doing get_iface_entry. So if
one CPU is doing iface_stat_create while another CPU is doing if_tag_stat_update,
race will happened.
Change-Id: Ib8d98e542f4e385685499f5b7bb7354f08654a75
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Amit Pundir [Fri, 20 Nov 2015 09:15:40 +0000 (14:45 +0530)]
netfilter: xt_qtaguid/socket: build fixes for 4.4
Update xt_socket_lookup_slow_v* usage in aosp patches, to
align with changes from mainline commit
686c9b50809d
"netfilter: x_tables: Use par->net instead of computing
from the passed net devices".
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Amit Pundir [Mon, 6 Jul 2015 18:58:49 +0000 (00:28 +0530)]
netfilter: xt_qtaguid: xt_socket: build fixes
Add missing header <linux/miscdevice.h> and use
xt_socket_lookup_slow_v* instead of xt_socket_get*_sk
in xt_qtaguid.c.
Fix xt_socket_lookup_slow_v* functions in xt_socket.c
and declare them in xt_socket.h
Change-Id: I55819b2d4ffa82a2be20995c87d28fb5cc77b5ba
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Dmitry Torokhov [Thu, 3 Sep 2015 21:48:52 +0000 (14:48 -0700)]
net: xt_qtaguid/xt_socket: fix refcount underflow and crash
xt_socket_get[4|6]_sk() do not always increment sock refcount, which
causes confusion in xt_qtaguid module which is not aware of this fact
and drops the reference whether it should have or not. Fix it by
changing xt_socket_get[4|6]_sk() to always increment recount of returned
sock.
This should fix the following crash:
[ 111.319523] BUG: failure at
/mnt/host/source/src/third_party/kernel/v3.18/net/ipv4/inet_timewait_sock.c:90/__inet_twsk_kill()!
[ 111.331192] Kernel panic - not syncing: BUG!
[ 111.335468] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G U W
3.18.0-06867-g268df91 #1
[ 111.343810] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
[ 111.349463] Call trace:
[ 111.351917] [<
ffffffc000207288>] dump_backtrace+0x0/0x10c
[ 111.357314] [<
ffffffc0002073a4>] show_stack+0x10/0x1c
[ 111.362367] [<
ffffffc000a82d1c>] dump_stack+0x74/0x94
[ 111.367414] [<
ffffffc000a81824>] panic+0xec/0x238
[ 111.372116] [<
ffffffc000981648>] __inet_twsk_kill+0xd0/0xf8
[ 111.377684] [<
ffffffc0009817b0>] inet_twdr_do_twkill_work+0x64/0xd0
[ 111.383946] [<
ffffffc000981a5c>] inet_twdr_hangman+0x2c/0xa4
[ 111.389602] [<
ffffffc000271cf0>] call_timer_fn+0xac/0x160
[ 111.394995] [<
ffffffc00027250c>] run_timer_softirq+0x23c/0x274
[ 111.400824] [<
ffffffc000220a68>] __do_softirq+0x1a4/0x330
[ 111.406218] [<
ffffffc000220e94>] irq_exit+0x70/0xd0
[ 111.411093] [<
ffffffc000264e00>] __handle_domain_irq+0x84/0xa8
[ 111.416922] [<
ffffffc0002003ec>] gic_handle_irq+0x4c/0x80
b/
22476945
Originally reviewed at:
https://chromium-review.googlesource.com/#/c/297414/
Change-Id: I51fa94a9d92a84a0bd3b58466d711e46a6892a79
Signed-off-by: Dmitry Torokhov <dtor@google.com>
[jstultz: Cherry-picked and added missing local var definition]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Amit Pundir [Wed, 28 Jan 2015 19:46:23 +0000 (01:16 +0530)]
xt_qtaguid: use sock_gen_put() instead of xt_socket_put_sk()
Removing obsolete xt_socket_put_sk() and using sock_gen_put() instead.
xt_socket_put_sk() was reintroduced for xt_qtaguid in one of the patches,
but it turned out sock_gen_put() supersedes xt_socket_put_sk(). So we
don't need xt_socket_put_sk() any more.
This patch is based on commit
1a8bf6eeef9f (netfilter: xt_socket: use sock_gen_put())
Change-Id: I976d5f7f7eded0f3cc91b596acfeb35e4c2057e5
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from commit
551780fc28cb7480dbc4f585ef80ca02c2922ec1)
Signed-off-by: John Stultz <john.stultz@linaro.org>
Mohamad Ayyash [Wed, 14 Jan 2015 03:20:44 +0000 (19:20 -0800)]
xt_qtaguid: Use sk_callback_lock read locks before reading sk->sk_socket
It prevents a kernel panic when accessing sk->sk_socket fields due to NULLing sk->sk_socket when sock_orphan is called through
sk_common_release.
Change-Id: I4aa46b4e2d8600e4d4ef8dcdd363aa4e6e5f8433
Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
(cherry picked from commit
cdea0ebcb8bcfe57688f6cb692b49e550ebd9796)
Signed-off-by: John Stultz <john.stultz@linaro.org>
Amit Pundir [Tue, 20 Jan 2015 10:43:08 +0000 (16:13 +0530)]
xt_qtaguid: fix broken uid/gid range check
The existing test to check if current uid/gid is within
valid range is broken due to missing parenthesis.
Change-Id: I889ebbd0e2ea6a9426cb1509a2975e7107666407
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 28 Mar 2014 23:23:48 +0000 (16:23 -0700)]
netfilter: Build fixups - kuid/kguid changes & xt_socket_get/put_sk
Fix up build kuid/kguid build issues in netfilter code.
Also re-add the xt_socket_get/put_sk interfaces needed by xt_qtaguid.
Change-Id: I7027fb840e109785bddffe8ea717b8d018b26d82
Signed-off-by: John Stultz <john.stultz@linaro.org>
Sreeram Ramachandran [Tue, 8 Jul 2014 18:57:14 +0000 (11:57 -0700)]
net: core: Handle 'sk' being NULL in UID-based routing
It has Amit Pundir <amit.pundir@linaro.org> fix:
net: core: fix UID-based routing build
Bug:
15413527
Change-Id: Iab1fae9da6053b284591628ef1de878761b137b1
Signed-off-by: Sreeram Ramachandran <sreeram@google.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Lorenzo Colitti [Mon, 31 Mar 2014 07:23:51 +0000 (16:23 +0900)]
net: core: Support UID-based routing.
This contains the following commits:
1.
cc2f522 net: core: Add a UID range to fib rules.
2.
d7ed2bd net: core: Use the socket UID in routing lookups.
3.
2f9306a net: core: Add a RTA_UID attribute to routes.
This is so that userspace can do per-UID route lookups.
4.
8e46efb net: ipv6: Use the UID in IPv6 PMTUD
IPv4 PMTUD already does this because ipv4_sk_update_pmtu
uses __build_flow_key, which includes the UID.
Bug:
15413527
Change-Id: Iae3d4ca3979d252b6cec989bdc1a6875f811f03a
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Amit Pundir [Tue, 24 Mar 2015 22:59:14 +0000 (04:29 +0530)]
net: ipv6: fix build failure if IPV6_ROUTE_INFO config is enabled
Pass correct arguments to rt6_get_route_info() function, otherwise
we run into following Kernel build failure:
----------
CC net/ipv6/route.o
net/ipv6/route.c: In function ‘rt6_route_rcv’:
net/ipv6/route.c:746:27: error: ‘net’ undeclared (first use in this function)
net/ipv6/route.c:746:27: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [net/ipv6/route.o] Error 1
make[1]: *** [net/ipv6] Error 2
make: *** [net] Error 2
----------
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Lorenzo Colitti [Wed, 26 Mar 2014 10:35:41 +0000 (19:35 +0900)]
net: ipv6: autoconf routes into per-device tables
Currently, IPv6 router discovery always puts routes into
RT6_TABLE_MAIN. This causes problems for connection managers
that want to support multiple simultaneous network connections
and want control over which one is used by default (e.g., wifi
and wired).
To work around this connection managers typically take the routes
they prefer and copy them to static routes with low metrics in
the main table. This puts the burden on the connection manager
to watch netlink to see if the routes have changed, delete the
routes when their lifetime expires, etc.
Instead, this patch adds a per-interface sysctl to have the
kernel put autoconf routes into different tables. This allows
each interface to have its own autoconf table, and choosing the
default interface (or using different interfaces at the same
time for different types of traffic) can be done using
appropriate ip rules.
The sysctl behaves as follows:
- = 0: default. Put routes into RT6_TABLE_MAIN as before.
- > 0: manual. Put routes into the specified table.
- < 0: automatic. Add the absolute value of the sysctl to the
device's ifindex, and use that table.
The automatic mode is most useful in conjunction with
net.ipv6.conf.default.accept_ra_rt_table. A connection manager
or distribution could set it to, say, -100 on boot, and
thereafter just use IP rules.
Change-Id: I82d16e3737d9cdfa6489e649e247894d0d60cbb1
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Amit Pundir [Mon, 11 May 2015 09:09:59 +0000 (14:39 +0530)]
nf: IDLETIMER: Fix broken uid field in the msg
Create uid from kuid to fix the broken uid field
in the message notifications introduced in
Change-Id: I18fc73eada512e370d7ab24fc9f890845037b729,
Otherwise we run into following build error:
---------------
CC net/netfilter/xt_IDLETIMER.o
net/netfilter/xt_IDLETIMER.c: In function ‘reset_timer’:
net/netfilter/xt_IDLETIMER.c:360:16: error: incompatible types when assigning to type ‘uid_t’ from type ‘kuid_t’
make[2]: *** [net/netfilter/xt_IDLETIMER.o] Error 1
---------------
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
(cherry picked from commit
706060ba3e1dee9ec3c4a4a1480d663b6cd71cad)
Change-Id: Ifd66df45a58d1a5a60c3816c373ee3008292eee8
Ruchi Kandoi [Thu, 23 Apr 2015 19:09:09 +0000 (12:09 -0700)]
nf: IDLETIMER: Adds the uid field in the msg
Message notifications contains an additional uid field. This field
represents the uid that was responsible for waking the radio. And hence
it is present only in notifications stating that the radio is now
active.
Change-Id: I18fc73eada512e370d7ab24fc9f890845037b729
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Bug:
20264396
Sherman Yin [Thu, 12 Jun 2014 21:35:38 +0000 (14:35 -0700)]
netfilter: fix seq_printf type mismatch warning
The return type of atomic64_read() varies depending on arch. The
arm64 version is being changed from long long to long in the mainline
for v3.16, causing a seq_printf type mismatch (%llu) in
guid_ctrl_proc_show().
This commit fixes the type mismatch by casting atomic64_read() to u64.
Change-Id: Iae0a6bd4314f5686a9f4fecbe6203e94ec0870de
Signed-off-by: Sherman Yin <shermanyin@gmail.com>
Ruchi Kandoi [Thu, 24 Apr 2014 21:07:53 +0000 (14:07 -0700)]
nf: Remove compilation error caused by
e8430cbed3ef15fdb1ac26cfd020e010aa5f1c35
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Ruchi Kandoi [Tue, 25 Mar 2014 23:43:28 +0000 (16:43 -0700)]
nf: IDLETIMER: time-stamp and suspend/resume handling.
Message notifications contains an additional timestamp field in nano seconds.
The expiry time for the timers are modified during suspend/resume.
If timer was supposed to expire while the system is suspended then a
notification is sent when it resumes with the timestamp of the scheduled expiry.
Removes the race condition for multiple work scheduled.
Bug:
13247811
Change-Id: I752c5b00225fe7085482819f975cc0eb5af89bff
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Jon Medhurst (Tixy) [Tue, 15 Apr 2014 04:20:49 +0000 (21:20 -0700)]
xt_qtaguid: Fix boot panic
We need the change below because of mainline commit
351638e7de (net: pass
info struct via netdevice notifier). Otherwise we panic.
Change-Id: I7daf7513a733933fdcbaeebea7f8191f8b6a0432
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 28 Mar 2014 19:19:27 +0000 (12:19 -0700)]
net: kuid/kguid build fixes
Small build fixes for xt_quota2 and ipv4 changes
Change-Id: Ib098768040c8875887b2081c3165a6c83b37e180
Signed-off-by: John Stultz <john.stultz@linaro.org>
JP Abgrall [Thu, 29 Sep 2011 22:36:49 +0000 (15:36 -0700)]
netfilter: ipv6: fix crash caused by ipv6_find_hdr()
When calling:
ipv6_find_hdr(skb, &thoff, -1, NULL)
on a fragmented packet, thoff would be left with a random
value causing callers to read random memory offsets with:
skb_header_pointer(skb, thoff, ...)
Now we force ipv6_find_hdr() to return a failure in this case.
Calling:
ipv6_find_hdr(skb, &thoff, -1, &fragoff)
will set fragoff as expected, and not return a failure.
Change-Id: Ib474e8a4267dd2b300feca325811330329684a88
Signed-off-by: JP Abgrall <jpa@google.com>
Greg Hackmann [Mon, 24 Feb 2014 17:39:46 +0000 (09:39 -0800)]
netfilter: xt_qtaguid: 64-bit warning fixes
Change-Id: I2adc517c0c51050ed601992fa0ea4de8f1449414
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Thu, 5 Dec 2013 01:39:27 +0000 (17:39 -0800)]
netfilter: xt_qtaguid: fix memory leak in seq_file handlers
Change-Id: I15b21230d52479d008a00d9e2191dda020f00925
Signed-off-by: Greg Hackmann <ghackmann@google.com>
JP Abgrall [Thu, 21 Feb 2013 00:38:34 +0000 (16:38 -0800)]
netfilter: xt_qtaguid: fix bad tcp_time_wait sock handling
Since (
41063e9 ipv4: Early TCP socket demux), skb's can have an sk which
is not a struct sock but the smaller struct inet_timewait_sock without an
sk->sk_socket. Now we bypass sk_state == TCP_TIME_WAIT
Signed-off-by: JP Abgrall <jpa@google.com>
Arve Hjønnevåg [Tue, 14 May 2013 03:45:02 +0000 (20:45 -0700)]
netfilter: xt_qtaguid: 3.10 fixes
Stop using obsolete procfs api.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Arve Hjønnevåg [Tue, 14 May 2013 03:42:46 +0000 (20:42 -0700)]
netfilter: xt_quota2: 3.10 fixes.
- Stop using obsolete create_proc_entry api.
- Use proc_set_user instead of directly accessing the private structure.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
JP Abgrall [Mon, 8 Apr 2013 22:09:26 +0000 (15:09 -0700)]
netfilter: qtaguid: rate limit some of the printks
Some of the printks are in the packet handling path.
We now ratelimit the very unlikely errors to avoid
kmsg spamming.
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Thu, 7 Feb 2013 01:40:07 +0000 (17:40 -0800)]
netfilter: xt_qtaguid: Allow tracking loopback
In the past it would always ignore interfaces with loopback addresses.
Now we just treat them like any other.
This also helps with writing tests that check for the presence
of the qtaguid module.
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Tue, 29 Jan 2013 00:50:44 +0000 (16:50 -0800)]
netfilter: xt_qtaguid: extend iface stat to report protocols
In the past the iface_stat_fmt would only show global bytes/packets
for the skb-based numbers.
For stall detection in userspace, distinguishing tcp vs other protocols
makes it easier.
Now we report
ifname total_skb_rx_bytes total_skb_rx_packets total_skb_tx_bytes
total_skb_tx_packets {rx,tx}_{tcp,udp,ohter}_{bytes,packets}
Bug:
6818637
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Sat, 5 Jan 2013 02:18:36 +0000 (18:18 -0800)]
netfilter: xt_qtaguid: remove AID_* dependency for access control
qtaguid limits what can be done with /ctrl and /stats based on group
membership.
This changes removes AID_NET_BW_STATS and AID_NET_BW_ACCT, and picks
up the groups from the gid of the matching proc entry files.
Signed-off-by: JP Abgrall <jpa@google.com>
Change-Id: I42e477adde78a12ed5eb58fbc0b277cdaadb6f94
Pontus Fuchs [Mon, 19 Nov 2012 19:44:51 +0000 (11:44 -0800)]
netfilter: qtaguid: Don't BUG_ON if create_if_tag_stat fails
If create_if_tag_stat fails to allocate memory (GFP_ATOMIC) the
following will happen:
qtaguid: iface_stat: tag stat alloc failed
...
kernel BUG at xt_qtaguid.c:1482!
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
JP Abgrall [Wed, 10 Oct 2012 03:38:21 +0000 (20:38 -0700)]
netfilter: xt_qtaguid: fix error exit that would keep a spinlock.
qtudev_open() could return with a uid_tag_data_tree_lock held
when an kzalloc(..., GFP_ATOMIC) would fail.
Very unlikely to get triggered AND survive the mayhem of running out of mem.
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Tue, 28 Aug 2012 23:53:32 +0000 (16:53 -0700)]
netfilter: xt_qtaguid: report only uid tags to non-privileged processes
In the past, a process could only see its own stats (uid-based summary,
and details).
Now we allow any process to see other UIDs uid-based stats, but still
hide the detailed stats.
Change-Id: I7666961ed244ac1d9359c339b048799e5db9facc
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Fri, 27 Apr 2012 19:57:39 +0000 (12:57 -0700)]
netfilter: xt_qtaguid: start tracking iface rx/tx at low level
qtaguid tracks the device stats by monitoring when it goes up and down,
then it gets the dev_stats().
But devs don't correctly report stats (either they don't count headers
symmetrically between rx/tx, or they count internal control messages).
Now qtaguid counts the rx/tx bytes/packets during raw:prerouting and
mangle:postrouting (nat is not available in ipv6).
The results are in
/proc/net/xt_qtaguid/iface_stat_fmt
which outputs a format line (bash expansion):
ifname total_skb_{rx,tx}_{bytes,packets}
Added event counters for pre/post handling.
Added extra ctrl_*() pid/uid debugging.
Change-Id: Id84345d544ad1dd5f63e3842cab229e71d339297
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Fri, 27 Apr 2012 06:28:35 +0000 (23:28 -0700)]
netfilter: xt_IDLETIMER: Add new netlink msg type
Send notifications when the label becomes active after an idle period.
Send netlink message notifications in addition to sysfs notifications.
Using a uevent with
subsystem=xt_idletimer
INTERFACE=...
STATE={active,inactive}
This is backport from common android-3.0
commit:
beb914e987cbbd368988d2b94a6661cb907c4d5a
with uevent support instead of a new netlink message type.
Change-Id: I31677ef00c94b5f82c8457e5bf9e5e584c23c523
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Tue, 17 Apr 2012 23:00:07 +0000 (16:00 -0700)]
netfilter: xt_qtaguid: fix ipv6 protocol lookup
When updating the stats for a given uid it would incorrectly assume
IPV4 and pick up the wrong protocol when IPV6.
Change-Id: Iea4a635012b4123bf7aa93809011b7b2040bb3d5
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Sat, 14 Apr 2012 02:22:35 +0000 (19:22 -0700)]
netfilter: qtaguid: initialize a local var to keep compiler happy.
There was a case that might have seemed like new_tag_stat was not
initialized and actually used.
Added comment explaining why it was impossible, and a BUG()
in case the logic gets changed.
Change-Id: I1eddd1b6f754c08a3bf89f7e9427e5dce1dfb081
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Tue, 12 Jul 2011 19:02:59 +0000 (12:02 -0700)]
netfilter: fixup the quota2, and enable.
The xt_quota2 came from
http://sourceforge.net/projects/xtables-addons/develop
It needed tweaking for it to compile within the kernel tree.
Fixed kmalloc() and create_proc_entry() invocations within
a non-interruptible context.
Removed useless copying of current quota back to the iptable's
struct matchinfo:
- those are per CPU: they will change randomly based on which
cpu gets to update the value.
- they prevent matching a rule: e.g.
-A chain -m quota2 --name q1 --quota 123
can't be followed by
-D chain -m quota2 --name q1 --quota 123
as the 123 will be compared to the struct matchinfo's quota member.
Use the NETLINK NETLINK_NFLOG family to log a single message
when the quota limit is reached.
It uses the same packet type as ipt_ULOG, but
- never copies skb data,
- uses 112 as the event number (ULOG's +1)
It doesn't log if the module param "event_num" is 0.
Change-Id: I021d3b743db3b22158cc49acb5c94d905b501492
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Tue, 21 Jun 2011 18:14:49 +0000 (11:14 -0700)]
netfilter: adding the original quota2 from xtables-addons
The original xt_quota in the kernel is plain broken:
- counts quota at a per CPU level
(was written back when ubiquitous SMP was just a dream)
- provides no way to count across IPV4/IPV6.
This patch is the original unaltered code from:
http://sourceforge.net/projects/xtables-addons
at commit
e84391ce665cef046967f796dd91026851d6bbf3
Change-Id: I19d49858840effee9ecf6cff03c23b45a97efdeb
Signed-off-by: JP Abgrall <jpa@google.com>
JP Abgrall [Mon, 20 Jun 2011 19:41:46 +0000 (12:41 -0700)]
netfilter: add xt_qtaguid matching module
This module allows tracking stats at the socket level for given UIDs.
It replaces xt_owner.
If the --uid-owner is not specified, it will just count stats based on
who the skb belongs to. This will even happen on incoming skbs as it
looks into the skb via xt_socket magic to see who owns it.
If an skb is lost, it will be assigned to uid=0.
To control what sockets of what UIDs are tagged by what, one uses:
echo t $sock_fd $accounting_tag $the_billed_uid \
> /proc/net/xt_qtaguid/ctrl
So whenever an skb belongs to a sock_fd, it will be accounted against
$the_billed_uid
and matching stats will show up under the uid with the given
$accounting_tag.
Because the number of allocations for the stats structs is not that big:
~500 apps * 32 per app
we'll just do it atomic. This avoids walking lists many times, and
the fancy worker thread handling. Slabs will grow when needed later.
It use netdevice and inetaddr notifications instead of hooks in the core dev
code to track when a device comes and goes. This removes the need for
exposed iface_stat.h.
Put procfs dirs in /proc/net/xt_qtaguid/
ctrl
stats
iface_stat/<iface>/...
The uid stats are obtainable in ./stats.
Change-Id: I01af4fd91c8de651668d3decb76d9bdc1e343919
Signed-off-by: JP Abgrall <jpa@google.com>
Amit Pundir [Tue, 8 Dec 2015 07:17:01 +0000 (12:47 +0530)]
net: PPPoPNS and PPPoLAC build fixes for 4.4
Fix couple of sk_alloc() calls to align with mainline commit
11aa9c28b420 "net: Pass kern from net_proto_family.create to sk_alloc".
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Amit Pundir [Tue, 8 Dec 2015 12:58:40 +0000 (18:28 +0530)]
Hack: net: PPPoPNS and PPPoLAC build fixes for 4.1
Upstream commit
c0371da6047a "put iov_iter into msghdr",
added iov_iter and removed direct access to scatter/gather
array elements in msghdr. It broke PPPoLAC and PPPoPNS.
Lets restore the direct access to scatter/gather array in
msghdr for the time being. Otherwise we run into following
build failure:
----------
drivers/net/ppp/pppolac.c: In function ‘pppolac_xmit_core’:
drivers/net/ppp/pppolac.c:210:4: error: unknown field ‘msg_iov’ specified in initializer
.msg_iov = (struct iovec *)&iov,
^
drivers/net/ppp/pppolac.c:211:4: error: unknown field ‘msg_iovlen’ specified in initializer
.msg_iovlen = 1,
^
make[3]: *** [drivers/net/ppp/pppolac.o] Error 1
----------
Change-Id: I2a1245a156da6d93b49f5cfd10506381b0eff005
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Amit Pundir [Tue, 8 Dec 2015 12:56:39 +0000 (18:26 +0530)]
net: pppopns: pppolac: fix sendmsg function calls
Fix couple of sendmsg() calls to align with changes
from upstream commit
1b784140474e "net: Remove iocb
argument from sendmsg and recvmsg".
Change-Id: I85bc46130af8decfa37abe65aec33053ed39f1b1
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Jon Medhurst [Wed, 19 Aug 2015 12:43:16 +0000 (13:43 +0100)]
net: PPPoPNS: Remove length argument from data_ready
The argument was removed by commit
676d23690fb6 ("net: Fix use after free by
removing length arg from sk_data_ready callbacks") and it's presence causes
warnings like:
drivers/net/ppp/pppopns.c:296:27: warning: assignment from incompatible pointer type
po->proto.pns.data_ready = sk_raw->sk_data_ready;
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Colin Cross [Thu, 7 Nov 2013 21:19:34 +0000 (13:19 -0800)]
net: move PPPoLAC and PPPoPNS headers to uapi
Move the entire contents of the linux/if_pppolac.h and
linux/if_pppopns.h headers to uapi, they only contain userspace
interfaces.
Change-Id: I3cfed7f2ae400b53269a1f59144aa3dbc30ae0b5
Signed-off-by: Colin Cross <ccross@android.com>
Andrey Konovalov [Fri, 23 Mar 2012 17:48:02 +0000 (21:48 +0400)]
Include if_pppolac.h and if_pppopns.h into header-y target
This is required to pass the headers_check
Change-Id: Ic4c773973278cbdf1cb4eb66473826cb96ccbfb3
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
JP Abgrall [Thu, 20 Sep 2012 23:34:10 +0000 (16:34 -0700)]
net: PPPoPNS and PPPoLAC update to use PPP_MRU instead of PPP_MRU
Some headers files were moved around and some defines renamed.
Signed-off-by: JP Abgrall <jpa@google.com>
Chia-chi Yeh [Fri, 15 Apr 2011 22:22:09 +0000 (15:22 -0700)]
net: Reorder incoming packets in PPPoLAC and PPPoPNS.
PPP handles packet loss but does not work with out of order packets.
This change performs reordering of incoming data packets within a
sliding window of one second. Since sequence number is optional,
receiving a packet without it will drop all queued packets.
Currently the logic is triggered by incoming packets, so queued
packets have to wait till another packet is arrived. It is done for
simplicity since no additional locks or threads are required. For
reliable protocols, a retransmission will kick it. For unreliable
protocols, queued packets just seem like packet loss. Time-critical
protocols might be broken, but they never work with queueing anyway.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
Chia-chi Yeh [Fri, 12 Jun 2009 18:29:04 +0000 (02:29 +0800)]
net: PPPoPNS and PPPoLAC fixes.
net: Fix a bitmask in PPPoPNS and rename constants in PPPoPNS and PPPoLAC.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Fix a potential deadlock while releasing PPPoLAC/PPPoPNS socket.
PPP driver guarantees that no thread will be executing start_xmit() after
returning from ppp_unregister_channel(). To achieve this, a spinlock (downl)
is used. In pppolac_release(), ppp_unregister_channel() is called after sk_udp
is locked. At the same time, another thread might be running in pppolac_xmit()
with downl. Thus a deadlock will occur if the thread tries to lock sk_udp.
The same situation might happen on sk_raw in pppopns_release().
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Force PPPoLAC and PPPoPNS to bind an interface before creating PPP channel.
It is common to manipulate the routing table after configuring PPP device.
Since both PPPoLAC and PPPoPNS run over IP, care must be taken to make sure
that there is no loop in the routing table.
Although this can be done by adding a host route, it might still cause
problems when the interface is down for some reason.
To solve this, this patch forces both drivers to bind an interface before
creating PPP channel, so the system will not re-route the tunneling sockets
to another interface when the original one is down. Another benefit is that
now the host route is no longer required, so there is no need to remove it
when PPP channel is closed.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Avoid sleep-inside-spinlock in PPPoLAC and PPPoPNS.
Since recv() and xmit() are called with a spinlock held, routines which might
sleep cannot be used. This issue is solved by following changes:
Incoming packets are now processed in backlog handler, recv_core(), instead of
recv(). Since backlog handler is always executed with socket spinlock held, the
requirement of ppp_input() is still satisfied.
Outgoing packets are now processed in workqueue handler, xmit_core(), instead of
xmit(). Note that kernel_sendmsg() is no longer used to prevent touching dead
sockets.
In release(), lock_sock() and pppox_unbind_sock() ensure that no thread is in
recv_core() or xmit(). Then socket handlers are restored before release_sock(),
so no packets will leak in backlog queue.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
net: Fix msg_iovlen in PPPoLAC and PPPoPNS.
Although any positive value should work (which is always true in both drivers),
the correct value should be 1.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
Chia-chi Yeh [Thu, 11 Jun 2009 17:09:30 +0000 (01:09 +0800)]
net: add PPP on PPTP Network Server (PPPoPNS) driver.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
ppopns: dont include px_proto define in if_pppopns.h
Change-Id: I27e687667db5b45182562f4a517a2e6cec6b1350
Signed-off-by: Dima Zavin <dima@android.com>
Chia-chi Yeh [Thu, 7 May 2009 20:02:40 +0000 (04:02 +0800)]
net: add PPP on L2TP Access Concentrator (PPPoLAC) driver.
Change-Id: I3ae3ee7520951ae24269db0ef2898c6455cf6bcc
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
ppolac: dont include px_proto define in if_pppolac.h
Change-Id: I55bc9cf91ea0e9e8f7bf5d6e241d188e1269343a
Signed-off-by: Dima Zavin <dima@android.com>
Mike Chan [Wed, 7 Jan 2009 19:40:42 +0000 (11:40 -0800)]
misc: uidstat: Adding uid stat driver to collect network statistics.
Signed-off-by: Mike Chan <mike@android.com>
Dmitry Torokhov [Thu, 3 Sep 2015 20:08:37 +0000 (13:08 -0700)]
net: fix crash in tcp_nuke_addr()
When iterating through sockets we need to skip sockets in TIME_WAIT
state as they use lightweight structure inet_timewait_sock that does not
have sk_lock member, and if we try to lock them we'll crash thusly:
[ 89.376383] BUG: spinlock lockup suspected on CPU#0, netd/431
[ 89.382139] lock: 0xffffffc039d05070, .magic:
66d30606, .owner: /-
1682098992, .owner_cpu: 0
[ 89.390598] CPU: 0 PID: 431 Comm: netd Tainted: G U W 3.18.0 #5
[ 89.397389] Hardware name: Google Tegra210 Smaug Rev 1+ (DT)
[ 89.403049] Call trace:
[ 89.405501] [<
ffffffc0002072b4>] dump_backtrace+0x0/0x10c
[ 89.410918] [<
ffffffc0002073d0>] show_stack+0x10/0x1c
[ 89.415971] [<
ffffffc000a88608>] dump_stack+0x74/0x94
[ 89.421018] [<
ffffffc000257e8c>] spin_dump+0x78/0x88
[ 89.425984] [<
ffffffc0002580d8>] do_raw_spin_lock+0xfc/0x158
[ 89.431666] [<
ffffffc000a90090>] _raw_spin_lock+0x34/0x44
[ 89.437059] [<
ffffffc0009509a8>] tcp_nuke_addr+0x1fc/0x29c
[ 89.442548] [<
ffffffc0009735f4>] devinet_ioctl+0x288/0x680
[ 89.448053] [<
ffffffc000975004>] inet_ioctl+0xc4/0xf4
[ 89.453103] [<
ffffffc0008baedc>] sock_do_ioctl+0x2c/0x5c
[ 89.458408] [<
ffffffc0008bbb54>] sock_ioctl+0x210/0x230
[ 89.463633] [<
ffffffc000317088>] do_vfs_ioctl+0x4ac/0x590
[ 89.469049] [<
ffffffc0003171c8>] SyS_ioctl+0x5c/0x88
(or with NULL pointer dereference if lockdep is still working).
Change-Id: I07c70d9a60b125b1070ff05c4eec27daee1a3e90
Signed-off-by: Dmitry Torokhov <dtor@google.com>
Dmitry Torokhov [Fri, 10 Jul 2015 00:17:57 +0000 (17:17 -0700)]
net: fix iterating over hashtable in tcp_nuke_addr()
The actual size of the tcp hashinfo table is tcp_hashinfo.ehash_mask + 1
so we need to adjust the loop accordingly to get the sockets hashed into
the last bucket.
Change-Id: I796b3c7b4a1a7fa35fba9e5192a4a403eb6e17de
Signed-off-by: Dmitry Torokhov <dtor@google.com>
Robert Love [Mon, 12 May 2008 21:08:29 +0000 (17:08 -0400)]
net: socket ioctl to reset connections matching local address
Introduce a new socket ioctl, SIOCKILLADDR, that nukes all sockets
bound to the same local address. This is useful in situations with
dynamic IPs, to kill stuck connections.
Signed-off-by: Brian Swetland <swetland@google.com>
net: fix tcp_v4_nuke_addr
Signed-off-by: Dima Zavin <dima@android.com>
net: ipv4: Fix a spinlock recursion bug in tcp_v4_nuke.
We can't hold the lock while calling to tcp_done(), so we drop
it before calling. We then have to start at the top of the chain again.
Signed-off-by: Dima Zavin <dima@android.com>
net: ipv4: Fix race in tcp_v4_nuke_addr().
To fix a recursive deadlock in 2.6.29, we stopped holding the hash table lock
across tcp_done() calls. This fixed the deadlock, but introduced a race where
the socket could die or change state.
Fix: Before unlocking the hash table, we grab a reference to the socket. We
can then unlock the hash table without risk of the socket going away. We then
lock the socket, which is safe because it is pinned. We can then call
tcp_done() without recursive deadlock and without race. Upon return, we unlock
the socket and then unpin it, killing it.
Change-Id: Idcdae072b48238b01bdbc8823b60310f1976e045
Signed-off-by: Robert Love <rlove@google.com>
Acked-by: Dima Zavin <dima@android.com>
ipv4: disable bottom halves around call to tcp_done().
Signed-off-by: Robert Love <rlove@google.com>
Signed-off-by: Colin Cross <ccross@android.com>
ipv4: Move sk_error_report inside bh_lock_sock in tcp_v4_nuke_addr
When sk_error_report is called, it wakes up the user-space thread, which then
calls tcp_close. When the tcp_close is interrupted by the tcp_v4_nuke_addr
ioctl thread running tcp_done, it leaks 392 bytes and triggers a WARN_ON.
This patch moves the call to sk_error_report inside the bh_lock_sock, which
matches the locking used in tcp_v4_err.
Signed-off-by: Colin Cross <ccross@android.com>
Robert Love [Thu, 31 Jul 2008 15:12:44 +0000 (11:12 -0400)]
sysfs_net_ipv4: Add sysfs-based knobs for controlling TCP window size
Add a family of knobs to /sys/kernel/ipv4 for controlling the TCP window size:
tcp_wmem_min
tcp_wmem_def
tcp_wmem_max
tcp_rmem_min
tcp_rmem_def
tcp_rmem_max
This six values mirror the sysctl knobs in /proc/sys/net/ipv4/tcp_wmem and
/proc/sys/net/ipv4/tcp_rmem.
Sysfs, unlike sysctl, allows us to set and manage the files' permissions and
owners.
Signed-off-by: Robert Love <rlove@google.com>
Chia-chi Yeh [Fri, 15 Jul 2011 22:32:57 +0000 (15:32 -0700)]
net: Only NET_ADMIN is allowed to fully control TUN interfaces.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
Chia-chi Yeh [Tue, 30 Jun 2009 03:23:04 +0000 (11:23 +0800)]
net: Replace AID_NET_RAW checks with capable(CAP_NET_RAW).
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
Chia-chi Yeh [Thu, 18 Jun 2009 23:15:05 +0000 (07:15 +0800)]
security: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable().
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
Robert Love [Wed, 15 Oct 2008 19:35:44 +0000 (15:35 -0400)]
Paranoid network.
With CONFIG_ANDROID_PARANOID_NETWORK, require specific uids/gids to instantiate
network sockets.
Signed-off-by: Robert Love <rlove@google.com>
paranoid networking: Use in_egroup_p() to check group membership
The previous group_search() caused trouble for partners with module builds.
in_egroup_p() is also cleaner.
Signed-off-by: Nick Pelly <npelly@google.com>
Fix 2.6.29 build.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
net: Fix compilation of the IPv6 module
Fix compilation of the IPv6 module -- current->euid does not exist anymore,
current_euid() is what needs to be used.
Signed-off-by: Steinar H. Gunderson <sesse@google.com>
net: bluetooth: Remove the AID_NET_BT* gid numbers
Removed bluetooth checks for AID_NET_BT and AID_NET_BT_ADMIN
which are not useful anymore.
This is in preparation for getting rid of all the AID_* gids.
Signed-off-by: JP Abgrall <jpa@google.com>
Robert Love [Wed, 15 Oct 2008 19:34:49 +0000 (15:34 -0400)]
Add android_aid.h
Add <linux/android_aid.h>, our mapping of AID defines to gid numbers.
Change-Id: I3a02eb2b5c7e336e3de0cb45d8e04ec82f7281b4
Signed-off-by: Robert Love <rlove@google.com>
San Mehat [Sat, 10 Oct 2009 16:35:24 +0000 (09:35 -0700)]
block: genhd: Add disk/partition specific uevent callbacks for partition info
For disk devices, a new uevent parameter 'NPARTS' specifies the number
of partitions detected by the kernel. Partition devices get 'PARTN' which
specifies the partitions index in the table, and 'PARTNAME', which
specifies PARTNAME specifices the partition name of a partition device
Signed-off-by: Dima Zavin <dima@android.com>
San Mehat [Sun, 22 Mar 2009 01:48:54 +0000 (18:48 -0700)]
fs: block_dump: Don't display inode changes if block_dump < 2
Signed-off-by: San Mehat <san@android.com>
Ulf Hansson [Thu, 11 Feb 2016 15:54:11 +0000 (16:54 +0100)]
Revert "mmc: block: don't use parameter prefix if built as module"
This reverts commit
829b6962f7e3cfc06f7c5c26269fd47ad48cf503.
Revert this change as it causes a sysfs path to change and therefore
introduces and ABI regression. More precisely Android's vold is not being
able to access /sys/module/mmcblk/parameters/perdev_minors any more, since
the path becomes changed to: "/sys/module/mmc_block/..."
Fixes: 829b6962f7e3 ("mmc: block: don't use parameter prefix if built as
module")
Reported-by: John Stultz <john.stultz@linaro.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Mon, 18 Mar 2013 18:57:28 +0000 (11:57 -0700)]
mmc: core: Remove stray CONFIG_EXPERIMENTAL dependencies
CONFIG_EXPERIMENTAL has been removed from the kernel, so clean
up its use in MMC_EMBEDDED_SDIO and MMC_PARANOID_SD_INIT options.
Change-Id: If414c265134b36740a84564274a631803c8e81b4
Cc: Arve Hjønnevåg <arve@android.com>
Cc: San Mehat <san@google.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Ken Sumrall [Wed, 26 Oct 2011 01:16:58 +0000 (18:16 -0700)]
mmc: block: Improve logging of handling emmc timeouts
Add some logging to make it clear just how the emmc timeout
was handled.
Change-Id: Id33fd28d8b9778dc4e85db829e2637a328eddab4
Signed-off-by: Ken Sumrall <ksumrall@android.com>
Dmitry Shmidt [Tue, 3 May 2011 18:05:04 +0000 (11:05 -0700)]
ARM: Add 'card_present' state to mmc_platfrom_data
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>