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 7525589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:35:35+00:00 2026-05-30T03:35:35+00:00

i have made a module using hook function . its working but when i

  • 0

i have made a module using hook function . its working but when i use ping google.com.i am getting 0045 as icmp type .But i think it should be 0 for echo reply. i had used following print command:

unsigned int hook_func(unsigned int hooknum, struct sk_buff *skb1, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *))
{
struct sk_buff *sock_buff;
 struct iphdr *ip1;
 struct icmphdr *icmp1;
 sock_buff = skb1;
//printk("ihere we are::%s,%d\n",__func__,__LINE__);
   ip1 = (struct iphdr *)skb_network_header(sock_buff);
 printk(KERN_ALERT"proto:%d\n",ip1->protocol);
if(ip1->protocol==1)
{
 icmp1 = (struct icmphdr *)skb_transport_header(sock_buff);
printk(KERN_ALERT"reply type: %04X,,seq : %04X\n",icmp1->type,icmp1->un.echo.id);
       }
// kfree(sock_buff);
return NF_ACCEPT;

  }

icmp1->type is __be16.

  • 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-30T03:35:36+00:00Added an answer on May 30, 2026 at 3:35 am

    Replace icmp1 = (struct icmphdr *)skb_transport_header(sock_buff); with

    icmp1 = (struct icmphdr *)(skb_transport_header(sock_buff) + ip_hdrlen(sock_buff));

    icmpheader->type is an unsigned char, try

    printk(KERN_ALERT"reply type: %u,,seq : %04X\n",icmp1->type,icmp1->un.echo.id);

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

Sidebar

Related Questions

i have made a module which aims to send the ping packet using ioctl
On my Drupal site, I have made a Users page using the Views module,
I have made a web app where I am using a module which redirects
I have a custom module I made for Magento. From the admin, there is
I have a custom module I made to show featured products on the homepage.
I have made a new windows service which works fine using barebone code (just
I have my own content type made in my module. It has text and
I have a Test::More test script for a module we have made. When running
I'm in Visual Studio 2003. I have a function in a very common module
I am using a Joomla module (ArogaRousel) that was made to display images of

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.