From owner-freebsd-questions@FreeBSD.ORG Thu Aug 28 19:29:08 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBCED106566C for ; Thu, 28 Aug 2008 19:29:08 +0000 (UTC) (envelope-from nejc@skoberne.net) Received: from svarun.infrax.si (syssvarun.infrax.si [89.212.81.4]) by mx1.freebsd.org (Postfix) with ESMTP id 9CBF48FC22 for ; Thu, 28 Aug 2008 19:29:08 +0000 (UTC) (envelope-from nejc@skoberne.net) Received: from localhost (sysSvarun.infrax.si [89.212.81.4]) by svarun.infrax.si (Postfix) with ESMTP id 66E6524B19D; Thu, 28 Aug 2008 21:29:06 +0200 (CEST) Received: from svarun.infrax.si ([89.212.81.4]) by localhost (svarun.infrax.si [89.212.81.4]) (amavisd-maia, port 10024) with ESMTP id 20746-10; Thu, 28 Aug 2008 21:28:51 +0200 (CEST) Received: from [192.168.15.2] (lk.84.20.249.154.dc.cable.static.lj-kabel.net [84.20.249.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nejko@infrax.si) by svarun.infrax.si (Postfix) with ESMTP id D146C24A937; Thu, 28 Aug 2008 21:28:51 +0200 (CEST) Message-ID: <48B6FC74.2010605@skoberne.net> Date: Thu, 28 Aug 2008 21:28:52 +0200 From: =?windows-1252?Q?Nejc_=8Akoberne?= User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Chuck Swiger References: <48B5CB70.9080900@skoberne.net> In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard Cc: User Questions Subject: Re: Proxying broadcasts? SOLVED X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2008 19:29:09 -0000 Hey, > The simple answer is no: if you want subnet-local broadcast traffic to > be received, then your DB servers and your clients need to be on the > same subnet. Routers are designed and required to not propagate > broadcast traffic, although you could switch to doing bridging rather > than routing. Or, you could set up Sybase's SQL.INI to list all of the > databases you care about, if I recall correctly... Actually, a little perl script (running daemonized on the firewall) for each of the USERS networks solved my problem. It is somewhat ugly, but it works. ------------------------------------------------------------------------- #!/usr/local/bin/perl -w # syproxy - Sybase broadcast proxy use File::Basename; use Fcntl qw(LOCK_EX LOCK_NB); use IO::Socket; use strict; use Net::RawIP; ### Configuration # Destination IP (broadcast) of the servers network my $DESTINATION = "192.168.1.255"; # Sybase port my $PORT = 2638; # Broadcast address of the USERS network my $LISTEN = "192.168.3.255"; # Packet length my $MAXLEN = 1024; my $sport; my $source; my $ipaddr; my $data; my $progname = basename($0); # Selflock open(SELFLOCK, "<$0") or die("Couldn't open $0: $!\n"); flock(SELFLOCK, LOCK_EX | LOCK_NB) or die("Aborting: another $progname is already running\n"); chdir('/'); # Double-fork to avoid leaving a zombie process behind: exit if (fork()); exit if (fork()); sleep 1 until getppid() == 1; # Create the socket my $recv_socket = IO::Socket::INET->new( Proto => 'udp', LocalPort => $PORT, LocalAddr => $LISTEN, Broadcast => 1, ReuseAddr => 1 ) or die "Creating socket: $!\n"; while (1) { # Wait for packets $recv_socket->recv($data, $MAXLEN); # Get the sender address ($sport, $ipaddr) = unpack_sockaddr_in($recv_socket->peername); $source = inet_ntoa($ipaddr); # Construct the packet my $send_socket = new Net::RawIP({udp =>{}}); $send_socket->set({ip => {saddr => $source , daddr => $DESTINATION, tos => 22}, udp => {source => $sport, dest => $PORT, data => $data }}); # Send the spoofed packet $send_socket->send; } ------------------------------------------------------------------------- Thanks, Nejc