From b56f69c6007c6d2a6fa7aad45b1258dd2dc70b34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= <maze@google.com>
Date: Fri, 16 Sep 2022 05:07:13 +0000
Subject: [PATCH] ClatIngress6Key.java - replace U32 ifindex with S32
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These are allocated in order by the kernel, if we go
over 2 billion, we've got other problems... besides
U32 to S32 conversion will work just fine anyway.

Surprisingly it appears no further fixups are required
to make this compile, due to other places already being 'int's.

Bug: 245472520
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9008e20f40c983a1bb8a0547a61190f28042b22a
---
 .../com/android/net/module/util/bpf/ClatIngress6Key.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/src/com/android/net/module/util/bpf/ClatIngress6Key.java b/common/src/com/android/net/module/util/bpf/ClatIngress6Key.java
index 1e2f4e06d6..561113c92c 100644
--- a/common/src/com/android/net/module/util/bpf/ClatIngress6Key.java
+++ b/common/src/com/android/net/module/util/bpf/ClatIngress6Key.java
@@ -24,8 +24,8 @@ import java.net.Inet6Address;
 
 /** Key type for clat ingress IPv6 maps. */
 public class ClatIngress6Key extends Struct {
-    @Field(order = 0, type = Type.U32)
-    public final long iif; // The input interface index
+    @Field(order = 0, type = Type.S32)
+    public final int iif; // The input interface index
 
     @Field(order = 1, type = Type.Ipv6Address)
     public final Inet6Address pfx96; // The source /96 nat64 prefix, bottom 32 bits must be 0
@@ -33,7 +33,7 @@ public class ClatIngress6Key extends Struct {
     @Field(order = 2, type = Type.Ipv6Address)
     public final Inet6Address local6; // The full 128-bits of the destination IPv6 address
 
-    public ClatIngress6Key(final long iif, final Inet6Address pfx96, final Inet6Address local6) {
+    public ClatIngress6Key(final int iif, final Inet6Address pfx96, final Inet6Address local6) {
         this.iif = iif;
         this.pfx96 = pfx96;
         this.local6 = local6;
-- 
GitLab