blob: 186072db3d13e9e59128d72aa6466060a103be15 [file] [log] [blame]
Lorenzo Colitti36679362015-02-25 10:26:19 +09001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Ken Chend15bcfc2020-12-04 00:08:54 +080017#define LOG_TAG "Netd"
18
Lorenzo Colitti36679362015-02-25 10:26:19 +090019#include "DummyNetwork.h"
20
Nicolas Geoffrayafd40372015-03-16 11:58:06 +000021#include "errno.h"
Lorenzo Colitti36679362015-02-25 10:26:19 +090022
Lorenzo Colitti7035f222017-02-13 18:29:00 +090023namespace android {
24namespace net {
25
Chalard Jeand96b0f22021-01-20 14:16:06 +090026// The dummy network is used to blackhole or reject traffic.
27// It has an IPv4 and an IPv6 default route that point to a dummy interface
28// which drops packets. It is used for system purposes only. Applications
29// cannot use multinetwork APIs such as Network#bindSocket or
30// android_setsocknetwork to send packets on the dummy network.
31// Any attempt to do so will fail with ENETUNREACH.
32
Lorenzo Colitti36679362015-02-25 10:26:19 +090033const char* DummyNetwork::INTERFACE_NAME = "dummy0";
34
35DummyNetwork::DummyNetwork(unsigned netId) : Network(netId) {
36 mInterfaces.insert(INTERFACE_NAME);
37}
38
39DummyNetwork::~DummyNetwork() {
40}
41
Lorenzo Colitti7035f222017-02-13 18:29:00 +090042} // namespace net
43} // namespace android