summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSreeram Ramachandran <sreeram@google.com>2014-05-12 11:20:12 -0700
committerSreeram Ramachandran <sreeram@google.com>2014-05-14 11:13:53 -0700
commit154ebe80a01d85dff9340b0afaee102bfe31217f (patch)
tree3758d683a7847f52929bd301865f02a2631bd802 /include
parente38d4707141174a8c211d5cb01ff78da8ef1baff (diff)
downloadsystem_core-154ebe80a01d85dff9340b0afaee102bfe31217f.tar.gz
system_core-154ebe80a01d85dff9340b0afaee102bfe31217f.tar.bz2
system_core-154ebe80a01d85dff9340b0afaee102bfe31217f.zip
Introduce netd_client, a dynamic library that talks to netd.
This library is dynamically loaded and used by bionic, to replace selected standard socket syscalls with versions that talk to netd. Implement connect() by requesting that the socket be marked with the netId of the default network and then calling through to the actual syscall. There are two escape hatches: + If the fwmark server is unavailable, it isn't an error; we proceed with the syscall. This might help at boot time (when the server isn't ready yet) and if we get rid of the fwmarkd socket entirely in future platform versions. + If the ANDROID_NO_USE_FWMARK_CLIENT environment variable is set, we don't attempt to use the fwmark server (even if it's available). This allows apps to sidestep unforseen issues in production at runtime. (cherry picked from commit 0581cb455ef924f128a5c6d46bc70868b5099eec) Change-Id: Ib6198e19dbc306521a26fcecfdf6e8424d163fc9
Diffstat (limited to 'include')
-rw-r--r--include/netd_client/FwmarkCommands.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/netd_client/FwmarkCommands.h b/include/netd_client/FwmarkCommands.h
new file mode 100644
index 000000000..0d22f02e0
--- /dev/null
+++ b/include/netd_client/FwmarkCommands.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NETD_CLIENT_FWMARK_COMMANDS_H
+#define NETD_CLIENT_FWMARK_COMMANDS_H
+
+#include <stdint.h>
+
+// Commands sent from clients to the fwmark server to mark sockets (i.e., set their SO_MARK).
+const uint8_t FWMARK_COMMAND_ON_CREATE = 0;
+const uint8_t FWMARK_COMMAND_ON_CONNECT = 1;
+const uint8_t FWMARK_COMMAND_ON_ACCEPT = 2;
+const uint8_t FWMARK_COMMAND_SELECT_NETWORK = 3;
+const uint8_t FWMARK_COMMAND_PROTECT_FROM_VPN = 4;
+
+#endif // NETD_CLIENT_FWMARK_COMMANDS_H