From owner-freebsd-sparc Thu Oct 24 2:15:38 2002 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC7F937B401 for ; Thu, 24 Oct 2002 02:15:31 -0700 (PDT) Received: from cc-gw.1anetworks.net (cc-gw.1anetworks.net [193.243.179.83]) by mx1.FreeBSD.org (Postfix) with SMTP id 9BE7F43E42 for ; Thu, 24 Oct 2002 02:15:30 -0700 (PDT) (envelope-from brian@ukip.com) Received: from BRI (brian.1anetworks.net [212.36.98.200]) by parma.1anetworks.net (8.9.3+Sun/8.9.3) with SMTP id KAA08517 for ; Thu, 24 Oct 2002 10:15:19 +0100 (BST) From: "Bri" To: Subject: Compile from recent sources Date: Thu, 24 Oct 2002 10:12:11 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org with options IPDIVERT in the kernel I get %make -DNO_WERROR /arch/sparc64/hosted/bin/gcc -c -O -pipe -Wall -Wredundant-decls -Wnested-e xterns -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -W cast-qual -ansi -g -nostdinc -I- -I. -I../../.. -I../../../dev -I../../../ contrib/dev/acpica -I../../../contrib/ipfilter -D_KERNEL -include opt_global.h -mcmodel=medlow -msoft-float -fno-common -ffreestanding -Werro r ../../../netinet/ip_divert.c cc1: warnings being treated as errors ../../../netinet/ip_divert.c: In function `div_output': ../../../netinet/ip_divert.c:280: warning: cast to pointer from integer of different size *** Error code 1 Stop in /GXP120/ncvs/sys/sparc64/compile/ROUTERSPARC6420021003. the version that compiles ok when compiling from the old sources is the version 1.61 the new one produces the error above when compiling from the lastest sources. any idea's here's the diff. Bri, %diff ../../../netinet/ip_divert.c /GXP120/users/root/src/sys/netinet/ip_divert.c 33c33 < * $FreeBSD: src/sys/netinet/ip_divert.c,v 1.68 2002/10/16 01:54:44 sam Exp $ --- > * $FreeBSD: src/sys/netinet/ip_divert.c,v 1.61 2002/05/31 11:52:32 tanimura Exp $ 40d39 < #include "opt_mac.h" 50d48 < #include 84,91c82,84 < * Divert sockets work in conjunction with ipfw, see the divert(4) < * manpage for features. < * Internally, packets selected by ipfw in ip_input() or ip_output(), < * and never diverted before, are passed to the input queue of the < * divert socket with a given 'divert_port' number (as specified in < * the matching ipfw rule), and they are tagged with a 16 bit cookie < * (representing the rule number of the matching ipfw rule), which < * is passed to process reading from the socket. --- > * A 16 bit cookie is passed to and from the user process. > * The user process can send it back to help the caller know > * something about where the packet originally came from. 93,98c86,90 < * Packets written to the divert socket are again tagged with a cookie < * (usually the same as above) and a destination address. < * If the destination address is INADDR_ANY then the packet is < * treated as outgoing and sent to ip_output(), otherwise it is < * treated as incoming and sent to ip_input(). < * In both cases, the packet is tagged with the cookie. --- > * In the case of ipfw, then the cookie is the rule that sent > * us here. On reinjection is is the rule after which processing > * should continue. Leaving it the same will make processing start > * at the rule number after that which sent it here. Setting it to > * 0 will restart processing at the beginning. 100,104c92,93 < * On reinjection, processing in ip_input() and ip_output() < * will be exactly the same as for the original packet, except that < * ipfw processing will start at the rule number after the one < * written in the cookie (so, tagging a packet with a cookie of 0 < * will cause it to be effectively considered as a standard packet). --- > * For divert_packet(), ip_divert_cookie is an input value only. > * For div_output(), ip_divert_cookie is an output value only. 105a95 > u_int16_t ip_divert_cookie; 116a107,110 > /* Internal functions */ > static int div_output(struct socket *so, > struct mbuf *m, struct sockaddr *addr, struct mbuf *control); > 123d116 < INP_INFO_LOCK_INIT(&divcbinfo, "div"); 156c149 < divert_packet(struct mbuf *m, int incoming, int port, int rule) --- > divert_packet(struct mbuf *m, int incoming, int port) 166c159,161 < divsrc.sin_port = rule; /* record matching rule */ --- > /* Record and reset divert cookie */ > divsrc.sin_port = ip_divert_cookie; > ip_divert_cookie = 0; 170c165 < (m = m_pullup(m, sizeof(struct ip))) == 0) --- > (m = m_pullup(m, sizeof(struct ip))) == 0) { 171a167 > } 252,254c248,256 < div_output(struct socket *so, struct mbuf *m, < struct sockaddr_in *sin, struct mbuf *control) < { --- > div_output(so, m, addr, control) > struct socket *so; > register struct mbuf *m; > struct sockaddr *addr; > struct mbuf *control; > { > register struct inpcb *const inp = sotoinpcb(so); > register struct ip *const ip = mtod(m, struct ip *); > struct sockaddr_in *sin = (struct sockaddr_in *)addr; 256,271d257 < struct m_hdr divert_tag; < < /* < * Prepare the tag for divert info. Note that a packet < * with a 0 tag in mh_data is effectively untagged, < * so we could optimize that case. < */ < divert_tag.mh_type = MT_TAG; < divert_tag.mh_flags = PACKET_TAG_DIVERT; < divert_tag.mh_next = m; < divert_tag.mh_data = 0; /* the matching rule # */ < m->m_pkthdr.rcvif = NULL; /* XXX is it necessary ? */ < < #ifdef MAC < mac_create_mbuf_from_socket(so, m); < #endif 278c264,267 < int i; --- > int len = 0; > char *c = sin->sin_zero; > > ip_divert_cookie = sin->sin_port; 280d268 < divert_tag.mh_data = (caddr_t)(int)sin->sin_port; 282,285c270,276 < * Find receive interface with the given name, stuffed < * (if it exists) in the sin_zero[] field. < * The name is user supplied data so don't trust its size < * or that it is zero terminated. --- > * Find receive interface with the given name or IP address. > * The name is user supplied data so don't trust it's size or > * that it is zero terminated. The name has priority. > * We are presently assuming that the sockaddr_in > * has not been replaced by a sockaddr_div, so we limit it > * to 16 bytes in total. the name is stuffed (if it exists) > * in the sin_zero[] field. 287,289c278,279 < for (i = 0; sin->sin_zero[i] && i < sizeof(sin->sin_zero); i++) < ; < if ( i > 0 && i < sizeof(sin->sin_zero)) --- > while (*c++ && (len++ < sizeof(sin->sin_zero))); > if ((len > 0) && (len < sizeof(sin->sin_zero))) 290a281,282 > } else { > ip_divert_cookie = 0; 295,297d286 < struct inpcb *const inp = sotoinpcb(so); < struct ip *const ip = mtod(m, struct ip *); < 314,318c303,306 < error = ip_output((struct mbuf *)&divert_tag, < inp->inp_options, &inp->inp_route, < (so->so_options & SO_DONTROUTE) | < IP_ALLOWBROADCAST | IP_RAWOUTPUT, < inp->inp_moptions, NULL); --- > error = ip_output(m, inp->inp_options, &inp->inp_route, > (so->so_options & SO_DONTROUTE) | > IP_ALLOWBROADCAST | IP_RAWOUTPUT, > inp->inp_moptions); 319a308,310 > struct ifaddr *ifa; > > /* If no luck with the name above. check by IP address. */ 322,324c313,315 < * No luck with the name, check by IP address. < * Clear the port and the ifname to make sure < * there are no distractions for ifa_ifwithaddr. --- > * Make sure there are no distractions > * for ifa_ifwithaddr. Clear the port and the ifname. > * Maybe zap all 8 bytes at once using a 64bit write? 326,327d316 < struct ifaddr *ifa; < 328a318 > /* *((u_int64_t *)sin->sin_zero) = 0; */ /* XXX ?? */ 330,331c320 < ifa = ifa_ifwithaddr((struct sockaddr *) sin); < if (ifa == NULL) { --- > if (!(ifa = ifa_ifwithaddr((struct sockaddr *) sin))) { 336a326 > 338c328 < ip_input((struct mbuf *)&divert_tag); --- > ip_input(m); 340a331,333 > /* paranoid: Reset for next time (and other packets) */ > /* almost definitly already done in the ipfw filter but.. */ > ip_divert_cookie = 0; 344a338 > ip_divert_cookie = 0; 414c408 < /* in_pcbbind assumes that nam is a sockaddr_in --- > /* in_pcbbind assumes that the socket is a sockaddr_in 421c415 < if (nam->sa_family != AF_INET) --- > if (nam->sa_family != AF_INET) { 423c417 < else { --- > } else { 451c445 < return div_output(so, m, (struct sockaddr_in *)nam, control); --- > return div_output(so, m, nam, control); 537,557d530 < /* < * This is the wrapper function for in_setsockaddr. We just pass down < * the pcbinfo for in_setpeeraddr to lock. < */ < static int < div_sockaddr(struct socket *so, struct sockaddr **nam) < { < return (in_setsockaddr(so, nam, &divcbinfo)); < } < < /* < * This is the wrapper function for in_setpeeraddr. We just pass down < * the pcbinfo for in_setpeeraddr to lock. < */ < static int < div_peeraddr(struct socket *so, struct sockaddr **nam) < { < return (in_setpeeraddr(so, nam, &divcbinfo)); < } < < 565c538 < div_disconnect, pru_listen_notsupp, div_peeraddr, pru_rcvd_notsupp, --- > div_disconnect, pru_listen_notsupp, in_setpeeraddr, pru_rcvd_notsupp, 567c540 < div_sockaddr, sosend, soreceive, sopoll --- > in_setsockaddr, sosend, soreceive, sopoll % To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message