diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/ppp_async.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/ppp_async.c')
-rw-r--r-- | drivers/net/ppp_async.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index af50a530daee..c554a397e558 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/jiffies.h> | 33 | #include <linux/jiffies.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <asm/unaligned.h> | ||
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
36 | #include <asm/string.h> | 37 | #include <asm/string.h> |
37 | 38 | ||
@@ -184,7 +185,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
184 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); | 185 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); |
185 | 186 | ||
186 | atomic_set(&ap->refcnt, 1); | 187 | atomic_set(&ap->refcnt, 1); |
187 | init_MUTEX_LOCKED(&ap->dead_sem); | 188 | sema_init(&ap->dead_sem, 0); |
188 | 189 | ||
189 | ap->chan.private = ap; | 190 | ap->chan.private = ap; |
190 | ap->chan.ops = &async_ops; | 191 | ap->chan.ops = &async_ops; |
@@ -522,7 +523,7 @@ static void ppp_async_process(unsigned long arg) | |||
522 | #define PUT_BYTE(ap, buf, c, islcp) do { \ | 523 | #define PUT_BYTE(ap, buf, c, islcp) do { \ |
523 | if ((islcp && c < 0x20) || (ap->xaccm[c >> 5] & (1 << (c & 0x1f)))) {\ | 524 | if ((islcp && c < 0x20) || (ap->xaccm[c >> 5] & (1 << (c & 0x1f)))) {\ |
524 | *buf++ = PPP_ESCAPE; \ | 525 | *buf++ = PPP_ESCAPE; \ |
525 | *buf++ = c ^ 0x20; \ | 526 | *buf++ = c ^ PPP_TRANS; \ |
526 | } else \ | 527 | } else \ |
527 | *buf++ = c; \ | 528 | *buf++ = c; \ |
528 | } while (0) | 529 | } while (0) |
@@ -542,7 +543,7 @@ ppp_async_encode(struct asyncppp *ap) | |||
542 | data = ap->tpkt->data; | 543 | data = ap->tpkt->data; |
543 | count = ap->tpkt->len; | 544 | count = ap->tpkt->len; |
544 | fcs = ap->tfcs; | 545 | fcs = ap->tfcs; |
545 | proto = (data[0] << 8) + data[1]; | 546 | proto = get_unaligned_be16(data); |
546 | 547 | ||
547 | /* | 548 | /* |
548 | * LCP packets with code values between 1 (configure-reqest) | 549 | * LCP packets with code values between 1 (configure-reqest) |
@@ -895,7 +896,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
895 | sp = skb_put(skb, n); | 896 | sp = skb_put(skb, n); |
896 | memcpy(sp, buf, n); | 897 | memcpy(sp, buf, n); |
897 | if (ap->state & SC_ESCAPE) { | 898 | if (ap->state & SC_ESCAPE) { |
898 | sp[0] ^= 0x20; | 899 | sp[0] ^= PPP_TRANS; |
899 | ap->state &= ~SC_ESCAPE; | 900 | ap->state &= ~SC_ESCAPE; |
900 | } | 901 | } |
901 | } | 902 | } |
@@ -963,7 +964,7 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data, | |||
963 | code = data[0]; | 964 | code = data[0]; |
964 | if (code != CONFACK && code != CONFREQ) | 965 | if (code != CONFACK && code != CONFREQ) |
965 | return; | 966 | return; |
966 | dlen = (data[2] << 8) + data[3]; | 967 | dlen = get_unaligned_be16(data + 2); |
967 | if (len < dlen) | 968 | if (len < dlen) |
968 | return; /* packet got truncated or length is bogus */ | 969 | return; /* packet got truncated or length is bogus */ |
969 | 970 | ||
@@ -997,15 +998,14 @@ static void async_lcp_peek(struct asyncppp *ap, unsigned char *data, | |||
997 | while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) { | 998 | while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) { |
998 | switch (data[0]) { | 999 | switch (data[0]) { |
999 | case LCP_MRU: | 1000 | case LCP_MRU: |
1000 | val = (data[2] << 8) + data[3]; | 1001 | val = get_unaligned_be16(data + 2); |
1001 | if (inbound) | 1002 | if (inbound) |
1002 | ap->mru = val; | 1003 | ap->mru = val; |
1003 | else | 1004 | else |
1004 | ap->chan.mtu = val; | 1005 | ap->chan.mtu = val; |
1005 | break; | 1006 | break; |
1006 | case LCP_ASYNCMAP: | 1007 | case LCP_ASYNCMAP: |
1007 | val = (data[2] << 24) + (data[3] << 16) | 1008 | val = get_unaligned_be32(data + 2); |
1008 | + (data[4] << 8) + data[5]; | ||
1009 | if (inbound) | 1009 | if (inbound) |
1010 | ap->raccm = val; | 1010 | ap->raccm = val; |
1011 | else | 1011 | else |