Deleted Added
full compact
mp.c (134789) mp.c (134833)
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 * $FreeBSD: head/usr.sbin/ppp/mp.c 134789 2004-09-05 01:46:52Z brian $
26 * $FreeBSD: head/usr.sbin/ppp/mp.c 134833 2004-09-06 00:07:58Z marcel $
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>

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

569 do
570 frag = &(*frag)->m_next;
571 while (*frag != NULL);
572 }
573 } while (!h.end);
574
575 if (q) {
576 q = m_pullup(q);
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>

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

569 do
570 frag = &(*frag)->m_next;
571 while (*frag != NULL);
572 }
573 } while (!h.end);
574
575 if (q) {
576 q = m_pullup(q);
577 log_Printf(LogDEBUG, "MP: Reassembled frags %lu-%lu, length %d\n",
577 log_Printf(LogDEBUG, "MP: Reassembled frags %lu-%lu, length %zd\n",
578 (u_long)first, (u_long)h.seq, m_length(q));
579 link_PullPacket(&mp->link, MBUF_CTOP(q), q->m_len, mp->bundle);
580 m_freem(q);
581 }
582
583 mp->seq.next_in = seq = inc_seq(mp->local_is12bit, h.seq);
584 last = NULL;
585 q = mp->inbufs;

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

645 } else {
646 u_int32_t val;
647
648 val = (begin << 31) | (end << 30) | (u_int32_t)mp->out.seq;
649 ua_htonl(&val, prepend);
650 m = m_prepend(m, prepend, 4, 0);
651 }
652 if (log_IsKept(LogDEBUG))
578 (u_long)first, (u_long)h.seq, m_length(q));
579 link_PullPacket(&mp->link, MBUF_CTOP(q), q->m_len, mp->bundle);
580 m_freem(q);
581 }
582
583 mp->seq.next_in = seq = inc_seq(mp->local_is12bit, h.seq);
584 last = NULL;
585 q = mp->inbufs;

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

645 } else {
646 u_int32_t val;
647
648 val = (begin << 31) | (end << 30) | (u_int32_t)mp->out.seq;
649 ua_htonl(&val, prepend);
650 m = m_prepend(m, prepend, 4, 0);
651 }
652 if (log_IsKept(LogDEBUG))
653 log_Printf(LogDEBUG, "MP[frag %d]: Send %d bytes on link `%s'\n",
653 log_Printf(LogDEBUG, "MP[frag %d]: Send %zd bytes on link `%s'\n",
654 mp->out.seq, m_length(m), l->name);
655 mp->out.seq = inc_seq(mp->peer_is12bit, mp->out.seq);
656
657 if (l->ccp.fsm.state != ST_OPENED && ccp_Required(&l->ccp)) {
658 log_Printf(LogPHASE, "%s: Not transmitting... waiting for CCP\n", l->name);
659 return;
660 }
661

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

902 unsigned f, header;
903
904 switch (c) {
905 case ENDDISC_NULL:
906 sprintf(result, "Null Class");
907 break;
908
909 case ENDDISC_LOCAL:
654 mp->out.seq, m_length(m), l->name);
655 mp->out.seq = inc_seq(mp->peer_is12bit, mp->out.seq);
656
657 if (l->ccp.fsm.state != ST_OPENED && ccp_Required(&l->ccp)) {
658 log_Printf(LogPHASE, "%s: Not transmitting... waiting for CCP\n", l->name);
659 return;
660 }
661

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

902 unsigned f, header;
903
904 switch (c) {
905 case ENDDISC_NULL:
906 sprintf(result, "Null Class");
907 break;
908
909 case ENDDISC_LOCAL:
910 snprintf(result, sizeof result, "Local Addr: %.*s", len, address);
910 snprintf(result, sizeof result, "Local Addr: %.*s", (int)len,
911 address);
911 break;
912
913 case ENDDISC_IP:
914 if (len == 4)
915 snprintf(result, sizeof result, "IP %s",
916 inet_ntoa(*(const struct in_addr *)address));
917 else
912 break;
913
914 case ENDDISC_IP:
915 if (len == 4)
916 snprintf(result, sizeof result, "IP %s",
917 inet_ntoa(*(const struct in_addr *)address));
918 else
918 sprintf(result, "IP[%d] ???", len);
919 sprintf(result, "IP[%zd] ???", len);
919 break;
920
921 case ENDDISC_MAC:
922 if (len == 6) {
923 const u_char *m = (const u_char *)address;
924 snprintf(result, sizeof result, "MAC %02x:%02x:%02x:%02x:%02x:%02x",
925 m[0], m[1], m[2], m[3], m[4], m[5]);
926 } else
920 break;
921
922 case ENDDISC_MAC:
923 if (len == 6) {
924 const u_char *m = (const u_char *)address;
925 snprintf(result, sizeof result, "MAC %02x:%02x:%02x:%02x:%02x:%02x",
926 m[0], m[1], m[2], m[3], m[4], m[5]);
927 } else
927 sprintf(result, "MAC[%d] ???", len);
928 sprintf(result, "MAC[%zd] ???", len);
928 break;
929
930 case ENDDISC_MAGIC:
931 sprintf(result, "Magic: 0x");
932 header = strlen(result);
933 if (len + header + 1 > sizeof result)
934 len = sizeof result - header - 1;
935 for (f = 0; f < len; f++)
936 sprintf(result + header + 2 * f, "%02x", address[f]);
937 break;
938
939 case ENDDISC_PSN:
929 break;
930
931 case ENDDISC_MAGIC:
932 sprintf(result, "Magic: 0x");
933 header = strlen(result);
934 if (len + header + 1 > sizeof result)
935 len = sizeof result - header - 1;
936 for (f = 0; f < len; f++)
937 sprintf(result + header + 2 * f, "%02x", address[f]);
938 break;
939
940 case ENDDISC_PSN:
940 snprintf(result, sizeof result, "PSN: %.*s", len, address);
941 snprintf(result, sizeof result, "PSN: %.*s", (int)len, address);
941 break;
942
943 default:
944 sprintf(result, "%d: ", (int)c);
945 header = strlen(result);
946 if (len + header + 1 > sizeof result)
947 len = sizeof result - header - 1;
948 for (f = 0; f < len; f++)

--- 260 unchanged lines hidden ---
942 break;
943
944 default:
945 sprintf(result, "%d: ", (int)c);
946 header = strlen(result);
947 if (len + header + 1 > sizeof result)
948 len = sizeof result - header - 1;
949 for (f = 0; f < len; f++)

--- 260 unchanged lines hidden ---