Commit graph

47 commits

Author SHA1 Message Date
Maciej Żenczykowski
25ec9c4db1 add 'nodad' support to ifc_add_address()
Test: TreeHugger
Bug: 242067762
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2c022f6af45eac7631213801a89aa270709d4a57
2023-06-30 16:36:21 +00:00
Maciej Żenczykowski
9943ed2597 add nodad argument to ifc_act_on_address() and add it to header file
Test: atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia45f00ecc5eae035ed2e25d5b73008acb77fa6c2
2020-01-26 06:35:30 -08:00
Lorenzo Colitti
a9027581bd Properly size response buffer in ifc_act_on_address
Currently, any netlink error reported in ifc_act_on_address is
reported as EINVAL, because the receive buffer is too short and
the NLMSG_OK check fails on it.

Make the buffer long enough so the function can return the
correct netlink error to the caller.

Test: new test coverage in other CL in this topic
Change-Id: Ica752db834a0fd614312b800d88721826be08d56
2019-12-02 17:37:39 +09:00
Lorenzo Colitti
c3d38969ca Return a valid error code when adding an invalid IP address.
Currently, passing an invalid IP address to interfaceAddAddress
and friends results in an invalid error message:

    12-02 13:00:42.675 interfaceAddAddress("testtap2355", "2001:db8::1/64", 64) -> ServiceSpecificException(-8, "InterfaceController error: Unknown error -8") <1.63ms>

This is due to confusion between getaddrinfo error codes and
errno values.

Test: new unit test added to IpClientIntegrationTest
Change-Id: Ifdaa4281a9bcf3998e3216472c5c1df0f5285214
2019-12-02 13:42:20 +09:00
Maciej Żenczykowski
f0d101266f better document ifc_{add,del}_address return code
Test: N/A
Bug: 142764715
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8ffa7985aa2ec81959d57188755e453f0551b872
2019-10-17 17:20:25 -07: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
Erik Kline
91bc2c9084 Merge "Set IFA_BROADCAST during IPv4 RTM_NEWADDRs" am: d709914
am: 012d35b

* commit '012d35b7f046f42d97dadd831c8201ecda2daa55':
  Set IFA_BROADCAST during IPv4 RTM_NEWADDRs

Change-Id: Ib4ac0486a06551dce8d79fb1e738e9c567328610
2016-03-31 07:10:47 +00:00
Erik Kline
06cb8e9203 Set IFA_BROADCAST during IPv4 RTM_NEWADDRs
Bug: 27194345
Bug: 27732412
Bug: 27786864
Change-Id: I5a5b41422bbaab4582c268c213b788f61cb0e169
2016-03-30 20:06:36 +09:00
Elliott Hughes
34965eb118 Merge "libnetutils: Check socket() return value" am: e4b332c7e4
am: be6d330c18

* commit 'be6d330c18f861fe10c0b238f74cecb2c9783205':
  libnetutils: Check socket() return value
2016-01-12 04:53:01 +00:00
Bjorn Andersson
292997420c libnetutils: Check socket() return value
Add a check for socket() errors and make sure to preserve errno over the
subsequent close() calls.

Change-Id: If52d76cd3cb45044eaaf7fea9bfd4471dc66a078
2015-12-29 11:17:05 -08:00
Dmitry Shmidt
cebcd450c6 libnetutils: Add synchronization per socket full operation
Take and release mutex between ifc_init() and ifc_close()
calls to prevent global ifc_ctl_sock override.

Bug: 22307208

Change-Id: Iacffd329ce2a51defa550c7e33277332045a7b9b
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2015-10-01 14:30:20 -07:00
Elliott Hughes
9b828adfad Use __ANDROID__ instead of HAVE_ANDROID_OS.
Change-Id: I9967f3fd758c2a5b40be5b60ae72be7e2fb75136
2015-07-30 09:33:43 -07:00
Nick Kralevich
6d3cddb2e2 More SOCK_CLOEXEC
Change-Id: I3e18f34d08a6443aaf55d7c91c27867840ac1773
2015-02-26 13:32:52 -08:00
Elliott Hughes
c463025a19 Revert "Remove netcfg's unused options."
This reverts commit f8e83054cb.

