Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34535
b: refs/heads/master
c: ce556b3
h: refs/heads/master
i:
  34533: 399f95b
  34531: b13dd4a
  34527: 1ce52e9
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 22, 2006
1 parent 3bee1ff commit d851775
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5fa2a7601f994bdd034e871b7ea1abd6969fbb6c
refs/heads/master: ce556b3a591fff3bebf8c5590a86aa98e1b2f153
48 changes: 18 additions & 30 deletions trunk/net/netfilter/xt_tcpmss.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv6/ip6_tables.h>

#define TH_SYN 0x02

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
MODULE_DESCRIPTION("iptables TCP MSS match module");
MODULE_ALIAS("ipt_tcpmss");

/* Returns 1 if the mss option is set and matched by the range, 0 otherwise */
static inline int
mssoption_match(u_int16_t min, u_int16_t max,
const struct sk_buff *skb,
unsigned int protoff,
int invert,
int *hotdrop)
static int
match(const struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
{
const struct xt_tcpmss_match_info *info = matchinfo;
struct tcphdr _tcph, *th;
/* tcp.doff is only 4 bits, ie. max 15 * 4 bytes */
u8 _opt[15 * 4 - sizeof(_tcph)], *op;
Expand Down Expand Up @@ -64,35 +65,22 @@ mssoption_match(u_int16_t min, u_int16_t max,

mssval = (op[i+2] << 8) | op[i+3];

return (mssval >= min && mssval <= max) ^ invert;
return (mssval >= info->mss_min &&
mssval <= info->mss_max) ^ info->invert;
}
if (op[i] < 2) i++;
else i += op[i+1]?:1;
if (op[i] < 2)
i++;
else
i += op[i+1] ? : 1;
}
out:
return invert;
return info->invert;

dropit:
dropit:
*hotdrop = 1;
return 0;
}

static int
match(const struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
const struct xt_match *match,
const void *matchinfo,
int offset,
unsigned int protoff,
int *hotdrop)
{
const struct xt_tcpmss_match_info *info = matchinfo;

return mssoption_match(info->mss_min, info->mss_max, skb, protoff,
info->invert, hotdrop);
}

static struct xt_match xt_tcpmss_match[] = {
{
.name = "tcpmss",
Expand Down

0 comments on commit d851775

Please sign in to comment.