From patchwork Thu Sep 18 17:00:39 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Shemer X-Patchwork-Id: 538 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 2D8F9DE10A for ; Fri, 19 Sep 2008 03:00:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754325AbYIRRAm (ORCPT ); Thu, 18 Sep 2008 13:00:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754110AbYIRRAl (ORCPT ); Thu, 18 Sep 2008 13:00:41 -0400 Received: from mail-gx0-f16.google.com ([209.85.217.16]:49809 "EHLO mail-gx0-f16.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753833AbYIRRAl (ORCPT ); Thu, 18 Sep 2008 13:00:41 -0400 Received: by gxk9 with SMTP id 9so31509012gxk.13 for ; Thu, 18 Sep 2008 10:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=IdNHK2hJMav9L7J3P2exFe3aIn0+/9t1lTBxr1paDjI=; b=jAH1evxYldvYh/4B+7l+EkI8XaF7V1jGgCOSzj+bZxsYhTpcxERzgpzSLZXLUQj7mf uClVVhpiL6fUo921R8/oL4tp1MP/5/9yoQE32hAgAw7VHrf2yaIAo1CVNidQJEb1XshC ZdoF/ypSkZHUeNYsYMP0ifTQLvqcpckiECVRQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=rl5SLDDJPV2KykmykcHeK/+DigJIKstqvSQlRaKpnzF0ZhKpMZJbrYKBOdNYS+OlBj UygwSon0a7IaZ9OCnx4gCobGRAt9KHjMBqlupKzznkfLLLPxXDQ1Ua7t8UCVMDEBZnK8 35+NO8LKAJkuiCNVSRjDdCYUSRc7fGTfNa3Dk= Received: by 10.142.214.11 with SMTP id m11mr1508618wfg.69.1221757239745; Thu, 18 Sep 2008 10:00:39 -0700 (PDT) Received: by 10.142.14.2 with HTTP; Thu, 18 Sep 2008 10:00:39 -0700 (PDT) Message-ID: Date: Thu, 18 Sep 2008 20:00:39 +0300 From: "Nadav Shemer" Reply-To: nadav@camelot.myftp.org To: netdev@vger.kernel.org Subject: iputils: ping.c - using -I for both interface and address MIME-Version: 1.0 Content-Disposition: inline Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When I use 'ping 1.2.3.4 -I eth1 -I 2.3.4.5' the packets come out with eth1's address anyway. It seems to me that IP_PKTINFO is set for every packet, with ipi_spec_dst set to 0. This overrides the inet->saddr set by bind. Here's a fix: --- ping.c 2007-11-27 02:57:27.000000000 +0200 +++ ping.c.patched 2008-09-18 19:59:45.000000000 +0300 @@ -350,6 +350,8 @@ fprintf(stderr, "ping: unknown iface %s\n", device); exit(2); } + if (options & F_STRICTSOURCE) + cmsg.ipi.ipi_spec_dst.s_addr = source.sin_addr.s_addr; cmsg.ipi.ipi_ifindex = ifr.ifr_ifindex; cmsg_len = sizeof(cmsg); }