LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-13-2009, 12:38 PM   #16
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91

The decision to call a packet invalid is made by the rules in your firewall script.

You can experiment changing the --log-prefix in the script to see where it is rejected or dropped.
If you want, you can post that section of the script here, but I would understand if you prefer not to.
 
Old 04-13-2009, 01:35 PM   #17
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
You can experiment changing the --log-prefix in the script to see where it is rejected or dropped.
There is only one place in the script using that message syntax.

I can post the entire script but I believe the following is all that is needed:

Code:
# base script generated by Easy Firewall Generator
# copyright 2002 Timothy Scott Morizot
# http://easyfwgen.morizot.net/gen/
# slackware specific version available at
# http://www.slackware.com/~alien/efg/

IPT="/usr/sbin/iptables"
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP
$IPT -N bad_packets
$IPT -N bad_tcp_packets
$IPT -N icmp_packets
$IPT -N udp_inbound
$IPT -N udp_outbound
$IPT -N tcp_inbound
$IPT -N tcp_outbound
$IPT -A bad_packets -p ALL -m state --state INVALID -j LOG --log-prefix "Invalid packet: "
$IPT -A bad_packets -p ALL -m state --state INVALID -j DROP
. .  .
The log messages are generated by the rule highlighted above.

I don't pretend to understand iptables but I'll follow any cookie crumb trails anybody here leaves. Yeah, I know about the various online tutorials . . . .

Thanks.
 
Old 04-13-2009, 03:48 PM   #18
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91
This is a very basic filter checking for the state of the packet, where you can have:
  • --state NEW: New incoming or outgoing connections
  • --state ESTABLISHED: Packet is associated to an established connection
  • --state RELATED: New connection, but related to another, existing connection (for example w/ ftp)
  • --state INVALID: (this is from the man-page) "meaning that the packet could not be identified for some reason which includes running out of memory and ICMP errors which don't correspond to any known connection"

Like I said in a previous post, it might be related to an older connection that your firewall has forgotten already.

In most firewall scripts you'll see lines simply accepting ESTABLISHED / RELATED traffic (since it has already been checked when the connection was NEW).
INVALID usually means that the packet says it belongs to an existing connection (like in this case, it ACKnowledges), but your firewall does not know or does not remember.

Last edited by niels.horn; 04-13-2009 at 03:51 PM.
 
Old 04-13-2009, 05:41 PM   #19
janhe
Member
 
Registered: Jul 2007
Location: Belgium
Distribution: slackware64 14.2, slackware 13.1
Posts: 371

Rep: Reputation: 54
Wireshark doesn't know/doesn't care about iptables. It lists what packets came in through your network interface.
As niels.horn explained, iptables doesn't recognise the packets in question as packets that belong in to a connection.

I suspect they are (because you said the port numbers were in the netstat output)

You asked why iptables marks these packets as invalid. To answer that question, we need to know the context of the connection when the packet was received. Whitout that context, we can only guess (and some people allready did that).

If you want me to help you, maybe you can upload a capture (if you don't consider the transferred info confidential). If you filter it to one connection, the file probably isn't that big. Remember to post which packet is the "invalid" one.

Once you located the "invalid packet" by looking at the arrival time, you right click on it in wireshark. Choose Conversation Filter->TCP. Then stop capturing, and save the displayed packets to a file. (I choose options displayed, all packets, Wireshark/tcpdump/...)

An error from my previous post:
you can choose how wireshark displays time (view->Time Display Format), so there's no need to check the clock when you start capturing.

Last edited by janhe; 04-13-2009 at 05:47 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Router Drops Packets lineman60 Linux - Networking 2 06-17-2008 07:26 PM
Are these INVALID packets? Berhanie Linux - Security 8 07-12-2007 02:12 PM
Forwarding of broadcasts packets on a Linux router zoshr Linux - Networking 2 03-13-2007 07:19 AM
Capturing packets from my WAN/Router {O_o} Linux - Security 4 10-12-2005 04:56 PM
invalid packets in output Roger Krowiak Linux - Security 5 01-29-2005 01:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration