• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: IP_HDRINCL fails on Intel-Mac
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IP_HDRINCL fails on Intel-Mac


  • Subject: Re: IP_HDRINCL fails on Intel-Mac
  • From: Vincent Lubet <email@hidden>
  • Date: Thu, 28 Dec 2006 13:49:25 -0800

Stephanie,

Duane is right, this is most likely a byte swapping issue.

The man page ip(4) is wrong when it says "the ip_off and ip_len fields are in network byte order". In fact they must be in host byte order.

The man page ip(4) is fixed in Leopard.

Vincent

On Dec 28, 2006, at 1:25 PM, Duane Murphy wrote:

Total shot in the dark, but what about byte swapping?

On PPC the bytes are already in network order on Intel they have to be
swapped.

I have also read reports that some fields have to be swapped while
others don't. (Seems like a nasty bug.) I don't know if that applies to
your situation or not. I would expect tech notes or some such on the
Apple site.


Just a thought.
 ...Duane

--- At Thu, 28 Dec 2006 21:57:04 +0100, Stephanie Wist wrote:


Hello,

I have encountered a strange problem: I'm using raw sockets (
socket(AF_INET, SOCK_RAW, IPPROTO_RAW) ) with the option IP_HDRINCL set
to 1. ( setsockopt(sock, 0, IP_HDRINCL, &one, sizeof(one) ). This works
fine for me on my Powerbook running on Jaguar and Panther, but fails on
a new MacbookPro when calling sendto() with EINVAL.


I'm pretty sure that my self-built IP-header is correct, I compared the
packet-data before sending and they were the same on the Powerbook and
the MacbookPro.


Am I overlooking something? Is the option IP_HDRINCL disabled by
purpose on the new Macs, as it is on WinXP (although the manpages state
otherwise)?
Or has anyone a functioning code snippet using raw sockets with
IP_HDRINCL on a MacbookPro?



Wondering, - Stephanie Wist

...Duane

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >IP_HDRINCL fails on Intel-Mac (From: Stephanie Wist <email@hidden>)
 >Re: IP_HDRINCL fails on Intel-Mac (From: "Duane Murphy" <email@hidden>)

  • Prev by Date: Re: IP_HDRINCL fails on Intel-Mac
  • Next by Date: Re: IP_HDRINCL fails on Intel-Mac
  • Previous by thread: Re: IP_HDRINCL fails on Intel-Mac
  • Next by thread: Re: IP_HDRINCL fails on Intel-Mac
  • Index(es):
    • Date
    • Thread