From owner-freebsd-net@FreeBSD.ORG Fri Mar 9 15:40:12 2012 Return-Path: Delivered-To: freebsd-net@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CB361065673 for ; Fri, 9 Mar 2012 15:40:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5D31C8FC17 for ; Fri, 9 Mar 2012 15:40:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q29FeCMx016171 for ; Fri, 9 Mar 2012 15:40:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q29FeCqR016170; Fri, 9 Mar 2012 15:40:12 GMT (envelope-from gnats) Date: Fri, 9 Mar 2012 15:40:12 GMT Message-Id: <201203091540.q29FeCqR016170@freefall.freebsd.org> To: freebsd-net@FreeBSD.org From: Eric van Gyzen Cc: Subject: Re: kern/165863 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eric van Gyzen List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2012 15:40:12 -0000 The following reply was made to PR kern/165863; it has been noted by GNATS. From: Eric van Gyzen To: Gleb Smirnoff Cc: Eric van Gyzen , , , Subject: Re: kern/165863 Date: Fri, 9 Mar 2012 09:26:51 -0600 --------------000307010007030804050405 Content-Type: text/plain; charset="KOI8-R"; format=flowed Content-Transfer-Encoding: 7bit On 03/09/12 03:20, Gleb Smirnoff wrote: > Hello, Eric and Ed. > > Can you look at this patch? I decided to utilize newer callout API, > that allows to delegate lock retrieval to the callout subsystem, and > this makes things simplier. Hope that should work. > > Patch is against head. Doesn't arptimer() still need to acquire the if_afdata_lock in order to free the entry in the normal case (when the llentry is still in the hash bucket list)? With this patch, in_lltable_prefix_free() no longer guarantees that all the relevant llentries will be freed when it returns. I don't see any immediate breakage, but it's a notable change in behavior. > Eric, can you please send me your test programs, that you use to > reproduce the bug? Attached is a C program to add and remove the interface address. To drive traffic, I just used "ping -f". Thanks for your help. Eric --------------000307010007030804050405 Content-Type: text/plain; name="ifconf.set.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ifconf.set.c" /*- * Copyright (c) 2012 Dell, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int sockfd = -1; struct ifreq ifr; struct sockaddr_in * const sin4 = (struct sockaddr_in *) &ifr.ifr_addr; const char *ifname; struct in_addr addr, mask, brdaddr; unsigned int iterations = 0; bool sigint_received = false; static void report(void) { printf("%u iterations\n", iterations); } static void __dead2 usage() { errx(1, "usage: ifconf [1]"); } static void ifconf(void) { bzero(&ifr, sizeof ifr); strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); sin4->sin_family = AF_INET; sin4->sin_len = sizeof (*sin4); sin4->sin_addr = addr; if (ioctl(sockfd, SIOCDIFADDR, &ifr)) { if (iterations == 0 && errno == EADDRNOTAVAIL) { // OK, it wasn't there when we started. } else { err(1, "SIOCDIFADDR"); } } if (ioctl(sockfd, SIOCSIFADDR, &ifr)) { err(1, "SIOCSIFADDR"); } #if 0 sin4->sin_addr = mask; if (ioctl(sockfd, SIOCSIFNETMASK, &ifr)) { err(1, "SIOCSIFNETMASK"); } sin4->sin_addr = brdaddr; if (ioctl(sockfd, SIOCSIFBRDADDR, &ifr)) { err(1, "SIOCSIFBRDADDR"); } #endif } static void sigint_handler(int signo __unused) { sigint_received = true; } int main(int argc, const char *argv[]) { if (argc != 5 && argc != 6) { usage(); } ifname = argv[1]; if (inet_pton(AF_INET, argv[2], &addr) != 1) { err(1, "inet_pton(%s)", argv[2]); } if (inet_pton(AF_INET, argv[3], &mask) != 1) { err(1, "inet_pton(%s)", argv[3]); } if (inet_pton(AF_INET, argv[4], &brdaddr) != 1) { err(1, "inet_pton(%s)", argv[4]); } sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { err(1, "socket"); } if (argc == 6 && atoi(argv[5]) == 1) { ifconf(); return (0); } atexit(report); signal(SIGINT, sigint_handler); while (!sigint_received) { ifconf(); iterations++; } putchar('\n'); return (0); } --------------000307010007030804050405--