Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Browse files Browse the repository at this point in the history
Pablo Neira Ayuso says:

====================
Netfilter fixes for net

The following patchset contains Netfilter fixes for net:

1) Do not update the UDP checksum when it's zero, from Guillaume Nault.

2) Fix return of local variable in nf_osf, from Arnd Bergmann.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed May 1, 2020
2 parents c778980 + c165d57 commit b6f875a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions net/netfilter/nf_nat_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@ static bool udp_manip_pkt(struct sk_buff *skb,
enum nf_nat_manip_type maniptype)
{
struct udphdr *hdr;
bool do_csum;

if (skb_ensure_writable(skb, hdroff + sizeof(*hdr)))
return false;

hdr = (struct udphdr *)(skb->data + hdroff);
do_csum = hdr->check || skb->ip_summed == CHECKSUM_PARTIAL;
__udp_manip_pkt(skb, iphdroff, hdr, tuple, maniptype, !!hdr->check);

__udp_manip_pkt(skb, iphdroff, hdr, tuple, maniptype, do_csum);
return true;
}

Expand Down
12 changes: 7 additions & 5 deletions net/netfilter/nfnetlink_osf.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ static bool nf_osf_match_one(const struct sk_buff *skb,
static const struct tcphdr *nf_osf_hdr_ctx_init(struct nf_osf_hdr_ctx *ctx,
const struct sk_buff *skb,
const struct iphdr *ip,
unsigned char *opts)
unsigned char *opts,
struct tcphdr *_tcph)
{
const struct tcphdr *tcp;
struct tcphdr _tcph;

tcp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(struct tcphdr), &_tcph);
tcp = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(struct tcphdr), _tcph);
if (!tcp)
return NULL;

Expand Down Expand Up @@ -205,10 +205,11 @@ nf_osf_match(const struct sk_buff *skb, u_int8_t family,
int fmatch = FMATCH_WRONG;
struct nf_osf_hdr_ctx ctx;
const struct tcphdr *tcp;
struct tcphdr _tcph;

memset(&ctx, 0, sizeof(ctx));

tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts);
tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts, &_tcph);
if (!tcp)
return false;

Expand Down Expand Up @@ -265,10 +266,11 @@ bool nf_osf_find(const struct sk_buff *skb,
const struct nf_osf_finger *kf;
struct nf_osf_hdr_ctx ctx;
const struct tcphdr *tcp;
struct tcphdr _tcph;

memset(&ctx, 0, sizeof(ctx));

tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts);
tcp = nf_osf_hdr_ctx_init(&ctx, skb, ip, opts, &_tcph);
if (!tcp)
return false;

Expand Down

0 comments on commit b6f875a

Please sign in to comment.