Bug 169620 - [ng] [pf] ng_l2tp incoming packet bypass pf firewall
Summary: [ng] [pf] ng_l2tp incoming packet bypass pf firewall
Status: Closed DUPLICATE of bug 187566
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.3-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-03 02:50 UTC by hashiz
Modified: 2021-12-27 10:46 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hashiz 2012-07-03 02:50:08 UTC
PF firewall does not examine incomming packet on ng_l2tp interface.
ng_pppoe : examine.
ng_l2tp  : not examine.

How-To-Repeat: 
Setup l2tp tunnel using net/mpd5.

Connect from client.

Write block PF rule on l2tp netgraph interface.
    block in quick on ngX inet from any to any
    pass  out quick on ngX inet from any to any

PF through the packets. Block rule not evalute.
    sudo pfctl -vvs -s Interfaces -i ngX
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-07-16 03:54:51 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

reclassify.
Comment 2 longwitz 2012-08-02 09:39:20 UTC
Hi,
> PF firewall does not examine incomming packet on ng_l2tp interface.

If your incoming packets are handled by IPSec before ng_l2tp your
problem is explained in

   lists.freebsd.org/pipermail/freebsd-net/2012-January/031161.html

-- 
Andreas Longwitz
Comment 3 hashiz 2012-08-02 11:20:48 UTC
In "Re: kern/169620: [ng] [pf] ng_l2tp incoming packet bypass pf firewall" at Thu, 02 Aug 2012 10:39:20 +0200
 Andreas Longwitz <longwitz@incore.de>  wrote:
> Hi,
>> PF firewall does not examine incomming packet on ng_l2tp interface.
> 
> If your incoming packets are handled by IPSec before ng_l2tp your
> problem is explained in

Yes, handled by IPSec.

> 
>    lists.freebsd.org/pipermail/freebsd-net/2012-January/031161.html

I will try it.

Thanks.
Comment 4 hashiz 2012-08-03 04:39:15 UTC
Hi.

In "Re: kern/169620: [ng] [pf] ng_l2tp incoming packet bypass pf firewall" at Thu, 02 Aug 2012 19:20:48 +0900 (JST)
 HASHI Hiroaki <hashiz@meridiani.jp>  wrote:
> In "Re: kern/169620: [ng] [pf] ng_l2tp incoming packet bypass pf firewall" at Thu, 02 Aug 2012 10:39:20 +0200
>  Andreas Longwitz <longwitz@incore.de>  wrote:
>> Hi,
>>> PF firewall does not examine incomming packet on ng_l2tp interface.
>> 
>> If your incoming packets are handled by IPSec before ng_l2tp your
>> problem is explained in
> 
> Yes, handled by IPSec.
> 
>> 
>>    lists.freebsd.org/pipermail/freebsd-net/2012-January/031161.html
> 
> I will try it.

This patch work fine for me.
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2014-05-04 05:50:27 UTC
Responsible Changed
From-To: freebsd-net->freebsd-pf

Over to maintainer(s).
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:14 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 7 Eugene Grosbein freebsd_committer freebsd_triage 2021-12-14 22:15:45 UTC

*** This bug has been marked as a duplicate of bug 187566 ***
Comment 8 longwitz 2021-12-27 10:46:03 UTC
The patch given in bug 187566 has solved an other problem than the one discussed in this bug report. We still need the patch

--- ng_l2tp.c.1st       2021-12-19 19:31:10.693840000 +0100
+++ ng_l2tp.c   2021-12-23 14:50:47.334147000 +0100
@@ -755,6 +755,7 @@
        hookpriv_p hpriv = NULL;
        hook_p hook = NULL;
        struct mbuf *m;
+       struct m_tag *mtag;
        u_int16_t tid, sid;
        u_int16_t hdr;
        u_int16_t ns, nr;
@@ -997,6 +998,11 @@
                NG_FREE_M(m);
                ERROUT(0);
        }
+
+       /* Delete an existing ipsec tag */
+       mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL);
+       if (mtag != NULL)
+               m_tag_delete(m, mtag);
 
        /* Deliver data */
        NG_FWD_NEW_DATA(error, item, hook, m);

The same issue for if_epair.c is solved in FreeBSD V12.3 calling a new statc function called epair_clear_mbuf(). commit ae23f081...

Andreas