chromium/net/base/address_tracker_linux.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/base/address_tracker_linux.h"

#include <errno.h>
#include <linux/if.h>
#include <stdint.h>
#include <sys/ioctl.h>

#include <optional>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/dcheck_is_on.h"
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/page_size.h"
#include "base/posix/eintr_wrapper.h"
#include "base/sequence_checker.h"
#include "base/task/current_thread.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "net/base/network_interfaces_linux.h"

#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif

namespace net::internal {

namespace {

// Some kernel functions such as wireless_send_event and rtnetlink_ifinfo_prep
// may send spurious messages over rtnetlink. RTM_NEWLINK messages where
// ifi_change == 0 and rta_type == IFLA_WIRELESS should be ignored.
bool IgnoreWirelessChange(const struct ifinfomsg* msg, int length) {}

// Retrieves address from NETLINK address message.
// Sets |really_deprecated| for IPv6 addresses with preferred lifetimes of 0.
// Precondition: |header| must already be validated with NLMSG_OK.
bool GetAddress(const struct nlmsghdr* header,
                int header_length,
                IPAddress* out,
                bool* really_deprecated) {}

// SafelyCastNetlinkMsgData<T> performs a bounds check before casting |header|'s
// data to a |T*|. When the bounds check fails, returns nullptr.
template <typename T>
T* SafelyCastNetlinkMsgData(const struct nlmsghdr* header, int length) {}

}  // namespace

// static
char* AddressTrackerLinux::GetInterfaceName(int interface_index, char* buf) {}

AddressTrackerLinux::AddressTrackerLinux()
    :{}

AddressTrackerLinux::AddressTrackerLinux(
    const base::RepeatingClosure& address_callback,
    const base::RepeatingClosure& link_callback,
    const base::RepeatingClosure& tunnel_callback,
    const std::unordered_set<std::string>& ignored_interfaces,
    scoped_refptr<base::SequencedTaskRunner> blocking_thread_runner)
    :{}

AddressTrackerLinux::~AddressTrackerLinux() = default;

void AddressTrackerLinux::InitWithFdForTesting(base::ScopedFD fd) {}

void AddressTrackerLinux::Init() {}

bool AddressTrackerLinux::DidTrackingInitSucceedForTesting() const {}

void AddressTrackerLinux::AbortAndForceOnline() {}

AddressTrackerLinux::AddressMap AddressTrackerLinux::GetAddressMap() const {}

std::unordered_set<int> AddressTrackerLinux::GetOnlineLinks() const {}

AddressTrackerLinux* AddressTrackerLinux::GetAddressTrackerLinux() {}

std::pair<AddressTrackerLinux::AddressMap, std::unordered_set<int>>
AddressTrackerLinux::GetInitialDataAndStartRecordingDiffs() {}

void AddressTrackerLinux::SetDiffCallback(DiffCallback diff_callback) {}

bool AddressTrackerLinux::IsInterfaceIgnored(int interface_index) const {}

NetworkChangeNotifier::ConnectionType
AddressTrackerLinux::GetCurrentConnectionType() {}

void AddressTrackerLinux::DumpInitialAddressesAndWatch() {}

void AddressTrackerLinux::ReadMessages(bool* address_changed,
                                       bool* link_changed,
                                       bool* tunnel_changed) {}

void AddressTrackerLinux::HandleMessage(const char* buffer,
                                        int length,
                                        bool* address_changed,
                                        bool* link_changed,
                                        bool* tunnel_changed) {}

void AddressTrackerLinux::OnFileCanReadWithoutBlocking() {}

bool AddressTrackerLinux::IsTunnelInterface(int interface_index) const {}

// static
bool AddressTrackerLinux::IsTunnelInterfaceName(const char* name) {}

void AddressTrackerLinux::UpdateCurrentConnectionType() {}

void AddressTrackerLinux::RunDiffCallback() {}

int AddressTrackerLinux::GetThreadsWaitingForConnectionTypeInitForTesting() {}

AddressTrackerLinux::AddressTrackerAutoLock::AddressTrackerAutoLock(
    const AddressTrackerLinux& tracker,
    base::Lock& lock)
    :{}

AddressTrackerLinux::AddressTrackerAutoLock::~AddressTrackerAutoLock() {}

}  // namespace net::internal