@@ -3820,6 +3820,8 @@ pf_match_eth_addr(const uint8_t *a, const struct pf_keth_rule_addr *r)
3820
3820
static int
3821
3821
pf_test_eth_rule (int dir , struct pfi_kkif * kif , struct mbuf * * m0 )
3822
3822
{
3823
+ struct ip ip ;
3824
+ struct ip6_hdr ip6 ;
3823
3825
struct mbuf * m = * m0 ;
3824
3826
struct ether_header * e ;
3825
3827
struct pf_keth_rule * r , * rm , * a = NULL ;
@@ -3862,31 +3864,17 @@ pf_test_eth_rule(int dir, struct pfi_kkif *kif, struct mbuf **m0)
3862
3864
3863
3865
switch (proto ) {
3864
3866
case ETHERTYPE_IP : {
3865
- struct ip * ip ;
3866
- m = m_pullup (m , sizeof (struct ether_header ) +
3867
- sizeof (struct ip ));
3868
- if (m == NULL ) {
3869
- * m0 = NULL ;
3870
- return (PF_DROP );
3871
- }
3867
+ m_copydata (m , sizeof (struct ether_header ), sizeof (ip ), (caddr_t )& ip );
3872
3868
af = AF_INET ;
3873
- ip = mtodo (m , sizeof (struct ether_header ));
3874
- src = (struct pf_addr * )& ip -> ip_src ;
3875
- dst = (struct pf_addr * )& ip -> ip_dst ;
3869
+ src = (struct pf_addr * )& ip .ip_src ;
3870
+ dst = (struct pf_addr * )& ip .ip_dst ;
3876
3871
break ;
3877
3872
}
3878
3873
case ETHERTYPE_IPV6 : {
3879
- struct ip6_hdr * ip6 ;
3880
- m = m_pullup (m , sizeof (struct ether_header ) +
3881
- sizeof (struct ip6_hdr ));
3882
- if (m == NULL ) {
3883
- * m0 = NULL ;
3884
- return (PF_DROP );
3885
- }
3874
+ m_copydata (m , sizeof (struct ether_header ), sizeof (ip6 ), (caddr_t )& ip6 );
3886
3875
af = AF_INET6 ;
3887
- ip6 = mtodo (m , sizeof (struct ether_header ));
3888
- src = (struct pf_addr * )& ip6 -> ip6_src ;
3889
- dst = (struct pf_addr * )& ip6 -> ip6_dst ;
3876
+ src = (struct pf_addr * )& ip6 .ip6_src ;
3877
+ dst = (struct pf_addr * )& ip6 .ip6_dst ;
3890
3878
break ;
3891
3879
}
3892
3880
}
0 commit comments