MCPcopy Create free account
hub / github.com/F-Stack/f-stack / altq_fetch

Function altq_fetch

tools/ipfw/altq.c:72–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static void
73altq_fetch(void)
74{
75 struct pfioc_altq pfioc;
76 struct pf_altq *altq;
77 int pffd;
78 unsigned int mnr;
79 static int altq_fetched = 0;
80
81 if (altq_fetched)
82 return;
83 altq_fetched = 1;
84 pffd = open("/dev/pf", O_RDONLY);
85 if (pffd == -1) {
86 warn("altq support opening pf(4) control device");
87 return;
88 }
89 bzero(&pfioc, sizeof(pfioc));
90 pfioc.version = PFIOC_ALTQ_VERSION;
91 if (ioctl(pffd, DIOCGETALTQS, &pfioc) != 0) {
92 warn("altq support getting queue list");
93 close(pffd);
94 return;
95 }
96 mnr = pfioc.nr;
97 for (pfioc.nr = 0; pfioc.nr < mnr; pfioc.nr++) {
98 if (ioctl(pffd, DIOCGETALTQ, &pfioc) != 0) {
99 if (errno == EBUSY)
100 break;
101 warn("altq support getting queue list");
102 close(pffd);
103 return;
104 }
105 if (pfioc.altq.qid == 0)
106 continue;
107 altq = safe_calloc(1, sizeof(*altq));
108 *altq = pfioc.altq;
109 TAILQ_INSERT_TAIL(&altq_entries, altq, entries);
110 }
111 close(pffd);
112}
113
114u_int32_t
115altq_name_to_qid(const char *name)

Callers 2

altq_name_to_qidFunction · 0.85
altq_qid_to_nameFunction · 0.85

Calls 4

bzeroFunction · 0.85
safe_callocFunction · 0.70
ioctlFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected