Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7444893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:36:35+00:00 2026-05-29T11:36:35+00:00

I am trying to handle simple packet inspection with netfilter hooks. Declaration seems fairly

  • 0

I am trying to handle simple packet inspection with netfilter hooks.

Declaration seems fairly straightforward:

unsigned int hook_func(unsigned int hooknum, struct sk_buff *skb, 
            const struct net_device *in,
            const struct net_device *out, int (*okfn)(struct sk_buff *))
{

     struct iphdr *iph = (struct iphdr *)skb_network_header(skb);

}

And I can access the protocol portion of the network header

iph->protocol == IPPROTO_TCP

However

iph->saddr

Fails. Any suggestions? I feel as this is a fairly simple error on my part, but all the examples follow either this method or they simply use

struct iphdr *iph = ip_hdr(skb);

I get the same behavior with both methods. I have looked through skbuff.h for any clues but havn’t had any luck.

EDIT:

Could this have to do with they way I am accessing it? Right now for debugging I am merely trying to print the value out using:

printk(KERN_DEBUG "%pI4", iph->saddr);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:36:36+00:00Added an answer on May 29, 2026 at 11:36 am

    %pI4 takes an address, so you are reading possibly invalid memory. Use &iph->saddr instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to handle a simple case where i could be getting an
I'm trying to figure out the best way to handle a simple problem: I
I'm trying to figure out a simple way to handle reliability for UDP messages.
I have a simple array that I am trying to handle. It consists of
I'm trying handle bad json data when parsed through json_decode(). I'm using the following
I'm trying to handle Winsock_Connect event (Actually I need it in Excel macro) using
I'm trying to handle this possible exploit and wondering what is the best way
I'm trying to handle the possibility that no arguments and no piped data is
I've been trying to handle the onkeydown event across multiple frames (no, I unfortunately
I am trying to handle the click of custom button in a jqgrid. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.