Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy network headers in ss_skb_split() #1100

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

i-rinat
Copy link
Contributor

@i-rinat i-rinat commented Nov 14, 2018

With HTTP request pipelining, multiple requests can fit into a single network packet, and so end up sharing the same struct sk_buff. In that case, after processing the first request, struct sk_buff is split into two, with remaining data going into another sk_buff. However, newly created struct sk_buff has no IP header, albeit has enough room reserved. That causes ss_skb_fmt_src_addr() used in address extraction for X-Forwarded-For header field, to use uninitialized data.

The patch adds needed header copying.

(related to #1099)

We need to copy network headers from the original skb to the newly
allocated remainder, as ss_skb_fmt_src_addr() expects at least IP headers.
@i-rinat i-rinat requested a review from vankoven November 14, 2018 22:56
Copy link
Contributor

@vankoven vankoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Please, backport the fix to 0.5.

Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@i-rinat i-rinat merged commit c662213 into master Nov 15, 2018
@i-rinat i-rinat deleted the ri-copy-network-headers-in-ss-skb-split branch November 15, 2018 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants