cleanup - remove tun.h
Longer term we should probably just merge the clat_config
and tun_data structs, but not just yet.
Test:
git grep '(^|[^_])tun[.]h'
comes up empty
Bug: 144730808
Test: atest clatd_test netd_integration_test
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7c3a986584aa3d02519545fb928457b61247ed14
diff --git a/clatd.c b/clatd.c
index edae761..d29b7ed 100644
--- a/clatd.c
+++ b/clatd.c
@@ -50,7 +50,6 @@
#include "ring.h"
#include "setif.h"
#include "translate.h"
-#include "tun.h"
/* 40 bytes IPv6 header - 20 bytes IPv4 header + 8 bytes fragment header */
#define MTU_DELTA 28
diff --git a/clatd_test.cpp b/clatd_test.cpp
index 514aaa8..c16a4dd 100644
--- a/clatd_test.cpp
+++ b/clatd_test.cpp
@@ -34,7 +34,6 @@
#include "getaddr.h"
#include "netutils/checksum.h"
#include "translate.h"
-#include "tun.h"
}
// For convenience.
diff --git a/config.h b/config.h
index 0152df0..95cdefa 100644
--- a/config.h
+++ b/config.h
@@ -21,6 +21,14 @@
#include <linux/if.h>
#include <netinet/in.h>
+#include "ring.h"
+
+struct tun_data {
+ char device4[IFNAMSIZ];
+ int read_fd6, write_fd6, fd4;
+ struct packet_ring ring;
+};
+
struct clat_config {
struct in6_addr ipv6_local_subnet;
struct in_addr ipv4_local_subnet;
diff --git a/main.c b/main.c
index c4834d9..683b507 100644
--- a/main.c
+++ b/main.c
@@ -32,7 +32,6 @@
#include "config.h"
#include "logging.h"
#include "setif.h"
-#include "tun.h"
#define DEVICEPREFIX "v4-"
diff --git a/ring.c b/ring.c
index 96a50ca..7626c6d 100644
--- a/ring.c
+++ b/ring.c
@@ -24,10 +24,10 @@
#include <sys/mman.h>
#include <sys/socket.h>
+#include "config.h"
#include "logging.h"
#include "ring.h"
#include "translate.h"
-#include "tun.h"
int ring_create(struct tun_data *tunnel) {
// Will eventually be bound to htons(ETH_P_IPV6) protocol,
diff --git a/translate.c b/translate.c
index f759726..728acc3 100644
--- a/translate.c
+++ b/translate.c
@@ -26,7 +26,6 @@
#include "icmp.h"
#include "logging.h"
#include "translate.h"
-#include "tun.h"
/* function: packet_checksum
* calculates the checksum over all the packet components starting from pos
diff --git a/tun.h b/tun.h
deleted file mode 100644
index 1dc9136..0000000
--- a/tun.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * tun.h - tun device functions
- */
-#ifndef __TUN_H__
-#define __TUN_H__
-
-#include <fcntl.h>
-#include <linux/if.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "ring.h"
-
-struct tun_data {
- char device4[IFNAMSIZ];
- int read_fd6, write_fd6, fd4;
- struct packet_ring ring;
-};
-
-#endif