From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54070 invoked by alias); 23 Feb 2016 15:59:12 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 53959 invoked by uid 89); 23 Feb 2016 15:59:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=reran, Unless, experimentation, examination X-HELO: plane.gmane.org Received: from plane.gmane.org (HELO plane.gmane.org) (80.91.229.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 23 Feb 2016 15:59:10 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aYFMg-0002Qt-Lz for ecos-discuss@ecos.sourceware.org; Tue, 23 Feb 2016 16:59:06 +0100 Received: from 67-130-15-94.dia.static.qwest.net ([67.130.15.94]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Feb 2016 16:59:06 +0100 Received: from grant.b.edwards by 67-130-15-94.dia.static.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Feb 2016 16:59:06 +0100 To: ecos-discuss@ecos.sourceware.org From: Grant Edwards Date: Tue, 23 Feb 2016 15:59:00 -0000 Message-ID: References: <56CACBE1.6040103@televic.com> <56CC139C.4080601@televic.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User-Agent: slrn/1.0.2 (Linux) X-IsSubscribed: yes Subject: [ECOS] Re: Does FreeBSD stack support multiple IP addresses? X-SW-Source: 2016-02/txt/msg00007.txt.bz2 On 2016-02-23, Lambrecht Jürgen wrote: > On 02/22/2016 04:05 PM, Grant Edwards wrote: >> When I tried it, the SIOCAIFADDR ioctl() let me set both address and >> netmask in a single call. The "case SIOCAIFADDR" code falls through >> into SIOCSIFNETMASK code. That didn't work for you? > > Indeed, I remember now that I saw that in the code, but then you have > the netmask according to the class A/B/C rules, and that is not what we > want. > >>> - It is only possible to assign a class A/B/C netmask. CIDR netmasks are >>> not possible. >> I think that's always been the case for this version of the stack, >> hasn't it? > Indeed. I just re-ran my tests and verified again that I'm able to set the IP and netmask in a single call to ioctl(SIOCAIFADDR). In my tests, I tried: Address Netmask ----------- -------------- 11.0.0.104 255.0.0.0 11.0.0.104 255.255.0.0 11.0.0.104 255.255.255.0 11.0.0.104 255.240.0.0 11.0.0.104 240.0.0.0 192.168.222.104 240.0.0.0 192.168.222.104 255.0.0.0 192.168.222.104 255.240.0.0 192.168.222.104 255.255.0.0 192.168.222.104 255.255.240.0 192.168.222.104 255.255.255.0 192.168.222.104 255.255.255.240 In all cases, subsequent calls to show_network_tables() showed the IP address and netmask I requested in the ioctl() call and the correct corresponding broadcast address. I'm using an eCos snapshot from 2014. >>> I fixed current/src/sys/netinet/in.c for it, but I also adapted >>> the ioctl to combine setting IP address and netmask in 1 call >>> (so I cannot commit it back). Let me know if you want my fix. The current SIOCAIFADDR code works fine for me. > I changed a bit the use of the members of the "inet"-something > struct (in the ioctl call) to also use the netmask struct member > that is already in it. Because normally, when you call ioctl > SIOCSIFNETMASK separately, you specify the netmask in the same > struct member where you put the IP address for the SIOCAIFADDR call. But the SIOCAIFADDR call as a _separate_ place where you put the desired netmask, and AFIACT, that works. > (I did a fast search in the linux code, but I am not used to that, > so I did not find the "Linux way") > >> I'm confused: based on my experiments and examination of the source >> code, it already works that way. >> > Well, it is both. Indeed, as you say above, "code falls through > into SIOCSIFNETMASK code", > but then it sets "the netmask according to the class A/B/C rules", > so the netmask is _calculated_, not strictly _set_. I am completely > sure about this, I read that whole code part. (And my collegues did > the experimentation to set a 255.248.0.0 netmask resulting in a > 255.255.0.0 mask for 172.24.0.0 which is class B) I don't know what to tell you other than "it works fine for me". Unless the output from show_network_tables() is wrong... -- Grant Edwards grant.b.edwards Yow! Give them RADAR-GUIDED at SKEE-BALL LANES and gmail.com VELVEETA BURRITOS!! -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss