From def4359b85964a3806ce616689acb3fe580e83dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= <maze@google.com>
Date: Fri, 16 Sep 2022 06:57:23 +0000
Subject: [PATCH] ClatEgress4Value.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.

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

diff --git a/common/src/com/android/net/module/util/bpf/ClatEgress4Value.java b/common/src/com/android/net/module/util/bpf/ClatEgress4Value.java
index c10cb4da32..69fab091e9 100644
--- a/common/src/com/android/net/module/util/bpf/ClatEgress4Value.java
+++ b/common/src/com/android/net/module/util/bpf/ClatEgress4Value.java
@@ -24,8 +24,8 @@ import java.net.Inet6Address;
 
 /** Value type for clat egress IPv4 maps. */
 public class ClatEgress4Value extends Struct {
-    @Field(order = 0, type = Type.U32)
-    public final long oif; // The output interface to redirect to
+    @Field(order = 0, type = Type.S32)
+    public final int oif; // The output interface to redirect to
 
     @Field(order = 1, type = Type.Ipv6Address)
     public final Inet6Address local6; // The full 128-bits of the source IPv6 address
@@ -36,7 +36,7 @@ public class ClatEgress4Value extends Struct {
     @Field(order = 3, type = Type.U8, padding = 3)
     public final short oifIsEthernet; // Whether the output interface requires ethernet header
 
-    public ClatEgress4Value(final long oif, final Inet6Address local6, final Inet6Address pfx96,
+    public ClatEgress4Value(final int oif, final Inet6Address local6, final Inet6Address pfx96,
             final short oifIsEthernet) {
         this.oif = oif;
         this.local6 = local6;
-- 
GitLab