From owner-svn-src-head@FreeBSD.ORG Thu Feb 19 16:30:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F9A51065676; Thu, 19 Feb 2009 16:30:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F20888FC13; Thu, 19 Feb 2009 16:30:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1JGUBeB002371; Thu, 19 Feb 2009 16:30:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1JGUBU6002370; Thu, 19 Feb 2009 16:30:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200902191630.n1JGUBU6002370@svn.freebsd.org> From: Warner Losh Date: Thu, 19 Feb 2009 16:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188820 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 16:30:13 -0000 Author: imp Date: Thu Feb 19 16:30:11 2009 New Revision: 188820 URL: http://svn.freebsd.org/changeset/base/188820 Log: Properly convert bit value to a bit field. Before we were storing values like 0x80 or 0x40 into a uint8_t foo:1 bitfield. This would result in the bit always being 0. One of these caused a warning for overflow (one that was 0x80), but the other didn't. They were both wrong. This is why I hate code that mixes c struct bitfields and #defines. The rest of the fields accessed by the program should be audited. Modified: head/usr.sbin/rtadvd/rrenum.c Modified: head/usr.sbin/rtadvd/rrenum.c ============================================================================== --- head/usr.sbin/rtadvd/rrenum.c Thu Feb 19 16:16:44 2009 (r188819) +++ head/usr.sbin/rtadvd/rrenum.c Thu Feb 19 16:30:11 2009 (r188820) @@ -176,9 +176,9 @@ do_use_prefix(int len, struct rr_pco_mat irr->irr_u_uselen = rpu->rpu_uselen; irr->irr_u_keeplen = rpu->rpu_keeplen; irr->irr_raf_mask_onlink = - (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK); + !!(rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK); irr->irr_raf_mask_auto = - (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO); + !!(rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO); irr->irr_vltime = ntohl(rpu->rpu_vltime); irr->irr_pltime = ntohl(rpu->rpu_pltime); irr->irr_raf_onlink =