blob: 9b15719114cb788dc0b1720114e3e17656aed8f0 [file] [log] [blame]
Maciej Żenczykowskib70da762019-01-28 15:20:48 -08001/*
2 * Copyright (C) 2019 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
Maciej Żenczykowski776200e2020-02-05 02:05:16 -080017#pragma once
Maciej Żenczykowskib70da762019-01-28 15:20:48 -080018
Maciej Żenczykowskie5b6b4d2020-02-05 02:00:38 -080019#include <errno.h>
Maciej Żenczykowskif1247382020-02-05 00:44:14 -080020#include <linux/if_ether.h>
Maciej Żenczykowskiba6ac9a2021-01-07 18:45:11 -080021#include <linux/if_link.h>
Maciej Żenczykowskib3e69d62020-02-05 02:44:16 -080022#include <linux/rtnetlink.h>
Patrick Rohrb791bd62022-03-29 21:18:31 +020023#include <tcutils/tcutils.h>
Maciej Żenczykowskif1247382020-02-05 00:44:14 -080024
Maciej Żenczykowskib70da762019-01-28 15:20:48 -080025namespace android {
26namespace net {
27
Maciej Żenczykowskif89e9112020-02-12 05:22:56 -080028inline int tcQdiscAddDevClsact(int ifIndex) {
29 return doTcQdiscClsact(ifIndex, RTM_NEWQDISC, NLM_F_EXCL | NLM_F_CREATE);
Maciej Żenczykowskib3e69d62020-02-05 02:44:16 -080030}
31
Maciej Żenczykowskif89e9112020-02-12 05:22:56 -080032inline int tcQdiscReplaceDevClsact(int ifIndex) {
33 return doTcQdiscClsact(ifIndex, RTM_NEWQDISC, NLM_F_CREATE | NLM_F_REPLACE);
Maciej Żenczykowskib3e69d62020-02-05 02:44:16 -080034}
35
Maciej Żenczykowskif89e9112020-02-12 05:22:56 -080036inline int tcQdiscDelDevClsact(int ifIndex) {
37 return doTcQdiscClsact(ifIndex, RTM_DELQDISC, 0);
Maciej Żenczykowskib3e69d62020-02-05 02:44:16 -080038}
Maciej Żenczykowskiff3308d2019-02-12 19:10:55 -080039
Maciej Żenczykowskib70da762019-01-28 15:20:48 -080040} // namespace net
41} // namespace android