From patchwork Mon Nov 30 22:17:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 550504 X-Patchwork-Delegate: shemminger@vyatta.com 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.180.67]) by ozlabs.org (Postfix) with ESMTP id A5F15140297 for ; Tue, 1 Dec 2015 09:17:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=SNABcFiC; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755234AbbK3WRO (ORCPT ); Mon, 30 Nov 2015 17:17:14 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:33438 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755056AbbK3WRM (ORCPT ); Mon, 30 Nov 2015 17:17:12 -0500 Received: by lfaz4 with SMTP id z4so216581598lfa.0 for ; Mon, 30 Nov 2015 14:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=ZIqqxp9ITocZrztzBt61I50FWsv2TrfxsbzVbODZlts=; b=SNABcFiCoqGvjKc3++BUgkLfRmzRvPIdxtKDhnPjuXnm3tK1duPz9Ucz6O3FBykqrB ohVM5Vwu8GpTYuwyf8n/hwHj2hlP88X14JfVHlqdAs2p4fCiyYPjeoyYky0k6y5dAR9S jaBBM/QPSzIc+7kttbgnaPmHCUGJCyUcq0t8k6UHfMiZC5puJWI4twwZoHUEjF8hnQTE tgNt2/WN/+PAvz9vA9FEN3gMtBMwJs3N/+AEY9mMA/N0shuav8m6w+ck/XFpEb0cm/jd HnI72G/FdJsvx7bGkdWUM1nxmespe/ahQC5g85ZYRY4yutuxCAaAtuD3aDhGAHScR08g i3IA== X-Received: by 10.25.15.22 with SMTP id e22mr26902339lfi.92.1448921830481; Mon, 30 Nov 2015 14:17:10 -0800 (PST) Received: from localhost (ppp79-139-147-94.pppoe.spdop.ru. [79.139.147.94]) by smtp.gmail.com with ESMTPSA id d130sm7761036lfe.18.2015.11.30.14.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2015 14:17:09 -0800 (PST) Subject: [PATCH] ip neigh: device is optional for proxy entries From: Konstantin Khlebnikov To: netdev@vger.kernel.org Date: Tue, 01 Dec 2015 01:17:06 +0300 Message-ID: <144892182676.2301.1460574558873523132.stgit@zurg> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Though dumping such entries crashes present kernels. Signed-off-by: Konstantin Khlebnikov --- ip/ipneigh.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ip/ipneigh.c b/ip/ipneigh.c index 54655842ed38..92b7cd6f2a75 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -100,8 +100,9 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv) struct ndmsg ndm; char buf[256]; } req; - char *d = NULL; + char *dev = NULL; int dst_ok = 0; + int dev_ok = 0; int lladdr_ok = 0; char * lla = NULL; inet_prefix dst; @@ -135,10 +136,12 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv) duparg("address", *argv); get_addr(&dst, *argv, preferred_family); dst_ok = 1; + dev_ok = 1; req.ndm.ndm_flags |= NTF_PROXY; } else if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); - d = *argv; + dev = *argv; + dev_ok = 1; } else { if (strcmp(*argv, "to") == 0) { NEXT_ARG(); @@ -153,7 +156,7 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv) } argc--; argv++; } - if (d == NULL || !dst_ok || dst.family == AF_UNSPEC) { + if (!dev_ok || !dst_ok || dst.family == AF_UNSPEC) { fprintf(stderr, "Device and destination are required arguments.\n"); exit(-1); } @@ -175,8 +178,8 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv) ll_init_map(&rth); - if ((req.ndm.ndm_ifindex = ll_name_to_index(d)) == 0) { - fprintf(stderr, "Cannot find device \"%s\"\n", d); + if (dev && (req.ndm.ndm_ifindex = ll_name_to_index(dev)) == 0) { + fprintf(stderr, "Cannot find device \"%s\"\n", dev); return -1; }