clatd: fix endianness of multicast drop am: 30020a513a

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3555171

Change-Id: Ic1b1f0ffcf531deb67ff8506da0a76e7a1a36a12
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Maciej Żenczykowski 2025-03-21 14:40:56 -07:00 • committed by Automerger Merge Worker
commit cf7ca1d38e
2 changed files with 3 additions and 3 deletions

View file

@ -289,7 +289,7 @@ DEFINE_BPF_PROG("schedcls/egress4/clat_rawip", AID_ROOT, AID_SYSTEM, sched_cls_e
if (ip4->ihl != 5) return TC_ACT_PIPE;
// Packet must not be multicast
if ((ip4->daddr & 0xf0000000) == 0xe0000000) return TC_ACT_PIPE;
if ((ip4->daddr & htonl(0xf0000000)) == htonl(0xe0000000)) return TC_ACT_PIPE;
// Calculate the IPv4 one's complement checksum of the IPv4 header.
__wsum sum4 = 0;

View file

@ -85,8 +85,8 @@ int ipv4_packet(clat_packet out, clat_packet_index pos, const uint8_t *packet, s
return 0;
}
if ((header->daddr & 0xf0000000) == 0xe0000000) {
logmsg_dbg(ANDROID_LOG_INFO, "ip_packet/daddr is multicast: %x", header->daddr);
if ((header->daddr & htonl(0xf0000000)) == htonl(0xe0000000)) {
logmsg_dbg(ANDROID_LOG_INFO, "ip_packet/daddr is multicast: %x", ntohl(header->daddr));
return 0;
}