android hidl 符号,Android HIDL官方文档(八)—— Network Stack Configuration Tools

网络堆栈配置工具

Android 操作系统中包含标准的 Linux 网络实用程序,例如 ifconfig、ip 和 ip6tables。这些实用程序位于系统映像中,并支持对整个 Linux 网络堆栈进行配置。在运行 Android 7.x 及更低版本的设备上,供应商代码可以直接调用此类二进制文件,这会导致以下问题:

由于网络实用程序在系统映像中更新,因此无法提供稳定的实现。

网络实用程序的范围非常广泛,因此难以在保证行为可预测的情况下不断改进系统映像。

在运行 Android 8.0 的设备上,供应商分区可在系统分区接收更新时保持不变。为了实现这一点,Android 8.0 不仅提供定义稳定的带版本接口的功能,同时还使用了 SELinux 限制,以便在供应商映像与系统映像之间保持已知良好的相互依赖关系。

供应商可以使用平台提供的网络配置实用程序来配置 Linux 网络堆栈,但这些实用程序并未包含 HIDL 接口封装容器。为定义这类接口,Android 8.0 中纳入了 netutils-wrapper-1.0 工具。

Netutils 封装容器

netutils 封装容器实用程序提供了一部分未受系统分区更新影响的 Linux 网络堆栈配置。Android 8.0 中包含版本 1.0 的封装容器,借助它,您可以传递与所封装的实用程序(安装在系统分区的 /system/bin 中)相同的参数,如下所示:

u:object_r:system_file:s0 /system/bin/ip-wrapper-1.0 -> netutils-wrapper-1.0

u:object_r:system_file:s0 /system/bin/ip6tables-wrapper-1.0 -> netutils-wrapper-1.0

u:object_r:system_file:s0 /system/bin/iptables-wrapper-1.0 -> netutils-wrapper-1.0

u:object_r:system_file:s0 /system/bin/ndc-wrapper-1.0 -> netutils-wrapper-1.0

u:object_r:netutils_wrapper_exec:s0 /system/bin/netutils-wrapper-1.0

u:object_r:system_file:s0 /system/bin/tc-wrapper-1.0 -> netutils-wrapper-1.0

符号链接显示由 netutils 封装容器封装的网络实用程序,其中包括:

ip

iptables

ip6tables

ndc

tc

要在 Android 8.0 及更高版本中使用这些实用程序,供应商实现必须遵循以下规则:

供应商进程不得直接执行 /system/bin/netutils-wrapper-1.0,否则会导致错误。

netutils-wrapper-1.0 封装的所有实用程序必须使用其符号链接启动。例如,将以前执行该操作的供应商代码 (/system/bin/ip) 更改为 /system/bin/ip-wrapper-1.0。

平台 SELinux 政策禁止执行不包含网域转换的封装容器。此规则不得更改,可在 Android 兼容性测试套件 (CTS) 中进行测试。

平台 SELinux 政策还禁止直接执行来自供应商进程的实用程序(例如,/system/bin/ip)。此规则不得更改,可在 CTS 中进行测试。

需要启动封装容器的所有供应商网域(进程)必须在 SELinux 政策中添加以下网域转换规则:domain_auto_trans(VENDOR-DOMAIN-NAME, netutils_wrapper_exec, netutils_wrapper)。

注意:要详细了解 Android 8.0 SELinux,请参阅 SELinux for Android 8.0。

Netutils 封装容器过滤器

封装的实用程序几乎可用于配置 Linux 网络堆栈的任何方面。不过,为了确保可以维护稳定的接口并允许对系统分区进行更新,只能执行某些命令行参数组合;其他命令将被拒绝。

供应商接口和链

封装容器有一个概念称为“供应商接口”。供应商接口通常是指由供应商代码管理的接口,例如移动数据网络接口。通常,其他类型的接口(如 WLAN)由 HAL 和框架管理。封装容器按名称(使用正则表达式)识别供应商接口,且允许供应商代码对其执行多种操作。目前,供应商接口包括以下接口:

名称以“oem”后跟数字结尾的接口,例如 oem0 或 r_oem1234。

当前 SOC 和 OEM 实现使用的接口,如 rmnet_data[0-9]。

通常由框架管理的接口的名称(例如 wlan0)一律不是供应商接口。

封装容器还有一个相似的概念称为“供应商链”。供应商链在 iptables 命令中使用,也按名称识别。目前,供应商链包括以下链:

以 oem_ 开头的链。

当前 SOC 和 OEM 实现使用的链,例如以 nm_ 或 qcom_ 开头的链。

允许执行的命令

下面列出了当前允许执行的命令。系统通过一组正则表达式对执行的命令行实施限制。有关详情,请参阅 system/netd/netutils_wrappers/NetUtilsWrapper-1.0.cpp。

ip

ip 命令用于配置 IP 地址、路由、IPsec 加密以及多种其他网络参数。封装容器允许执行以下命令:

从供应商管理的接口添加和移除 IP 地址。

配置 IPsec 加密。

iptables/ip6tables

iptables 和 ip6tables 命令用于配置防火墙、数据包处理、NAT 和其他按数据包处理。封装容器允许执行以下命令:

添加和删除供应商链。

在引用进入 (-i) 或离开 (-o) 供应商接口的数据包的任何链中添加和删除规则。

从任何其他链的任意一点跳转到供应商链。

ndc

ndc 用于与在 Android 设备上执行大部分网络配置的 netd 守护进程通信。封装容器允许执行以下命令:

创建和销毁 OEM 网络 (oemXX)。

向 OEM 网络添加供应商管理的接口。

向 OEM 网络添加路由。

在全局范围内和供应商接口上启用或停用 IP 转发。

tc

tc 命令用于配置供应商接口上的流量队列和调整。

转载自:https://source.android.com/devices/architecture/hidl/network-stack

### EB tresos CAN Protocol Stack Configuration and Documentation EB tresos is an automotive software platform designed to support various communication protocols, including the Controller Area Network (CAN). The configuration of the EB tresos CAN protocol stack involves several key components that ensure reliable message transmission over a vehicle's network. #### Key Features Supported by EB tresos CAN Protocol Stack The EB tresos CAN protocol stack supports multiple features essential for automotive applications: - **Message Filtering**: Ensures only relevant messages are processed based on predefined criteria. - **Error Handling Mechanisms**: Implements robust error detection and correction methods[^1]. - **Network Management Functions**: Provides tools for managing nodes within the CAN network effectively. #### Basic Steps for Configuring EB tresos CAN Protocol Stack To configure the EB tresos CAN protocol stack, one must follow these guidelines closely related to project requirements: - Define system parameters such as baud rate settings which determine how fast data can be transmitted between devices connected via CAN bus. - Set up hardware abstraction layers specific to microcontroller units used in target vehicles. - Customize application-specific configurations like setting up transmit buffers or configuring interrupt priorities according to performance needs. ```c // Example C code snippet showing part of the setup process void initCanBus(void){ Can_Init(&canConfig); // Initialize CAN module with given config structure } ``` For detailed instructions beyond this overview, refer directly to official documentation provided by Elektrobit AG concerning EB tresos products. This document will contain comprehensive guidance tailored specifically towards integrating their solution into different types of projects involving vehicular networks.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值