Projet

Général

Profil

Télécharger (1,94 ko) Statistiques
| Branche: | Révision:

univnautes-tools / patches / stable / 10 / get_tag_altq_ids.RELENG_10.diff @ 4ab3b90b

1
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
2
index d97166e..0138557 100644
3
--- a/sys/net/pfvar.h
4
+++ b/sys/net/pfvar.h
5
@@ -1399,6 +1399,8 @@ struct pfioc_trans {
6
 #ifdef _KERNEL
7
 #define PFR_FLAG_USERIOCTL	0x10000000
8
 #endif
9
+#define DIOCGETNAMEDALTQ	_IOWR('D', 94, struct pfioc_ruleset)
10
+#define DIOCGETNAMEDTAG		_IOR('D', 95, u_int32_t)
11
 
12
 struct pfioc_table {
13
 	struct pfr_table	 pfrio_table;
14
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
15
index aa42040..88c9076 100644
16
--- a/sys/netpfil/pf/pf_ioctl.c
17
+++ b/sys/netpfil/pf/pf_ioctl.c
18
@@ -989,6 +989,8 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td
19
 		case DIOCCLRRULECTRS:
20
 		case DIOCGETLIMIT:
21
 		case DIOCGETALTQS:
22
+		case DIOCGETNAMEDALTQ:
23
+		case DIOCGETNAMEDTAG:
24
 		case DIOCGETALTQ:
25
 		case DIOCGETQSTATS:
26
 		case DIOCGETRULESETS:
27
@@ -1035,6 +1037,8 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td
28
 		case DIOCGETTIMEOUT:
29
 		case DIOCGETLIMIT:
30
 		case DIOCGETALTQS:
31
+		case DIOCGETNAMEDALTQ:
32
+		case DIOCGETNAMEDTAG:
33
 		case DIOCGETALTQ:
34
 		case DIOCGETQSTATS:
35
 		case DIOCGETRULESETS:
36
@@ -2061,6 +2065,16 @@ DIOCGETSTATES_full:
37
 		break;
38
 	}
39
 
40
+	case DIOCGETNAMEDALTQ: {
41
+		struct pfioc_ruleset	*pa = (struct pfioc_ruleset *)addr;
42
+
43
+		if (pa->name[0]) {
44
+                        pa->nr = pf_qname2qid(pa->name);
45
+                        pf_qid_unref(pa->nr);
46
+                }
47
+		break;
48
+	}
49
+	
50
 	case DIOCGETALTQS: {
51
 		struct pfioc_altq	*pa = (struct pfioc_altq *)addr;
52
 		struct pf_altq		*altq;
53
@@ -2146,6 +2160,16 @@ DIOCGETSTATES_full:
54
 	}
55
 #endif /* ALTQ */
56
 
57
+	case DIOCGETNAMEDTAG: {
58
+                /* Little abuse. */
59
+                struct pfioc_ruleset    *pa = (struct pfioc_ruleset *)addr;
60
+
61
+                if (pa->name[0])
62
+                        pa->nr = pf_tagname2tag(pa->name);
63
+
64
+                break;
65
+        }
66
+
67
 	case DIOCBEGINADDRS: {
68
 		struct pfioc_pooladdr	*pp = (struct pfioc_pooladdr *)addr;
69
 
(18-18/67)