clat: just always set mark unconditionally, part 2
Setting SO_MARK to MARK_UNSET, ie. 0, is harmless, since the default for a brand new socket is already 0. See ClatCoordinator.java getFwMark() for the mark we actually pass in, which is guaranteed to have at least 4 bits (16,17,18,19) set. See also: https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/2392272 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I3b4eebc0a5ad20390a13efcc58cecf94868686ba
This commit is contained in:
parent
b5cfb6426c
commit
8bf5967d1e
1 changed files with 2 additions and 5 deletions
|
|
@ -29,9 +29,6 @@ extern "C" {
|
|||
#include "checksum.h"
|
||||
}
|
||||
|
||||
// Sync from system/netd/include/netid_client.h.
|
||||
#define MARK_UNSET 0u
|
||||
|
||||
namespace android {
|
||||
namespace net {
|
||||
namespace clat {
|
||||
|
|
@ -128,7 +125,7 @@ int generateIpv6Address(const char* iface, const in_addr v4, const in6_addr& nat
|
|||
|
||||
// Socket's mark affects routing decisions (network selection)
|
||||
// An fwmark is necessary for clat to bypass the VPN during initialization.
|
||||
if ((mark != MARK_UNSET) && setsockopt(s, SOL_SOCKET, SO_MARK, &mark, sizeof(mark))) {
|
||||
if (setsockopt(s, SOL_SOCKET, SO_MARK, &mark, sizeof(mark))) {
|
||||
int ret = errno;
|
||||
ALOGE("setsockopt(SOL_SOCKET, SO_MARK) failed: %s", strerror(errno));
|
||||
close(s);
|
||||
|
|
@ -176,7 +173,7 @@ int detect_mtu(const struct in6_addr* plat_subnet, uint32_t plat_suffix, uint32_
|
|||
}
|
||||
|
||||
// Socket's mark affects routing decisions (network selection)
|
||||
if ((mark != MARK_UNSET) && setsockopt(s, SOL_SOCKET, SO_MARK, &mark, sizeof(mark))) {
|
||||
if (setsockopt(s, SOL_SOCKET, SO_MARK, &mark, sizeof(mark))) {
|
||||
int ret = errno;
|
||||
ALOGE("setsockopt(SOL_SOCKET, SO_MARK) failed: %s", strerror(errno));
|
||||
close(s);
|
||||
|
|
|
|||
Loading…
Reference in a new issue