Maciej Żenczykowski | b70da76 | 2019-01-28 15:20:48 -0800 | [diff] [blame] | 1 | /* |
| 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 Żenczykowski | 776200e | 2020-02-05 02:05:16 -0800 | [diff] [blame] | 17 | #pragma once |
Maciej Żenczykowski | b70da76 | 2019-01-28 15:20:48 -0800 | [diff] [blame] | 18 | |
Maciej Żenczykowski | e5b6b4d | 2020-02-05 02:00:38 -0800 | [diff] [blame] | 19 | #include <errno.h> |
Maciej Żenczykowski | f124738 | 2020-02-05 00:44:14 -0800 | [diff] [blame] | 20 | #include <linux/if_ether.h> |
Maciej Żenczykowski | ba6ac9a | 2021-01-07 18:45:11 -0800 | [diff] [blame] | 21 | #include <linux/if_link.h> |
Maciej Żenczykowski | b3e69d6 | 2020-02-05 02:44:16 -0800 | [diff] [blame] | 22 | #include <linux/rtnetlink.h> |
Patrick Rohr | b791bd6 | 2022-03-29 21:18:31 +0200 | [diff] [blame] | 23 | #include <tcutils/tcutils.h> |
Maciej Żenczykowski | f124738 | 2020-02-05 00:44:14 -0800 | [diff] [blame] | 24 | |
Maciej Żenczykowski | b70da76 | 2019-01-28 15:20:48 -0800 | [diff] [blame] | 25 | namespace android { |
| 26 | namespace net { |
| 27 | |
Maciej Żenczykowski | f89e911 | 2020-02-12 05:22:56 -0800 | [diff] [blame] | 28 | inline int tcQdiscAddDevClsact(int ifIndex) { |
| 29 | return doTcQdiscClsact(ifIndex, RTM_NEWQDISC, NLM_F_EXCL | NLM_F_CREATE); |
Maciej Żenczykowski | b3e69d6 | 2020-02-05 02:44:16 -0800 | [diff] [blame] | 30 | } |
| 31 | |
Maciej Żenczykowski | f89e911 | 2020-02-12 05:22:56 -0800 | [diff] [blame] | 32 | inline int tcQdiscReplaceDevClsact(int ifIndex) { |
| 33 | return doTcQdiscClsact(ifIndex, RTM_NEWQDISC, NLM_F_CREATE | NLM_F_REPLACE); |
Maciej Żenczykowski | b3e69d6 | 2020-02-05 02:44:16 -0800 | [diff] [blame] | 34 | } |
| 35 | |
Maciej Żenczykowski | f89e911 | 2020-02-12 05:22:56 -0800 | [diff] [blame] | 36 | inline int tcQdiscDelDevClsact(int ifIndex) { |
| 37 | return doTcQdiscClsact(ifIndex, RTM_DELQDISC, 0); |
Maciej Żenczykowski | b3e69d6 | 2020-02-05 02:44:16 -0800 | [diff] [blame] | 38 | } |
Maciej Żenczykowski | ff3308d | 2019-02-12 19:10:55 -0800 | [diff] [blame] | 39 | |
Maciej Żenczykowski | b70da76 | 2019-01-28 15:20:48 -0800 | [diff] [blame] | 40 | } // namespace net |
| 41 | } // namespace android |