From owner-freebsd-net Fri Jan 12 9:58:10 2001 Delivered-To: freebsd-net@freebsd.org Received: from gta.com (mailgate.gta.com [199.120.225.4]) by hub.freebsd.org (Postfix) with ESMTP id AFB7C37B69B for ; Fri, 12 Jan 2001 09:57:49 -0800 (PST) Received: from gta.com (GTA internal mail system) by gta.com with ESMTP id MAA92762 for ; Fri, 12 Jan 2001 12:55:09 -0500 (EST) Message-ID: <3A5F4820.634D626B@gta.com> Date: Fri, 12 Jan 2001 13:08:32 -0500 From: Larry Baird X-Mailer: Mozilla 4.75 [en] (X11; U; FreeBSD 4.2-RELEASE i386) X-Accept-Language: en, cs, ja, zh-TW, zh MIME-Version: 1.0 To: freebsd-net@freebsd.org Subject: Strange source address problem Content-Type: multipart/mixed; boundary="------------BDE51CF92238A25D9C323930" Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This is a multi-part message in MIME format. --------------BDE51CF92238A25D9C323930 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hopefully somebody can shed some light in helping me to understand something I am seeing on a 4.2 box. I am experimenting with a daemon that implements something very close to the VRRP (Virtual Router Redundancy Protocol). The VRRP portion of the daemon works correctly. The problem I am having has to do with the source IP address after a host has transitioned from "slave" to "master" mode. The problem can be illustrated on a standard 4.2 system not running the VRRP daemon by the following command line actions: Script started on Fri Jan 12 12:42:35 2001 sukebe# ifconfig xl0 inet 192.168.23.85 sukebe# sukebe# ifconfig xl0 xl0: flags=8843 mtu 1500 inet6 fe80::260:8ff:feaf:2bf5%xl0 prefixlen 64 scopeid 0x1 inet 192.168.23.85 netmask 0xffffff00 broadcast 192.168.23.255 ether 00:60:08:af:2b:f5 media: autoselect (none) status: no carrier supported media: autoselect 100baseTX 100baseTX 10baseT/UTP 10baseT/UTP 100baseTX sukebe# sukebe# ./getLocalIP 192.168.23.90 local = 192.168.23.85:1178 sukebe# sukebe# ifconfig xl0 inet 192.168.23.86 sukebe# sukebe# ifconfig xl0 xl0: flags=8843 mtu 1500 inet6 fe80::260:8ff:feaf:2bf5%xl0 prefixlen 64 scopeid 0x1 inet 192.168.23.86 netmask 0xffffff00 broadcast 192.168.23.255 ether 00:60:08:af:2b:f5 media: autoselect (none) status: no carrier supported media: autoselect 100baseTX 100baseTX 10baseT/UTP 10baseT/UTP 100baseTX sukebe# sukebe# ./getLocalIP 192.168.23.90 local = 192.168.23.85:1179 ^^^^ why is 192.168.23.85 still showing up?? This address should be gone. sukebe# sukebe# exit Script done on Fri Jan 12 12:44:35 2001 I have attached the source code to the getLocalIP program. Can anybody explain this? Thanks in advance for your help. -- ------------------------------------------------------------------------ Larry Baird Global Technology Associates, Inc. | Orlando, FL Email: lab@gta.com | TEL 407-380-0220, FAX 407-380-6080 --------------BDE51CF92238A25D9C323930 Content-Type: text/plain; charset=us-ascii; name="getLocalIP.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="getLocalIP.c" #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int s; if ( argc != 2 ) fprintf( stderr, "USAGE: %s destIP[:port]\n", argv[0] ); else { if ( (s = socket( PF_INET, SOCK_DGRAM, 0 )) < 0 ) perror( "Unable to create socket" ); else { struct sockaddr_in servAddr; short port = 7; char *p; if ((p = strchr(argv[1], ':')) != NULL) { port = atoi(p + 1); *p = 0; } bzero(&servAddr, sizeof(servAddr)); servAddr.sin_family = AF_INET; servAddr.sin_port = htons( port ); if ( ! inet_aton( argv[1], &servAddr.sin_addr ) ) fprintf( stderr, "IP address invalid.\n" ); else { if ( connect( s, (struct sockaddr *)&servAddr, sizeof(servAddr) ) ) perror( "connect() failed" ); else { struct sockaddr_in local; int local_len = sizeof(local); if ( getsockname( s, (struct sockaddr *)&local, &local_len)) perror( "getsockname() failed" ); else { printf( "local = %s:%d\n", inet_ntoa(local.sin_addr), ntohs(local.sin_port)); exit( 0 ); } } } close(s); } } exit( 1 ); } --------------BDE51CF92238A25D9C323930-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message