Re-indent clatd code with clang-format
clang-format --style file -i *.{c,h,cpp}
Bug: 118848635
Test: 1. browse over ipv6-only network
2. atest clatd_test
3. clang-format --style file -i *.{c,h,cpp}
Change-Id: I7389426101df7745370d0ac5c55176cd8fe2b08b
diff --git a/tun.c b/tun.c
index 49f0ea7..1120bae 100644
--- a/tun.c
+++ b/tun.c
@@ -15,14 +15,14 @@
*
* tun.c - tun device functions
*/
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
#include <arpa/inet.h>
+#include <fcntl.h>
#include <linux/if.h>
#include <linux/if_tun.h>
+#include <string.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
+#include <unistd.h>
#include "clatd.h"
@@ -33,7 +33,7 @@
int fd;
fd = open("/dev/tun", O_RDWR);
- if(fd < 0) {
+ if (fd < 0) {
fd = open("/dev/net/tun", O_RDWR);
}
@@ -51,12 +51,12 @@
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TUN;
- if( *dev ) {
+ if (*dev) {
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
- ifr.ifr_name[IFNAMSIZ-1] = '\0';
+ ifr.ifr_name[IFNAMSIZ - 1] = '\0';
}
- if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
+ if ((err = ioctl(fd, TUNSETIFF, (void *)&ifr)) < 0) {
close(fd);
return err;
}
@@ -84,6 +84,4 @@
* iov_len - the number of entries in the clat_packet
* returns: number of bytes read on success, -1 on failure
*/
-int send_tun(int fd, clat_packet out, int iov_len) {
- return writev(fd, out, iov_len);
-}
+int send_tun(int fd, clat_packet out, int iov_len) { return writev(fd, out, iov_len); }