summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/ipcp.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1998-09-04 18:26:00 +0000
committerBrian Somers <brian@FreeBSD.org>1998-09-04 18:26:00 +0000
commit9e8ec64b6b4ce05e891f1c4d21a40c57c57ae931 (patch)
tree3e6cad25436c0e70b26409b4076ee169b57e5540 /usr.sbin/ppp/ipcp.c
parentc498ec5f46c98c7acb11837c0f6647307a8817ab (diff)
downloadsrc-test2-9e8ec64b6b4ce05e891f1c4d21a40c57c57ae931.tar.gz
src-test2-9e8ec64b6b4ce05e891f1c4d21a40c57c57ae931.zip
Notes
Diffstat (limited to 'usr.sbin/ppp/ipcp.c')
-rw-r--r--usr.sbin/ppp/ipcp.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index dfd8ce9f29dc..d580edd47a3f 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.c,v 1.63 1998/08/07 18:42:49 brian Exp $
+ * $Id: ipcp.c,v 1.64 1998/08/26 17:39:37 brian Exp $
*
* TODO:
* o More RFC1772 backward compatibility
@@ -44,6 +44,7 @@
#include <termios.h>
#include <unistd.h>
+#include "ua.h"
#include "defs.h"
#include "command.h"
#include "mbuf.h"
@@ -564,16 +565,18 @@ IpcpSendConfigReq(struct fsm *fp)
o = (struct lcp_opt *)buff;
if ((p && !physical_IsSync(p)) || !REJECTED(ipcp, TY_IPADDR)) {
- *(u_int32_t *)o->data = ipcp->my_ip.s_addr;
+ memcpy(o->data, &ipcp->my_ip.s_addr, 4);
INC_LCP_OPT(TY_IPADDR, 6, o);
}
if (ipcp->my_compproto && !REJECTED(ipcp, TY_COMPPROTO)) {
if (ipcp->heis1172) {
- *(u_int32_t *)o->data = htons(PROTO_VJCOMP);
+ u_int16_t proto = PROTO_VJCOMP;
+
+ ua_htons(&proto, o->data);
INC_LCP_OPT(TY_COMPPROTO, 4, o);
} else {
- *(u_int32_t *)o->data = htonl(ipcp->my_compproto);
+ ua_htonl(&ipcp->my_compproto, o->data);
INC_LCP_OPT(TY_COMPPROTO, 6, o);
}
}
@@ -583,9 +586,9 @@ IpcpSendConfigReq(struct fsm *fp)
!REJECTED(ipcp, TY_SECONDARY_DNS - TY_ADJUST_NS)) {
struct in_addr dns[2];
getdns(ipcp, dns);
- *(u_int32_t *)o->data = dns[0].s_addr;
+ memcpy(o->data, &dns[0].s_addr, 4);
INC_LCP_OPT(TY_PRIMARY_DNS, 6, o);
- *(u_int32_t *)o->data = dns[1].s_addr;
+ memcpy(o->data, &dns[1].s_addr, 4);
INC_LCP_OPT(TY_SECONDARY_DNS, 6, o);
}
@@ -791,7 +794,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
switch (type) {
case TY_IPADDR: /* RFC1332 */
- ipaddr.s_addr = *(u_int32_t *)(cp + 2);
+ memcpy(&ipaddr.s_addr, cp + 2, 4);
log_Printf(LogIPCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
switch (mode_type) {
@@ -864,7 +867,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
}
break;
case TY_COMPPROTO:
- compproto = htonl(*(u_int32_t *)(cp + 2));
+ memcpy(&compproto, cp + 2, 4);
log_Printf(LogIPCP, "%s %s\n", tbuff, vj2asc(compproto));
switch (mode_type) {
@@ -924,8 +927,8 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
}
break;
case TY_IPADDRS: /* RFC1172 */
- ipaddr.s_addr = *(u_int32_t *)(cp + 2);
- dstipaddr.s_addr = *(u_int32_t *)(cp + 6);
+ memcpy(&ipaddr.s_addr, cp + 2, 4);
+ memcpy(&dstipaddr.s_addr, cp + 6, 4);
snprintf(tbuff2, sizeof tbuff2, "%s %s,", tbuff, inet_ntoa(ipaddr));
log_Printf(LogIPCP, "%s %s\n", tbuff2, inet_ntoa(dstipaddr));
@@ -951,7 +954,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
case TY_PRIMARY_DNS: /* DNS negotiation (rfc1877) */
case TY_SECONDARY_DNS:
- ipaddr.s_addr = *(u_int32_t *)(cp + 2);
+ memcpy(&ipaddr.s_addr, cp + 2, 4);
log_Printf(LogIPCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
switch (mode_type) {
@@ -991,8 +994,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
case MODE_NAK: /* what does this mean?? */
if (IsEnabled(ipcp->cfg.ns.dns_neg)) {
gotdnsnak = 1;
- dnsnak[type == TY_PRIMARY_DNS ? 0 : 1].s_addr =
- *(u_int32_t *)(cp + 2);
+ memcpy(&dnsnak[type == TY_PRIMARY_DNS ? 0 : 1].s_addr, cp + 2, 4);
}
break;
case MODE_REJ: /* Can't do much, stop asking */
@@ -1003,7 +1005,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
case TY_PRIMARY_NBNS: /* M$ NetBIOS nameserver hack (rfc1877) */
case TY_SECONDARY_NBNS:
- ipaddr.s_addr = *(u_int32_t *)(cp + 2);
+ memcpy(&ipaddr.s_addr, cp + 2, 4);
log_Printf(LogIPCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
switch (mode_type) {