Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bind() not working for outbound socket connections...




On May 22, 2005, at 3:56 AM, Philip George wrote:


On May 22, 2005, at 3:43 AM, Giuliano Gavazzi wrote:


well, would it not be enough to add manually a route for the particular remote ip/net going through the dead router (and thus the interface he wants)?



now THIS is the kind of thinking it's gonna take to get this working!

great suggestion, and creative.

it requires that my app will have to be set to run as root unfortunately, but at this point i'm desperate.

plus, i've buttoned up all possible places where buffers are flooded with user input. everything's bounds-checked.


i have a couple of questions about this suggestion:

[1] if i add a route, how do i make sure that the new
    route is chosen and nothing else?

The routing engine picks the route that is the more specific for the destination address. A host route is the more specific kind of route, so simply add a host route with the IP address of the dead router.


[2] after using it, does the route need to be removed
    explicitly, or is closing the socket i used thru it
    enough?

You need to remove the route yourself, there is no connection between the socket layer and the routing table.


[3] does adding a new route or deleting a route only
    apply to the context of my app or does it affect
    the entire system?

It's a system wide setting (that's why it's a privileged operation)

[4] i have already played with this a little, but the
    examples i'm going off of are a little over-the-top.
    if you know of a simple example of how this is done
    in C, please post a link.

I suggest to have a look at the source code of the "route" command in Darwin or FreeBSD repository.




and by the way, Giuliano, thanks for actually helping out instead of talking down to me and then giving me a reading assignment. i've been plagued with unhelpful responses on this issue on three lists... mostly from the same guy chasing me from list to list.

Because you have out of the ordinary requirements you really need to understand what you are doing especially when changing system wide settings.


Vincent

Giuliano, you rock.

- philip






_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >bind() not working for outbound socket connections... (From: Philip George <email@hidden>)
 >Re: bind() not working for outbound socket connections... (From: Justin Walker <email@hidden>)
 >Re: bind() not working for outbound socket connections... (From: Giuliano Gavazzi <email@hidden>)
 >Re: bind() not working for outbound socket connections... (From: Philip George <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.