summaryrefslogtreecommitdiffstats
path: root/lib/libalias/alias.c
diff options
context:
space:
mode:
authoramurai <amurai@FreeBSD.org>1998-05-24 03:03:10 +0000
committeramurai <amurai@FreeBSD.org>1998-05-24 03:03:10 +0000
commit60356ac1dd1c49a236d7e4d880c20d62edbd92fc (patch)
treeef022c892b1e3eefab01ac1b64299bcf71984730 /lib/libalias/alias.c
parentde3d668e24387bd98254eaf4943a01d5ac4e001c (diff)
downloadFreeBSD-src-60356ac1dd1c49a236d7e4d880c20d62edbd92fc.zip
FreeBSD-src-60356ac1dd1c49a236d7e4d880c20d62edbd92fc.tar.gz
Primary verison of NetBIOS over TCP/IP. Now you can connect Windows
DOMAIN as DOMAIN user through NAT function. See also RFC1002 for futher detail of SMB structure. Submitted by: Atsushi Murai <amurai@spec.co.jp>
Diffstat (limited to 'lib/libalias/alias.c')
-rw-r--r--lib/libalias/alias.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/lib/libalias/alias.c b/lib/libalias/alias.c
index 8ae038b..4c15c5e 100644
--- a/lib/libalias/alias.c
+++ b/lib/libalias/alias.c
@@ -93,6 +93,9 @@
#include "alias_local.h"
#include "alias.h"
+#define NETBIOS_NS_PORT_NUMBER 137
+#define NETBIOS_DGM_PORT_NUMBER 138
+#define FTP_CONTROL_PORT_NUMBER 21
#define FTP_CONTROL_PORT_NUMBER 21
#define IRC_CONTROL_PORT_NUMBER_1 6667
#define IRC_CONTROL_PORT_NUMBER_2 6668
@@ -318,12 +321,12 @@ IcmpAliasIn2(struct ip *pip)
link = FindUdpTcpIn(ip->ip_dst, ip->ip_src,
tc->th_dport, tc->th_sport,
IPPROTO_TCP);
- else if (ip->ip_p == IPPROTO_ICMP) {
+ else if (ip->ip_p == IPPROTO_ICMP)
if (ic2->icmp_type == ICMP_ECHO || ic2->icmp_type == ICMP_TSTAMP)
link = FindIcmpIn(ip->ip_dst, ip->ip_src, ic2->icmp_id);
else
link = NULL;
- } else
+ else
link = NULL;
if (link != NULL)
@@ -605,6 +608,21 @@ UdpAliasIn(struct ip *pip)
alias_port = ud->uh_dport;
ud->uh_dport = GetOriginalPort(link);
+/* If NETBIOS Datagram, It should be alias address in UDP Data, too */
+ if (ntohs(ud->uh_dport) == NETBIOS_DGM_PORT_NUMBER
+ || ntohs(ud->uh_sport) == NETBIOS_DGM_PORT_NUMBER )
+ {
+ AliasHandleUdpNbt(pip, link, &original_address, ud->uh_dport);
+ } else if (ntohs(ud->uh_dport) == NETBIOS_NS_PORT_NUMBER
+ || ntohs(ud->uh_sport) == NETBIOS_NS_PORT_NUMBER )
+ {
+ AliasHandleUdpNbtNS(pip, link,
+ &alias_address,
+ &alias_port,
+ &original_address,
+ &ud->uh_dport );
+ }
+
/* If UDP checksum is not zero, then adjust since destination port */
/* is being unaliased and destination port is being altered. */
if (ud->uh_sum != 0)
@@ -650,6 +668,21 @@ UdpAliasOut(struct ip *pip)
alias_address = GetAliasAddress(link);
alias_port = GetAliasPort(link);
+/* If NETBIOS Datagram, It should be alias address in UDP Data, too */
+ if (ntohs(ud->uh_dport) == NETBIOS_DGM_PORT_NUMBER
+ || ntohs(ud->uh_sport) == NETBIOS_DGM_PORT_NUMBER )
+ {
+ AliasHandleUdpNbt(pip, link, &alias_address, alias_port);
+ } else if (ntohs(ud->uh_dport) == NETBIOS_NS_PORT_NUMBER
+ || ntohs(ud->uh_sport) == NETBIOS_NS_PORT_NUMBER )
+ {
+ AliasHandleUdpNbtNS(pip, link,
+ &pip->ip_src,
+ &ud->uh_sport,
+ &alias_address,
+ &alias_port);
+ }
+
/* If UDP checksum is not zero, adjust since source port is */
/* being aliased and source address is being altered */
if (ud->uh_sum != 0)
@@ -668,7 +701,7 @@ UdpAliasOut(struct ip *pip)
ADJUST_CHECKSUM(accumulate, ud->uh_sum)
}
-/* Put alias port in TCP header */
+/* Put alias port in UDP header */
ud->uh_sport = alias_port;
/* Change source address */
OpenPOWER on IntegriCloud