mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Internal change.
PiperOrigin-RevId: 615567691
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
#include <linux/capability.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/syscalls/linux/iptables.h"
|
||||
#include "test/util/capability_util.h"
|
||||
@@ -191,7 +193,8 @@ TEST(IP6TablesTest, InitialEntries) {
|
||||
reinterpret_cast<char*>(entries->entrytable) + entry_offset);
|
||||
|
||||
// ipv6 should be zeroed.
|
||||
struct ip6t_ip6 zeroed = {};
|
||||
struct ip6t_ip6 zeroed;
|
||||
memset(&zeroed, 0, sizeof(zeroed));
|
||||
ASSERT_EQ(memcmp(static_cast<void*>(&zeroed),
|
||||
static_cast<void*>(&entry->ipv6), sizeof(zeroed)),
|
||||
0);
|
||||
|
||||
@@ -221,6 +221,9 @@ enum SockOpts6 {
|
||||
|
||||
// ip6t_ip6 specifies basic matching criteria that can be applied by examining
|
||||
// only the IP header of a packet.
|
||||
// Must be POD so that it can be zero-initialized using memset() because
|
||||
// initializing by "{}" leaves it partially uninitialized for paddings and
|
||||
// nested unions.
|
||||
struct ip6t_ip6 {
|
||||
// Source IP address.
|
||||
struct in6_addr src;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
@@ -220,13 +221,15 @@ TEST_F(TuntapTest, CreateFixedNameInterface) {
|
||||
|
||||
FileDescriptor fd = ASSERT_NO_ERRNO_AND_VALUE(Open(kDevNetTun, O_RDWR));
|
||||
|
||||
struct ifreq ifr_set = {};
|
||||
struct ifreq ifr_set;
|
||||
memset(&ifr_set, 0, sizeof(ifr_set));
|
||||
ifr_set.ifr_flags = IFF_TAP;
|
||||
strncpy(ifr_set.ifr_name, kTapName, IFNAMSIZ);
|
||||
EXPECT_THAT(ioctl(fd.get(), TUNSETIFF, &ifr_set),
|
||||
SyscallSucceedsWithValue(0));
|
||||
|
||||
struct ifreq ifr_get = {};
|
||||
struct ifreq ifr_get;
|
||||
memset(&ifr_get, 0, sizeof(ifr_get));
|
||||
EXPECT_THAT(ioctl(fd.get(), TUNGETIFF, &ifr_get),
|
||||
SyscallSucceedsWithValue(0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user