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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:11:14+00:00 2026-05-18T05:11:14+00:00

Follow-up of question packet fragmentation for raw sockets If I have a raw socket

  • 0

Follow-up of question packet fragmentation for raw sockets

If I have a raw socket implemented as such:

  if ((sip_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
      {
    cout << "Unable to create the SIP sockets."<< sip_socket<<" \n";
    return -3;
      }

   if ( setsockopt(sip_socket, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one)) == -1)
      {
   cerr << "Unable to set option to Raw Socket.\n";
   return -4;
      };  

how can I set the ipHdr->fragment_offset (16 bits including 3 bit flags) if I have a packet of size 1756 (not including the IP header)?
Do I need to prepare two packets-one of size 1480 and another of size 276, and then slap IP headers on both packets?

Can anyone point to an example code for this?

  • 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-18T05:11:14+00:00Added an answer on May 18, 2026 at 5:11 am

    Yes, you need to prepare two packets, each with their own IP header.

    If you put 1480 bytes of data in the first packet and 276 in the second, then the IP headers should be identical, except for these fields:

    • Fragment Offset: set to 0 in the first packet, and 1480 in the second;
    • Total Length: set to 1480 plus the header length in the first packet, and 276 plus the header length in the second packet;
    • MF flag: set to 1 in the first packet and 0 in the second;
    • Header Checksum: Recalculated over the different headers as appropriate.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a follow-up question to this one . I created a new form,
I have a follow up question to this question . Is it possible to
This is a follow-up question to this: Rebuilding a packet to inject via pcap
guys! I have follow question. I am writing an application that will track movement
Follow up question to this: Linq Combine Left Join Data Say I have the
I have a follow up question to this solution to extending java enums. How
This is a follow-up question to Combinatorics in Python I have a tree or
I have a follow-on question to How to display an image based on SelectedValue
I have a follow up question on the accepted answer given here: Two models
I have a follow up question from my original Django serving question which was

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.