Change-Id: Iede772f96ff9008277df433dcbb5f6603de65283
2015-02-03 19:56:35 +00:00
Elliott Hughes
f8e83054cb Remove netcfg's unused options.
Only "netcfg" for a list of interfaces and "netcfg <interface> dhcp" still
seem to be used.

Change-Id: Iaf499c06b09ffe5e0925339b9cd6e502f3234a86
2015-02-03 11:08:07 -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
Sreeram Ramachandran
17622d09d5 Support resetting connections tied to any nonexistent address.
Bug: 15414453
Change-Id: Ibf1f052e12b88838a328148e25817a96f10d50f5
2014-09-08 23:35:52 -07:00
Sreeram Ramachandran
e5ab3e3a4c Add a comment to not delete seemingly unused code.
Change-Id: I5b9d23eea7e850ab5a1f3a4e6c4f8ecdc3844864
2014-07-23 11:33:36 -07:00
Sreeram Ramachandran
eec232603d Put back some deleted code.
http://ag/507249 removed a bunch of supposedly dead (unused) code. It turns out
at least ifc_disable() is being used in some protected partner branches. Put
back that as well as ifc_enable() to keep it symmetric.

Bug: 15413389
Change-Id: Ibec83a66e5d9079876ccf36d250b95b7c0294c03
2014-07-23 09:30:53 -07:00
Sreeram Ramachandran
a723689eca Cleanup: Delete dead code.
Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
2014-07-22 15:00:21 -07:00
Elliott Hughes
2d640c2640 Fix libnetutils to build with clean uapi headers.
(And old ones too.)

Bug: 11559337
Change-Id: Ie61218055bbe07655a9d53c539aa47b85098e42c
2013-11-12 13:05:01 -08:00
Chris Dearman
6ee3ecc03a Decode DHCP netmask option correctly
Signed-off-by: Chris Dearman <chris@mips.com>
Change-Id: Ibc288458baf2f75c5b19a46e4c97ee59521cc9a5
2012-08-08 15:50:03 -07:00
Alex Yakavenka
7c3d1c291a Export flags needed for ifc_reset_connections API in netutils
Code using ifc_reset_connections api needs to have access to
predefined masks for reset_mask parameter

Change-Id: I90bc5e1b62ae4a88501c8ad4e353c0d93d319579
2012-06-21 16:56:01 -07:00
Steve Block
01dda204cd Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
Bug: 5449033
Change-Id: Ibcffdcf620ebae1c389446ce8e9d908f11ac039c
2012-01-08 11:03:26 +00: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
Lorenzo Colitti
47ddb515b7 Support adding, deleting, and clearing IPv6 addrs.
- Provide a function to add and delete IPv4/IPv6 addresses
  using netlink.
- Provide a function that clears all IP addresses on an
  interface that can be used by netd.

Also, a couple of cleanups:

- Update the header file to match reality, and include the
  header file in the implementation. Also fix a caller that
  has an incorrect method signature.
- Fix whitespace in Android.mk.

Change-Id: Ifba9d60cdfffb0b7e5c3b9c6ab328f5f77d259c4
2011-09-28 17:12:13 -07:00
Wink Saville
0c613613d7 Reduce connectivity logging.
Change-Id: Ib71f3f17d56ba614436bcb18f9100196fd7e7ee6
2011-09-20 15:53:23 -07:00
Wink Saville
7da24861ea am 436deea5: am 979203ee: Add reset_mask as parameter to ifc_reset_connections
* commit '436deea5bbd43ae402ca8ee5bbc7fed3daaf3fce':
  Add reset_mask as parameter to ifc_reset_connections
2011-07-08 12:28:18 -07:00
Wink Saville
979203ee34 Add reset_mask as parameter to ifc_reset_connections
The reset_mask allows either IPv4 and or IPv6 connections
of an interface to be reset.

