summaryrefslogtreecommitdiffstats
path: root/lib/libalias
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-09-01 09:32:44 +0000
committerru <ru@FreeBSD.org>2000-09-01 09:32:44 +0000
commit3e30fdbd5ac754206f57abee2475a9c4b51cf49e (patch)
treec7bace9436dd0579dfd2cdb3ea9fdfa1ead87b0e /lib/libalias
parentc1223233b1c7d8654a9333cdf1a76adaba2a101a (diff)
downloadFreeBSD-src-3e30fdbd5ac754206f57abee2475a9c4b51cf49e.zip
FreeBSD-src-3e30fdbd5ac754206f57abee2475a9c4b51cf49e.tar.gz
Changed the way we handle outgoing ICMP error messages -- do
not alias `ip_src' unless it comes from the host an original datagram that triggered this error message was destined for. PR: 20712 Reviewed by: brian, Charles Mott <cmott@scientech.com>
Diffstat (limited to 'lib/libalias')
-rw-r--r--lib/libalias/alias.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/lib/libalias/alias.c b/lib/libalias/alias.c
index e0e5e7c..7689e90 100644
--- a/lib/libalias/alias.c
+++ b/lib/libalias/alias.c
@@ -539,12 +539,17 @@ IcmpAliasOut2(struct ip *pip)
accumulate -= alias_port;
ADJUST_CHECKSUM(accumulate, ic->icmp_cksum)
-/* Alias address in IP header */
- DifferentialChecksum(&pip->ip_sum,
- (u_short *) &alias_address,
- (u_short *) &pip->ip_src,
- 2);
- pip->ip_src = alias_address;
+/*
+ * Alias address in IP header if it comes from the host
+ * the original TCP/UDP packet was destined for.
+ */
+ if (pip->ip_src.s_addr == ip->ip_dst.s_addr) {
+ DifferentialChecksum(&pip->ip_sum,
+ (u_short *) &alias_address,
+ (u_short *) &pip->ip_src,
+ 2);
+ pip->ip_src = alias_address;
+ }
/* Alias address and port number of original IP packet
fragment contained in ICMP data section */
@@ -572,12 +577,17 @@ fragment contained in ICMP data section */
accumulate -= alias_id;
ADJUST_CHECKSUM(accumulate, ic->icmp_cksum)
-/* Alias address in IP header */
- DifferentialChecksum(&pip->ip_sum,
- (u_short *) &alias_address,
- (u_short *) &pip->ip_src,
- 2);
- pip->ip_src = alias_address;
+/*
+ * Alias address in IP header if it comes from the host
+ * the original ICMP message was destined for.
+ */
+ if (pip->ip_src.s_addr == ip->ip_dst.s_addr) {
+ DifferentialChecksum(&pip->ip_sum,
+ (u_short *) &alias_address,
+ (u_short *) &pip->ip_src,
+ 2);
+ pip->ip_src = alias_address;
+ }
/* Alias address of original IP packet and sequence number of
embedded ICMP datagram */
OpenPOWER on IntegriCloud