Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Commit

Permalink
Correct which value is used for finding the correct vlan. This unbrea…
Browse files Browse the repository at this point in the history
…ks vlan(s) workings and Fixes #2613
  • Loading branch information
Ermal committed Aug 28, 2012
1 parent 17ee444 commit cba403d
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions patches/RELENG_8_3/pf_802.1p.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/contrib/pf/pfctl/parse.y b/contrib/pf/pfctl/parse.y
index 217d5ca..9a36db1 100644
index bf4ed16..88a9b9c 100644
--- a/contrib/pf/pfctl/parse.y
+++ b/contrib/pf/pfctl/parse.y
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD: src/contrib/pf/pfctl/parse.y,v 1.9.2.2.6.1 2012/03/03 06:15:
Expand Down Expand Up @@ -154,7 +154,7 @@ index 217d5ca..9a36db1 100644
| PROBABILITY STRING {
char *e;
double p = strtod($2, &e);
@@ -5190,6 +5300,8 @@ lookup(char *s)
@@ -5191,6 +5301,8 @@ lookup(char *s)
{ "hostid", HOSTID},
{ "icmp-type", ICMPTYPE},
{ "icmp6-type", ICMP6TYPE},
Expand All @@ -164,7 +164,7 @@ index 217d5ca..9a36db1 100644
{ "in", IN},
{ "inet", INET},
diff --git a/contrib/pf/pfctl/pfctl_parser.c b/contrib/pf/pfctl/pfctl_parser.c
index 1a1ed39..850cec4 100644
index e257ebb..6f47c76 100644
--- a/contrib/pf/pfctl/pfctl_parser.c
+++ b/contrib/pf/pfctl/pfctl_parser.c
@@ -40,6 +40,8 @@ __FBSDID("$FreeBSD: src/contrib/pf/pfctl/pfctl_parser.c,v 1.8.10.3.2.1 2012/03/0
Expand Down Expand Up @@ -233,7 +233,7 @@ index 1a1ed39..850cec4 100644
void
print_flags(u_int8_t f)
{
@@ -1025,6 +1070,13 @@ print_rule(struct pf_rule *r, const char *anchor_call, int verbose, int numeric)
@@ -1027,6 +1072,13 @@ print_rule(struct pf_rule *r, const char *anchor_call, int verbose, int numeric)
}
if (r->rtableid != -1)
printf(" rtable %u", r->rtableid);
Expand Down Expand Up @@ -315,7 +315,7 @@ index 5482cef..ef40fa4 100644
DEF_CMD_ARG("vlan", setvlantag),
DEF_CMD_ARG("vlandev", setvlandev),
diff --git a/sys/contrib/pf/net/pf.c b/sys/contrib/pf/net/pf.c
index 74d1e85..c004898 100644
index b23b41d..3aa8b38 100644
--- a/sys/contrib/pf/net/pf.c
+++ b/sys/contrib/pf/net/pf.c
@@ -97,6 +97,8 @@ __FBSDID("$FreeBSD: src/sys/contrib/pf/net/pf.c,v 1.69.2.4.4.1 2012/03/03 06:15:
Expand All @@ -327,7 +327,7 @@ index 74d1e85..c004898 100644
#include <net/bpf.h>
#include <net/route.h>
#ifndef __FreeBSD__
@@ -2356,6 +2358,36 @@ pf_match_uid(u_int8_t op, uid_t a1, uid_t a2, uid_t u)
@@ -2358,6 +2360,36 @@ pf_match_uid(u_int8_t op, uid_t a1, uid_t a2, uid_t u)
}

int
Expand Down Expand Up @@ -364,7 +364,7 @@ index 74d1e85..c004898 100644
pf_match_gid(u_int8_t op, gid_t a1, gid_t a2, gid_t g)
{
if (g == GID_MAX && op != PF_OP_EQ && op != PF_OP_NE)
@@ -2428,6 +2460,26 @@ pf_tag_packet(struct mbuf *m, struct pf_mtag *pf_mtag, int tag, int rtableid)
@@ -2430,6 +2462,26 @@ pf_tag_packet(struct mbuf *m, struct pf_mtag *pf_mtag, int tag, int rtableid)
return (0);
}

Expand All @@ -391,7 +391,7 @@ index 74d1e85..c004898 100644
static void
pf_step_into_anchor(int *depth, struct pf_ruleset **rs, int n,
struct pf_rule **r, struct pf_rule **a, int *match)
@@ -3550,6 +3602,10 @@ pf_test_tcp(struct pf_rule **rm, struct pf_state **sm, int direction,
@@ -3568,6 +3620,10 @@ pf_test_tcp(struct pf_rule **rm, struct pf_state **sm, int direction,
!pf_match_gid(r->gid.op, r->gid.gid[0], r->gid.gid[1],
pd->lookup.gid))
r = TAILQ_NEXT(r, entries);
Expand All @@ -402,7 +402,7 @@ index 74d1e85..c004898 100644
else if (r->prob && r->prob <= arc4random())
r = TAILQ_NEXT(r, entries);
else if (r->match_tag && !pf_match_tag(m, r, pd->pf_mtag, &tag))
@@ -3976,6 +4032,10 @@ pf_test_udp(struct pf_rule **rm, struct pf_state **sm, int direction,
@@ -4013,6 +4069,10 @@ pf_test_udp(struct pf_rule **rm, struct pf_state **sm, int direction,
!pf_match_gid(r->gid.op, r->gid.gid[0], r->gid.gid[1],
pd->lookup.gid))
r = TAILQ_NEXT(r, entries);
Expand All @@ -413,7 +413,7 @@ index 74d1e85..c004898 100644
else if (r->prob && r->prob <= arc4random())
r = TAILQ_NEXT(r, entries);
else if (r->match_tag && !pf_match_tag(m, r, pd->pf_mtag, &tag))
@@ -4584,6 +4644,14 @@ pf_test_other(struct pf_rule **rm, struct pf_state **sm, int direction,
@@ -4659,6 +4719,14 @@ pf_test_other(struct pf_rule **rm, struct pf_state **sm, int direction,
r = TAILQ_NEXT(r, entries);
else if (r->rule_flag & PFRULE_FRAGMENT)
r = TAILQ_NEXT(r, entries);
Expand All @@ -428,7 +428,7 @@ index 74d1e85..c004898 100644
else if (r->prob && r->prob <= arc4random())
r = TAILQ_NEXT(r, entries);
else if (r->match_tag && !pf_match_tag(m, r, pd->pf_mtag, &tag))
@@ -4814,6 +4882,10 @@ pf_test_fragment(struct pf_rule **rm, int direction, struct pfi_kif *kif,
@@ -4908,6 +4976,10 @@ pf_test_fragment(struct pf_rule **rm, int direction, struct pfi_kif *kif,
pd->proto == IPPROTO_ICMPV6) &&
(r->type || r->code))
r = TAILQ_NEXT(r, entries);
Expand All @@ -439,7 +439,7 @@ index 74d1e85..c004898 100644
else if (r->prob && r->prob <= arc4random())
r = TAILQ_NEXT(r, entries);
else if (r->match_tag && !pf_match_tag(m, r, pd->pf_mtag, &tag))
@@ -7588,6 +7660,15 @@ done:
@@ -7695,6 +7767,15 @@ done:
if ((s && s->tag) || r->rtableid)
pf_tag_packet(m, pd.pf_mtag, s ? s->tag : 0, r->rtableid);

Expand All @@ -455,7 +455,7 @@ index 74d1e85..c004898 100644
#ifdef ALTQ
if (action == PF_PASS && r->qid) {
if (s)
@@ -8185,6 +8266,15 @@ done:
@@ -8304,6 +8385,15 @@ done:
if ((s && s->tag) || r->rtableid)
pf_tag_packet(m, pd.pf_mtag, s ? s->tag : 0, r->rtableid);

Expand All @@ -472,10 +472,10 @@ index 74d1e85..c004898 100644
if (action == PF_PASS && r->qid) {
if (s)
diff --git a/sys/contrib/pf/net/pfvar.h b/sys/contrib/pf/net/pfvar.h
index ae19f54..2e039fb 100644
index 209fdaf..03a82a5 100644
--- a/sys/contrib/pf/net/pfvar.h
+++ b/sys/contrib/pf/net/pfvar.h
@@ -430,6 +430,14 @@ struct pf_rule_gid {
@@ -431,6 +431,14 @@ struct pf_rule_gid {
u_int8_t op;
};

Expand All @@ -490,15 +490,15 @@ index ae19f54..2e039fb 100644
struct pf_rule_addr {
struct pf_addr_wrap addr;
u_int16_t port[2];
@@ -625,6 +633,7 @@ struct pf_rule {
@@ -633,6 +641,7 @@ struct pf_rule {
u_int32_t max_src_nodes;
u_int32_t max_src_states;
u_int32_t spare1; /* netgraph */
+ struct pf_rule_ieee8021q_pcp ieee8021q_pcp; /* spare1 */
u_int32_t max_src_conn;
struct {
u_int32_t limit;
@@ -1733,6 +1742,8 @@ int pf_match(u_int8_t, u_int32_t, u_int32_t, u_int32_t);
@@ -1745,6 +1754,8 @@ int pf_match(u_int8_t, u_int32_t, u_int32_t, u_int32_t);
int pf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t);
int pf_match_uid(u_int8_t, uid_t, uid_t, uid_t);
int pf_match_gid(u_int8_t, gid_t, gid_t, gid_t);
Expand Down Expand Up @@ -528,7 +528,7 @@ index fbd2516..b6e6ec4 100644

#define _SIZEOF_ADDR_IFREQ(ifr) \
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 8008f8b..08d93b5 100644
index 8008f8b..1bc2a73 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,5 +1,9 @@
Expand Down Expand Up @@ -655,15 +655,22 @@ index 8008f8b..08d93b5 100644

/*
* Remove the 802.1q header by copying the Ethernet
@@ -1014,6 +1049,8 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
@@ -1014,11 +1049,13 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
}
}

+ vid = EVL_VLANOFTAG(tag);
+
TRUNK_RLOCK(trunk);
#ifdef VLAN_ARRAY
ifv = trunk->vlans[tag];
- ifv = trunk->vlans[tag];
+ ifv = trunk->vlans[vid];
#else
- ifv = vlan_gethash(trunk, tag);
+ ifv = vlan_gethash(trunk, vid);
#endif
if (ifv == NULL || !UP_AND_RUNNING(ifv->ifv_ifp)) {
TRUNK_RUNLOCK(trunk);
@@ -1028,6 +1065,28 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
}
TRUNK_RUNLOCK(trunk);
Expand Down

0 comments on commit cba403d

Please sign in to comment.