Network Interface for a Given Destination Address
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; b=R6vD47a8P2sruZQymGcrEN6M/MXUtgYKWEgCa3mMoaF0OnMtdw1KNKgeGU2aPnwf/XELqZWEH/g3KQhFIT5ylkKWRACWnPHX1QG5XcUSZatS5iwsxetOlKGuxbVA9FqpXpSvEcVbV+oybU4WLYG1FE6rbXBcdGuE0Q551TbG5JU= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; b=eS4M79OJHTIDx6NQC1hdf+MlzziEIfb1n5ZG0pxPA51EjXw0vm/ReJhGmE9JlgMFx/9Pz9goNR8lvv+3C7guHAtkMZzKTv+tdbMqaaIOvyzCIUlFL1aHFfJIzTFOLC2krKjfPJlrieeTAZa/VzUPr75WKnh1SN5OXN/nWePVpgo= Thanks. -- Curtis Jones curtis.jones@gmail.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com I'm trying to determine the ethernet interface (en0, en1, etc.) that will be used for a given destination ip address. I've tried using ifaddr_withdstaddr() and ifaddr_withnet() and I can get the correct result for addresses that are local to the machine and for those that are on the same subnet as one of the ethernet interfaces for the machine. So, that's part of the solution, but not all of it. I looked at ifaddr_findbestforaddr(), thinking that it might return NULL if that the given interface wasn't useful for that address, but if I'm reading the source code for ifaof_ifpforaddr() correctly, it doesn't touch the routing tables and it simply returns the first address entry if none of them match. So, I'm guessing I need to specifically find the interface for the default route if _withdstaddr() / _withnet() don't help. Is this the correct approach? And how would I go about doing that? smime.p7s
participants (1)
-
Jones Curtis