Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177165034
D60537.1793910574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D60537.1793910574.diff
View Options
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2917,6 +2917,7 @@
struct pf_addr *, u_int16_t, u_int16_t, int);
bool pf_init_threshold(struct pf_kthreshold *, uint32_t, uint32_t);
uint16_t pf_tagname2tag(const char *);
+uint16_t pf_tagname2tag_noref(const char *);
#ifdef ALTQ
uint16_t pf_qname2qid(const char *, bool);
#endif /* ALTQ */
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -851,7 +851,8 @@
bcopy(&sp->pfs_1500.rt_addr, &st->act.rt_addr,
sizeof(st->act.rt_addr));
if (sp->pfs_1500.tagname[0] != 0)
- st->tag = pf_tagname2tag(sp->pfs_1500.tagname);
+ st->tag = pf_tagname2tag_noref(
+ sp->pfs_1500.tagname);
break;
default:
panic("%s: Unsupported pfsync_msg_version %d",
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -836,6 +836,30 @@
return (tagname2tag(&V_pf_tags, tagname, true));
}
+/*
+ * Look a tag up for a state. States do not hold a reference on their tag.
+ */
+uint16_t
+pf_tagname2tag_noref(const char *tagname)
+{
+ struct pf_tagset *ts = &V_pf_tags;
+ struct pf_tagname *tag;
+ uint16_t tagid = 0;
+
+ PF_TAGS_RLOCK_TRACKER;
+
+ PF_TAGS_RLOCK();
+ TAILQ_FOREACH(tag, &ts->namehash[tagname2hashindex(ts, tagname)],
+ namehash_entries)
+ if (strcmp(tagname, tag->name) == 0) {
+ tagid = tag->tag;
+ break;
+ }
+ PF_TAGS_RUNLOCK();
+
+ return (tagid);
+}
+
static const char *
pf_tag2tagname(uint16_t tag)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 5, 8:29 PM (16 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41476126
Default Alt Text
D60537.1793910574.diff (1 KB)
Attached To
Mode
D60537: pfsync: Do not reference the tag of an imported state
Attached
Detach File
Event Timeline