From owner-freebsd-net@freebsd.org Sun May 8 21:35:37 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 823E2B327CD for ; Sun, 8 May 2016 21:35:37 +0000 (UTC) (envelope-from victor.toni@gmail.com) Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com [IPv6:2a00:1450:4010:c07::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06F071BEA; Sun, 8 May 2016 21:35:37 +0000 (UTC) (envelope-from victor.toni@gmail.com) Received: by mail-lf0-x235.google.com with SMTP id u64so182182391lff.3; Sun, 08 May 2016 14:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=iS0n2721rJiZZ43C07GFZaYOze6f5H01tpXIKR4ec+g=; b=ycgULtDcoU5zTIe4psETjTY9d8O1vmBtYGXUArUfywX4y2rT9awhJutP1ap/MRJE4d /dut7jox3Z8LZ7yGZ+Bh23eIpfNOMmmAQ+2J7ed9NnCwcyp9HK1hgqpbpjO02a56lvsU TnZrQjZzejWQgvHU0k/Z3oyb2tzhWlhLk77Ipjsotkdy35piD2fEXSpy2mPtmUo69RuT KixePVLi/sP3QVxK398Njso/xBB7psCmSGtKEBZCwDoV915fsosUAgzqlrRWNsIHhlLC gVd2/UQrKd6YRNGfeIznMe2HxxmewrU77sa2kl8nsF3lQY82tMIhTrQGNPoxq2zGZBbp E84w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=iS0n2721rJiZZ43C07GFZaYOze6f5H01tpXIKR4ec+g=; b=dO+hwA1NjfV6o87ETFHCLVkiUGuM+WfNALsfXDsQgseNcf/1Am4rF8X5/Lp+yd2ZIQ 7b3/d8UXNgXoRm/qMksXAMMA1n+HLEHx6p64xOI65s4lO1Jf2YEte2IqyAYOK40aOs95 xS3kaB78FPrFbbQdvo2x7B9BX2UT6EcftqngEPhWGhFDZVPhQ3zmCgaW2BfdA2Yn+Vco HDpCmg1oWURnBkVhzkGPhSpS14NW2yCmy6O5iUfw+B8U0CTn210ICoTbtebr46s2eg/7 WWqZbKpiU6CnY7uRIXRAUSyqCt6zb99xVdKXok//5tT0oWmDTYDwSZQh+abltp291wzg 00YQ== X-Gm-Message-State: AOPr4FXnEovsj9KsZyggNlKP+UBa8/h2WOYBCmiwvr6ptPZysFktaI94Lon4dEQ9WW857Ojl+fyk7mgu2hWtpg== X-Received: by 10.25.149.84 with SMTP id x81mr4576571lfd.166.1462743333965; Sun, 08 May 2016 14:35:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.20.194 with HTTP; Sun, 8 May 2016 14:35:04 -0700 (PDT) In-Reply-To: References: From: Victor Toni Date: Sun, 8 May 2016 23:35:04 +0200 Message-ID: Subject: Re: setsourcefilter/getsourcefilter missing const qualifier? To: Eric van Gyzen Cc: freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2016 21:35:37 -0000 Thank for the explanation. Changed the code respectively. 2016-05-05 2:23 GMT+02:00 Eric van Gyzen : > On 05/ 3/16 03:50 PM, Victor Toni wrote: > >> When trying to compile some linux-originated code on FreeBSD I get the >> following errors: >> >> /usr/include/netinet/in.h:585:5: note: candidate function not viable: 3rd >> argument ('const sockaddr *') would lose const qualifier >> int setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, >> ^ >> /usr/include/netinet/in.h:587:5: note: candidate function not viable: 3rd >> argument ('const sockaddr *') would lose const qualifier >> int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, >> ^ >> >> the main difference is that the linux version makes guarantees about >> the parameters. >> >> >> Wouldn't it be safe for the FreeBSD version to make the same assumption? >> > > Yes, it would be safe in practice, since the implementation does not > modify those parameters. However, RFC 3678 does not specify them as const, > and neither do illumos (Solaris) and Mac OS X, so code that tries to pass > const parameters is not portable. I would suggest changing the code to > pass non-const parameters. > > Eric >