diff options
Diffstat (limited to 'drivers/isdn/i4l/isdn_net.c')
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 60c82d7b12a8..8fff0bd100a8 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -890,15 +890,15 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) | |||
890 | proto = ETH_P_IP; | 890 | proto = ETH_P_IP; |
891 | switch (lp->p_encap) { | 891 | switch (lp->p_encap) { |
892 | case ISDN_NET_ENCAP_IPTYP: | 892 | case ISDN_NET_ENCAP_IPTYP: |
893 | proto = ntohs(*(unsigned short *) &buf[0]); | 893 | proto = ntohs(*(__be16 *)&buf[0]); |
894 | p = &buf[2]; | 894 | p = &buf[2]; |
895 | break; | 895 | break; |
896 | case ISDN_NET_ENCAP_ETHER: | 896 | case ISDN_NET_ENCAP_ETHER: |
897 | proto = ntohs(*(unsigned short *) &buf[12]); | 897 | proto = ntohs(*(__be16 *)&buf[12]); |
898 | p = &buf[14]; | 898 | p = &buf[14]; |
899 | break; | 899 | break; |
900 | case ISDN_NET_ENCAP_CISCOHDLC: | 900 | case ISDN_NET_ENCAP_CISCOHDLC: |
901 | proto = ntohs(*(unsigned short *) &buf[2]); | 901 | proto = ntohs(*(__be16 *)&buf[2]); |
902 | p = &buf[4]; | 902 | p = &buf[4]; |
903 | break; | 903 | break; |
904 | #ifdef CONFIG_ISDN_PPP | 904 | #ifdef CONFIG_ISDN_PPP |
@@ -942,18 +942,12 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) | |||
942 | strcpy(addinfo, " IDP"); | 942 | strcpy(addinfo, " IDP"); |
943 | break; | 943 | break; |
944 | } | 944 | } |
945 | printk(KERN_INFO | 945 | printk(KERN_INFO "OPEN: %pI4 -> %pI4%s\n", |
946 | "OPEN: %d.%d.%d.%d -> %d.%d.%d.%d%s\n", | 946 | p + 12, p + 16, addinfo); |
947 | |||
948 | p[12], p[13], p[14], p[15], | ||
949 | p[16], p[17], p[18], p[19], | ||
950 | addinfo); | ||
951 | break; | 947 | break; |
952 | case ETH_P_ARP: | 948 | case ETH_P_ARP: |
953 | printk(KERN_INFO | 949 | printk(KERN_INFO "OPEN: ARP %pI4 -> *.*.*.* ?%pI4\n", |
954 | "OPEN: ARP %d.%d.%d.%d -> *.*.*.* ?%d.%d.%d.%d\n", | 950 | p + 14, p + 24); |
955 | p[14], p[15], p[16], p[17], | ||
956 | p[24], p[25], p[26], p[27]); | ||
957 | break; | 951 | break; |
958 | } | 952 | } |
959 | } | 953 | } |
@@ -1539,15 +1533,16 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) | |||
1539 | p = skb_put(skb, 4 + 14); | 1533 | p = skb_put(skb, 4 + 14); |
1540 | 1534 | ||
1541 | /* cisco header */ | 1535 | /* cisco header */ |
1542 | p += put_u8 (p, CISCO_ADDR_UNICAST); | 1536 | *(u8 *)(p + 0) = CISCO_ADDR_UNICAST; |
1543 | p += put_u8 (p, CISCO_CTRL); | 1537 | *(u8 *)(p + 1) = CISCO_CTRL; |
1544 | p += put_u16(p, CISCO_TYPE_SLARP); | 1538 | *(__be16 *)(p + 2) = cpu_to_be16(CISCO_TYPE_SLARP); |
1545 | 1539 | ||
1546 | /* slarp keepalive */ | 1540 | /* slarp keepalive */ |
1547 | p += put_u32(p, CISCO_SLARP_KEEPALIVE); | 1541 | *(__be32 *)(p + 4) = cpu_to_be32(CISCO_SLARP_KEEPALIVE); |
1548 | p += put_u32(p, lp->cisco_myseq); | 1542 | *(__be32 *)(p + 8) = cpu_to_be32(lp->cisco_myseq); |
1549 | p += put_u32(p, lp->cisco_yourseq); | 1543 | *(__be32 *)(p + 12) = cpu_to_be32(lp->cisco_yourseq); |
1550 | p += put_u16(p, 0xffff); // reliablity, always 0xffff | 1544 | *(__be16 *)(p + 16) = cpu_to_be16(0xffff); // reliablity, always 0xffff |
1545 | p += 18; | ||
1551 | 1546 | ||
1552 | isdn_net_write_super(lp, skb); | 1547 | isdn_net_write_super(lp, skb); |
1553 | 1548 | ||
@@ -1569,15 +1564,16 @@ isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *lp) | |||
1569 | p = skb_put(skb, 4 + 14); | 1564 | p = skb_put(skb, 4 + 14); |
1570 | 1565 | ||
1571 | /* cisco header */ | 1566 | /* cisco header */ |
1572 | p += put_u8 (p, CISCO_ADDR_UNICAST); | 1567 | *(u8 *)(p + 0) = CISCO_ADDR_UNICAST; |
1573 | p += put_u8 (p, CISCO_CTRL); | 1568 | *(u8 *)(p + 1) = CISCO_CTRL; |
1574 | p += put_u16(p, CISCO_TYPE_SLARP); | 1569 | *(__be16 *)(p + 2) = cpu_to_be16(CISCO_TYPE_SLARP); |
1575 | 1570 | ||
1576 | /* slarp request */ | 1571 | /* slarp request */ |
1577 | p += put_u32(p, CISCO_SLARP_REQUEST); | 1572 | *(__be32 *)(p + 4) = cpu_to_be32(CISCO_SLARP_REQUEST); |
1578 | p += put_u32(p, 0); // address | 1573 | *(__be32 *)(p + 8) = cpu_to_be32(0); // address |
1579 | p += put_u32(p, 0); // netmask | 1574 | *(__be32 *)(p + 12) = cpu_to_be32(0); // netmask |
1580 | p += put_u16(p, 0); // unused | 1575 | *(__be16 *)(p + 16) = cpu_to_be16(0); // unused |
1576 | p += 18; | ||
1581 | 1577 | ||
1582 | isdn_net_write_super(lp, skb); | 1578 | isdn_net_write_super(lp, skb); |
1583 | } | 1579 | } |
@@ -1634,16 +1630,17 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) | |||
1634 | p = skb_put(skb, 4 + 14); | 1630 | p = skb_put(skb, 4 + 14); |
1635 | 1631 | ||
1636 | /* cisco header */ | 1632 | /* cisco header */ |
1637 | p += put_u8 (p, CISCO_ADDR_UNICAST); | 1633 | *(u8 *)(p + 0) = CISCO_ADDR_UNICAST; |
1638 | p += put_u8 (p, CISCO_CTRL); | 1634 | *(u8 *)(p + 1) = CISCO_CTRL; |
1639 | p += put_u16(p, CISCO_TYPE_SLARP); | 1635 | *(__be16 *)(p + 2) = cpu_to_be16(CISCO_TYPE_SLARP); |
1640 | 1636 | ||
1641 | /* slarp reply, send own ip/netmask; if values are nonsense remote | 1637 | /* slarp reply, send own ip/netmask; if values are nonsense remote |
1642 | * should think we are unable to provide it with an address via SLARP */ | 1638 | * should think we are unable to provide it with an address via SLARP */ |
1643 | p += put_u32(p, CISCO_SLARP_REPLY); | 1639 | *(__be32 *)(p + 4) = cpu_to_be32(CISCO_SLARP_REPLY); |
1644 | p += put_u32(p, addr); // address | 1640 | *(__be32 *)(p + 8) = cpu_to_be32(addr); // address |
1645 | p += put_u32(p, mask); // netmask | 1641 | *(__be32 *)(p + 12) = cpu_to_be32(mask); // netmask |
1646 | p += put_u16(p, 0); // unused | 1642 | *(__be16 *)(p + 16) = cpu_to_be16(0); // unused |
1643 | p += 18; | ||
1647 | 1644 | ||
1648 | isdn_net_write_super(lp, skb); | 1645 | isdn_net_write_super(lp, skb); |
1649 | } | 1646 | } |
@@ -1664,8 +1661,9 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) | |||
1664 | return; | 1661 | return; |
1665 | 1662 | ||
1666 | p = skb->data; | 1663 | p = skb->data; |
1667 | p += get_u32(p, &code); | 1664 | code = be32_to_cpup((__be32 *)p); |
1668 | 1665 | p += 4; | |
1666 | |||
1669 | switch (code) { | 1667 | switch (code) { |
1670 | case CISCO_SLARP_REQUEST: | 1668 | case CISCO_SLARP_REQUEST: |
1671 | lp->cisco_yourseq = 0; | 1669 | lp->cisco_yourseq = 0; |
@@ -1699,9 +1697,10 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) | |||
1699 | lp->cisco_keepalive_period); | 1697 | lp->cisco_keepalive_period); |
1700 | } | 1698 | } |
1701 | lp->cisco_last_slarp_in = jiffies; | 1699 | lp->cisco_last_slarp_in = jiffies; |
1702 | p += get_u32(p, &my_seq); | 1700 | my_seq = be32_to_cpup((__be32 *)(p + 0)); |
1703 | p += get_u32(p, &your_seq); | 1701 | your_seq = be32_to_cpup((__be32 *)(p + 4)); |
1704 | p += get_u16(p, &unused); | 1702 | unused = be16_to_cpup((__be16 *)(p + 8)); |
1703 | p += 10; | ||
1705 | lp->cisco_yourseq = my_seq; | 1704 | lp->cisco_yourseq = my_seq; |
1706 | lp->cisco_mineseen = your_seq; | 1705 | lp->cisco_mineseen = your_seq; |
1707 | break; | 1706 | break; |
@@ -1720,9 +1719,10 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb) | |||
1720 | goto out_free; | 1719 | goto out_free; |
1721 | 1720 | ||
1722 | p = skb->data; | 1721 | p = skb->data; |
1723 | p += get_u8 (p, &addr); | 1722 | addr = *(u8 *)(p + 0); |
1724 | p += get_u8 (p, &ctrl); | 1723 | ctrl = *(u8 *)(p + 1); |
1725 | p += get_u16(p, &type); | 1724 | type = be16_to_cpup((__be16 *)(p + 2)); |
1725 | p += 4; | ||
1726 | skb_pull(skb, 4); | 1726 | skb_pull(skb, 4); |
1727 | 1727 | ||
1728 | if (addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) { | 1728 | if (addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) { |
@@ -1910,9 +1910,10 @@ static int isdn_net_header(struct sk_buff *skb, struct net_device *dev, | |||
1910 | case ISDN_NET_ENCAP_CISCOHDLC: | 1910 | case ISDN_NET_ENCAP_CISCOHDLC: |
1911 | case ISDN_NET_ENCAP_CISCOHDLCK: | 1911 | case ISDN_NET_ENCAP_CISCOHDLCK: |
1912 | p = skb_push(skb, 4); | 1912 | p = skb_push(skb, 4); |
1913 | p += put_u8 (p, CISCO_ADDR_UNICAST); | 1913 | *(u8 *)(p + 0) = CISCO_ADDR_UNICAST; |
1914 | p += put_u8 (p, CISCO_CTRL); | 1914 | *(u8 *)(p + 1) = CISCO_CTRL; |
1915 | p += put_u16(p, type); | 1915 | *(__be16 *)(p + 2) = cpu_to_be16(type); |
1916 | p += 4; | ||
1916 | len = 4; | 1917 | len = 4; |
1917 | break; | 1918 | break; |
1918 | #ifdef CONFIG_ISDN_X25 | 1919 | #ifdef CONFIG_ISDN_X25 |