1#!/usr/bin/env python3 2# SPDX-License-Identifier: GPL-2.0 3# 4# Script that checks that SFQ rejects a limit of 1 at the kernel 5# level. We can't use iproute2's tc because it does not accept a limit 6# of 1. 7 8import sys 9import os 10 11from pyroute2 import IPRoute 12from pyroute2.netlink.exceptions import NetlinkError 13 14ip = IPRoute() 15ifidx = ip.link_lookup(ifname=sys.argv[1]) 16 17try: 18 ip.tc('add', 'sfq', ifidx, limit=1) 19 sys.exit(1) 20except NetlinkError: 21 sys.exit(0) 22