summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dhcrelay/packet.c
diff options
context:
space:
mode:
authorcanacar <canacar@openbsd.org>2004-04-20 20:56:47 +0000
committercanacar <canacar@openbsd.org>2004-04-20 20:56:47 +0000
commit65520a4645799c284aa37c79f9c511622252f69c (patch)
tree7a909fc56162f0dfd28c0eb1bcdb293d4a2f9787 /usr.sbin/dhcrelay/packet.c
parentadd tcps_rcvacktooold; ok deraadt (diff)
downloadwireguard-openbsd-65520a4645799c284aa37c79f9c511622252f69c.tar.xz
wireguard-openbsd-65520a4645799c284aa37c79f9c511622252f69c.zip
get rid of the -p switch, use fixed values for server and client ports,
rename port variables for clarity. ok henning@
Diffstat (limited to 'usr.sbin/dhcrelay/packet.c')
-rw-r--r--usr.sbin/dhcrelay/packet.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/usr.sbin/dhcrelay/packet.c b/usr.sbin/dhcrelay/packet.c
index 925b3afe36a..7ba4acb6649 100644
--- a/usr.sbin/dhcrelay/packet.c
+++ b/usr.sbin/dhcrelay/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.1 2004/04/12 21:10:28 henning Exp $ */
+/* $OpenBSD: packet.c,v 1.2 2004/04/20 20:56:47 canacar Exp $ */
/* Packet assembly code, originally contributed by Archie Cobbs. */
@@ -52,11 +52,6 @@
u_int32_t checksum(unsigned char *, unsigned, u_int32_t);
u_int32_t wrapsum(u_int32_t);
-void assemble_ethernet_header(struct interface_info *, unsigned char *,
- int *, struct hardware *);
-ssize_t decode_ethernet_header(struct interface_info *, unsigned char *,
- int bufix, struct hardware *);
-
u_int32_t
checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum)
{
@@ -100,11 +95,9 @@ assemble_hw_header(struct interface_info *interface, unsigned char *buf,
memcpy(eh.ether_dhost, to->haddr, sizeof(eh.ether_dhost));
else
memset(eh.ether_dhost, 0xff, sizeof(eh.ether_dhost));
- if (interface->hw_address.hlen == sizeof(eh.ether_shost))
- memcpy(eh.ether_shost, interface->hw_address.haddr,
- sizeof(eh.ether_shost));
- else
- memset(eh.ether_shost, 0x00, sizeof(eh.ether_shost));
+
+ /* source address is filled in by the kernel */
+ memset(eh.ether_shost, 0x00, sizeof(eh.ether_shost));
eh.ether_type = htons(ETHERTYPE_IP);
@@ -136,7 +129,7 @@ assemble_udp_ip_header(struct interface_info *interface, unsigned char *buf,
memcpy(&buf[*bufix], &ip, sizeof(ip));
*bufix += sizeof(ip);
- udp.uh_sport = htons(LOCAL_PORT); /* XXX */
+ udp.uh_sport = server_port; /* XXX */
udp.uh_dport = port; /* XXX */
udp.uh_ulen = htons(sizeof(udp) + len);
memset(&udp.uh_sum, 0, sizeof(udp.uh_sum));