Commit graph

17 commits

Author SHA1 Message Date
Maciej Żenczykowski
39c26d63cd libnetutils/packet.c - create socket with close-on-exec
This prevents fork/exec leaking sockets to child processes.

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I57cb2003dd75b0bc5528978fd131730273e37a43
2020-05-08 22:34:37 -07:00
Maciej Żenczykowski
0129aaae86 libnetutils/packet.c - fix a raw socket reception race
A socket created bound to a specific protocol can receive packets before
it's bound to a specific interface/mac.

It's best to rely on the bind().

This replicates the way packet sockets are created in external/android-clat.
See: ring.c ring_create() and clatd.c configure_packet_socket()

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I569d2b81a396f352ab5d1b71bd5ad0d96217aab1
2020-05-08 22:34:37 -07:00
Maciej Żenczykowski
b7f370c014 libnetutils/packet.c - fix a socket leak on bind error
and clean up the code a little bit while at it.

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I01a10e36f852cde1b93a91f95b51294a434885ab
2020-05-08 22:34:37 -07:00
tintin
cdf0fc6018 libnetutil: Check dhcp respose packet length am: 61f25d4a36 am: cee6d38c55 am: 29d054046f am: c29049f4f8 am: 3de04e9840 am: 19702dc499 am: 8191e9ba87 am: 804323c195 am: 4f5f00d879 am: 3a1ff1ad71
am: bab7b1ecd9

Change-Id: Id56f81b841d83b4b6fc75517fa165c0000dac663
2017-11-02 03:23:59 +00:00
tintin
29d054046f libnetutil: Check dhcp respose packet length am: 61f25d4a36
am: cee6d38c55

Change-Id: Ieac19dd67cee1f22e019ac87b33b8afcd1200dcb
2017-11-02 03:03:42 +00:00
tintin
61f25d4a36 libnetutil: Check dhcp respose packet length
Bug: 67474440
Test: Manual

Change-Id: I84b533f0101a56ec01e64c7591f3c7e82f513b2e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-10-17 17:48:48 +00:00
Mark Salyzyn
30f991f251 liblog: use log/log.h when utilizing ALOG macros
Test: compile
Bug: 30465923
Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
2017-01-11 09:31:15 -08:00
Mark Salyzyn
66ce3e08c5 system/core Replace cutils/log.h with android/log.h
Should use android/log.h instead of cutils/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
2016-09-30 12:47:05 -07:00
Elliott Hughes
a744b05984 Add missing <malloc.h> and <string.h> includes.
Change-Id: Ia41756e607663d056e7d2fdd7ecbec7e5841a913
2015-01-28 11:37:57 -08:00
Andreas Gampe
a5d5d84773 Libnetutils: Remove unused functions & variables
For build-system CFLAGS clean-up, remove unused functions and
variables.

Change-Id: I40a78d5a532dc32b53beb1cfc1b7645bab8add16
2014-11-24 10:43:53 -08:00
Ajay Dudani
1c87ae05b3 libnetutils: Expect 1's complement if computed UDP checksum is zero
Per http://tools.ietf.org/html/rfc768:
If the computed  checksum  is zero,  it is transmitted  as all ones (the
equivalent  in one's complement  arithmetic).   An all zero  transmitted
checksum  value means that the transmitter  generated  no checksum  (for
debugging or for higher level protocols that don't care).

Bug: 10642341
Change-Id: Ib6296dcf3f420f87227047a645c99d9f7ea0d437
2013-12-12 11:24:26 -08:00
Edwin Vane
a5db95da38 Fixed an unused param warning
libnetutils had a single warning. Fixed it to make it clean.

Change-Id: I9297e556657a38dbdd7d1d0ac4bc3574801d5ac9
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Kevin P Schoedel <kevin.p.schoedel@intel.com>
2012-08-02 10:40:12 -04:00
Steve Block
ae8b56c0d1 Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
Bug: 5449033
Change-Id: I1e070511b6a538e9f1c94657356437a457d58882
2012-01-05 22:25:38 +00:00
Steve Block
8d66c49258 Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
Bug: 5449033
Change-Id: I9244d927f14c750cd359ebffb1fc1c355a755d5a
2012-01-03 22:32:30 +00:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
The Android Open Source Project
e54eebbf1a auto import from //depot/cupcake/@135843 2009-03-03 18:29:04 -08:00
The Android Open Source Project
4f6e8d7a00 Initial Contribution 2008-10-21 07:00:00 -07:00