Deleted Added
full compact
mp.c (47577) mp.c (47695)
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: mp.c,v 1.20 1999/05/12 09:48:55 brian Exp $
26 * $Id: mp.c,v 1.21 1999/05/28 08:03:24 brian Exp $
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <arpa/inet.h>
34#include <net/if_dl.h>

--- 497 unchanged lines hidden (view full) ---

532
533 if (!bundle->ncp.mp.active)
534 /* Let someone else deal with it ! */
535 return bp;
536
537 if (p == NULL) {
538 log_Printf(LogWARN, "DecodePacket: Can't do MP inside MP !\n");
539 mbuf_Free(bp);
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31#include <netinet/in_systm.h>
32#include <netinet/ip.h>
33#include <arpa/inet.h>
34#include <net/if_dl.h>

--- 497 unchanged lines hidden (view full) ---

532
533 if (!bundle->ncp.mp.active)
534 /* Let someone else deal with it ! */
535 return bp;
536
537 if (p == NULL) {
538 log_Printf(LogWARN, "DecodePacket: Can't do MP inside MP !\n");
539 mbuf_Free(bp);
540 } else
540 } else {
541 mbuf_SetType(bp, MB_MPIN);
541 mp_Assemble(&bundle->ncp.mp, bp, p);
542 mp_Assemble(&bundle->ncp.mp, bp, p);
543 }
542
543 return NULL;
544}
545
546static void
547mp_Output(struct mp *mp, struct bundle *bundle, struct link *l,
548 struct mbuf *m, u_int32_t begin, u_int32_t end)
549{
550 struct mbuf *mo;
551
552 /* Stuff an MP header on the front of our packet and send it */
544
545 return NULL;
546}
547
548static void
549mp_Output(struct mp *mp, struct bundle *bundle, struct link *l,
550 struct mbuf *m, u_int32_t begin, u_int32_t end)
551{
552 struct mbuf *mo;
553
554 /* Stuff an MP header on the front of our packet and send it */
553 mo = mbuf_Alloc(4, MB_MP);
555 mo = mbuf_Alloc(4, MB_MPOUT);
554 mo->next = m;
555 if (mp->peer_is12bit) {
556 u_int16_t val;
557
558 val = (begin << 15) | (end << 14) | (u_int16_t)mp->out.seq;
559 ua_htons(&val, MBUF_CTOP(mo));
560 mo->cnt = 2;
561 } else {

--- 72 unchanged lines hidden (view full) ---

634 if (dl->state == DATALINK_OPEN) {
635 if (len <= dl->mp.weight + LINK_MINWEIGHT) {
636 /*
637 * XXX: Should we remember how much of our `weight' wasn't sent
638 * so that we can compensate next time ?
639 */
640 mo = m;
641 end = 1;
556 mo->next = m;
557 if (mp->peer_is12bit) {
558 u_int16_t val;
559
560 val = (begin << 15) | (end << 14) | (u_int16_t)mp->out.seq;
561 ua_htons(&val, MBUF_CTOP(mo));
562 mo->cnt = 2;
563 } else {

--- 72 unchanged lines hidden (view full) ---

636 if (dl->state == DATALINK_OPEN) {
637 if (len <= dl->mp.weight + LINK_MINWEIGHT) {
638 /*
639 * XXX: Should we remember how much of our `weight' wasn't sent
640 * so that we can compensate next time ?
641 */
642 mo = m;
643 end = 1;
644 mbuf_SetType(mo, MB_MPOUT);
642 } else {
645 } else {
643 mo = mbuf_Alloc(dl->mp.weight, MB_MP);
646 mo = mbuf_Alloc(dl->mp.weight, MB_MPOUT);
644 mo->cnt = dl->mp.weight;
645 len -= mo->cnt;
646 m = mbuf_Read(m, MBUF_CTOP(mo), mo->cnt);
647 }
648 mp_Output(mp, bundle, &dl->physical->link, mo, begin, end);
649 begin = 0;
650 }
651

--- 33 unchanged lines hidden (view full) ---

685
686int
687mp_ShowStatus(struct cmdargs const *arg)
688{
689 struct mp *mp = &arg->bundle->ncp.mp;
690
691 prompt_Printf(arg->prompt, "Multilink is %sactive\n", mp->active ? "" : "in");
692 if (mp->active) {
647 mo->cnt = dl->mp.weight;
648 len -= mo->cnt;
649 m = mbuf_Read(m, MBUF_CTOP(mo), mo->cnt);
650 }
651 mp_Output(mp, bundle, &dl->physical->link, mo, begin, end);
652 begin = 0;
653 }
654

--- 33 unchanged lines hidden (view full) ---

688
689int
690mp_ShowStatus(struct cmdargs const *arg)
691{
692 struct mp *mp = &arg->bundle->ncp.mp;
693
694 prompt_Printf(arg->prompt, "Multilink is %sactive\n", mp->active ? "" : "in");
695 if (mp->active) {
693 struct mbuf *m;
696 struct mbuf *m, *lm;
694 int bufs = 0;
695
696 prompt_Printf(arg->prompt, "Socket: %s\n",
697 mp->server.socket.sun_path);
697 int bufs = 0;
698
699 prompt_Printf(arg->prompt, "Socket: %s\n",
700 mp->server.socket.sun_path);
698 for (m = mp->inbufs; m; m = m->pnext)
701 for (m = mp->inbufs; m; m = m->pnext) {
699 bufs++;
702 bufs++;
700 prompt_Printf(arg->prompt, "Pending frags: %d\n", bufs);
703 lm = m;
704 }
705 prompt_Printf(arg->prompt, "Pending frags: %d", bufs);
706 if (bufs) {
707 struct mp_header mh;
708 unsigned long first, last;
709
710 first = mp_ReadHeader(mp, mp->inbufs, &mh) ? mh.seq : 0;
711 last = mp_ReadHeader(mp, lm, &mh) ? mh.seq : 0;
712 prompt_Printf(arg->prompt, " (Have %lu - %lu, want %lu, lowest %lu)",
713 first, last, (unsigned long)mp->seq.next_in,
714 (unsigned long)mp->seq.min_in);
715 prompt_Printf(arg->prompt, " first is %d, %d", mh.begin ? 1 : 0, mh.end ? 1 : 0);
716 }
717 prompt_Printf(arg->prompt, "\n");
701 }
702
703 prompt_Printf(arg->prompt, "\nMy Side:\n");
704 if (mp->active) {
705 prompt_Printf(arg->prompt, " MRRU: %u\n", mp->local_mrru);
706 prompt_Printf(arg->prompt, " Short Seq: %s\n",
707 mp->local_is12bit ? "on" : "off");
708 }

--- 351 unchanged lines hidden ---
718 }
719
720 prompt_Printf(arg->prompt, "\nMy Side:\n");
721 if (mp->active) {
722 prompt_Printf(arg->prompt, " MRRU: %u\n", mp->local_mrru);
723 prompt_Printf(arg->prompt, " Short Seq: %s\n",
724 mp->local_is12bit ? "on" : "off");
725 }

--- 351 unchanged lines hidden ---