Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    pfctl -i Interface -s states does not produce any output in 22.05

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 4 Posters 877 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pfpv
      last edited by

      I am using scripts to kill states on failback from the following link: https://forum.netgate.com/topic/135614/failback-from-primary-wan-after-failover-to-secondary-wan

      After not using them for a while I tired to use them on 22.05 and found that the main script doesn't work. I found why.

      pfctl -i mvneta0 -ss | grep 'tcp'
      

      does not produce any output. I tried

      pfctl -i Interface -s states
      

      for a couple of interfaces and the output is just blank. This is a standard command in FreeBSD. I did not find any description of changes. Is there any other way to get the same output as it was possible to get from

      pfctl -i Interface -ss
      

      before?

      luckman212L 1 Reply Last reply Reply Quote 1
      • luckman212L
        luckman212 LAYER 8 @pfpv
        last edited by luckman212

        @pfpv Hmm. It doesn't produce any output on my 6100 either, when invoked with the -i flag. Not sure what's going on there.

        You could try https://github.com/luckman212/stv for now and use it like

        stv '%tcp.*%mvneta0%'
        

        Your script would need to be adjusted because the output format is different (stv output should actually be easier to parse).

        1 Reply Last reply Reply Quote 1
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          It's because the interface is no longer tagged on states like that:

          [22.05-RELEASE][admin@apu.stevew.lan]/root: pfctl -vvss
          all icmp 172.21.16.10:53294 -> 172.21.16.1:53294       0:0
             age 72:55:22, expires in 00:00:09, 497546:497030 pkts, 14428834:14413870 bytes, rule 76
             id: 618fb96200000001 creatorid: 3ecec8db gateway: 0.0.0.0
             origif: re1
          all tcp 172.21.16.10:22 <- 172.21.16.5:38708       ESTABLISHED:ESTABLISHED
             [1885142956 + 2147025153] wscale 7  [2696422768 + 65792] wscale 7
             age 00:55:32, expires in 24:00:00, 273:383 pkts, 24721:34285 bytes, rule 83
             id: f0a5b96200000001 creatorid: 3ecec8db gateway: 172.21.16.1
             origif: re1
          

          All states are shown as 'all' where previously the interface was shown. Instead the interface where the state was created is shown by origif:.

          Steve

          P 1 Reply Last reply Reply Quote 1
          • P
            pfpv @stephenw10
            last edited by

            @stephenw10
            Was this function rewritten specifically for pfSense? The man page for FreeBSD still shows the option -i. Even in pfSense for

            pfctl -h
            

            I get this

            usage: pfctl [-AdeghMmNnOPqRrvz] [-a anchor] [-D macro=value] [-F modifier]
            	[-f file] [-i interface] [-K host | network]
            	[-k host | network | gateway | label | id] [-o level] [-p device]
            	[-s modifier] [-t table -T command [address ...]] [-x level]
            

            The -i interface option is still there. Won't it break the code in other packages etc. like it broke the code in the script I mentioned?

            What would be the most efficient way to probe states for a particular interface now? I need to run that script every 2 minutes or even more often. It probes the backup interface that is not expected to have any states. Now it seems I have to get a list of all states from all interfaces and find a few out of hundreds and thousands. The stv script mentioned above does that.

            P 1 Reply Last reply Reply Quote 1
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              They are seen as floating states:
              https://github.com/pfsense/FreeBSD-src/commit/7c15871eff2341da68fa5c88fe64d1f386f13c89

              Check the code in diag_dump_states which does filtering by interface.

              Steve

              1 Reply Last reply Reply Quote 0
              • P
                Proton @pfpv
                last edited by

                @pfpv Hi! Did you get this solved?
                I also try the same :?

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.