Bug: 4981919
Change-Id: Id2d9ab90e30091d3d0764c66d4b01b73c0edbfcc
2011-07-07 12:16:12 -07:00
Robert Greenwalt
b6b48ae47a Revert some of change 109925 to fix connectivity
bug:4476009
Change-Id: I93c492eebe24d9744b8ef79378c73301d167f5a3
2011-05-25 21:22:56 -07:00
Robert Greenwalt
ab86504f58 am 61e33b33: am aded02cb: Merge "Add v4/v6 route add/removal support" into honeycomb-LTE
* commit '61e33b338cbb90c34cb3e07fe55edcc08c6ce3b8':
  Add v4/v6 route add/removal support
2011-05-19 07:21:22 -07:00
Robert Greenwalt
021d0a2e7c Add v4/v6 route add/removal support
Change-Id: I259a3be4fe473dff75336139c9584d2c5ab27b2d
2011-05-15 10:48:08 -07:00
Jake Hamby
6f49d5f266 Add missing function required to load Crespo RIL library.
ifc_set_mask() function was removed in a previous change. This function
is called by the Crespo RIL, so we can't remove it yet.

Bug: 4268537
Change-Id: I634580ee8d2a1aff069178837cc121c89c5e73f9
2011-04-11 19:46:41 -07:00
Lorenzo Colitti
6cf73eadc7 Kill IPv6 sockets as well as IPv4 sockets.
Change-Id: Ib9e070e510d1a762295faf4dc673c9a6e8207a8d
2011-03-17 11:20:25 -07:00
Robert Greenwalt
09dd819d27 Stop using netmask in the framework
This pushes prefixLength down as far as we can.

bug:2542681
Change-Id: I94b7cde9d10e97ee2c071d92f25555cff5934f0b
2011-02-02 14:18:44 -08:00
Dmitry Shmidt
9092b91cca libnetutils: Clean all IPs assigned to the interface on cleaning
Change-Id: Ic285bbb4b224fc4e62e88e76b8b448edbe814a17
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-01-27 14:16:20 -08:00
Dmitry Shmidt
7d05a80da8 libnetutils: Fix warning
Change-Id: I2a914314a027e0e542d45dff0c2e6029e9f40615
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-01-24 17:10:30 -08:00
Stan Chesnutt
36f93f0120 fix undefined behavior with certain left-shift count values
Change-Id: I1b71de28312a56a3b1d27fcfaf0a7b71d5777e6c
2010-12-16 10:59:48 -08:00
Robert Greenwalt
705ab8db82 Fix sim build - remove unncesessary header.
Change-Id: Ibeba75848eaf732b7d0c7aecc9e7be8dbd509a1c
2010-08-25 11:21:36 -07:00
Banavathu, Srinivas Naik
8984bb9691 Add API to add a route to IPv4/IPv6 host/gateway.
Add API to create a route to an IPv4/IPv6 host/gateway through a particular
interface.

Change-Id: I0ab5d2d211e0fc05f65ee6bb202b7f435cccae2a
2010-08-17 21:50:41 -07:00
Szymon Jakubczak
c88e09cb98 - creates proper ifc.h and dhcp.h headers for libnetutils
- adds ifc_set_hwaddr
- adds hwaddr command to netcfg
- code reuse: dhcp_configure calls ifc_configure; inet_ntoa is used for printing
- consistency: use net.XXX.dnsX properties in favor of dhcp.XXX.dnsX properties
  (see related change to WifiStateTracker)
- updated system/core/nexus to use new headers, although not sure if
anybody still uses nexus

Change-Id: Idd70c0ac6e89b38e86816578c33eff805d30cac4
2010-06-09 16:11:09 -04:00
Mike Lockwood
feb63e9e6f libnetutils: Add ifc_enable(), for enabling a network interface.
Signed-off-by: Mike Lockwood <lockwood@android.com>
2009-07-10 17:29:47 -04: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