Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / net / llc / llc_output.c
index 66206eb..b4e668e 100644 (file)
@@ -30,7 +30,8 @@
  *     Fills MAC header fields, depending on MAC type. Returns 0, If MAC type
  *     is a valid type and initialization completes correctly 1, otherwise.
  */
-int llc_mac_hdr_init(struct sk_buff *skb, unsigned char *sa, unsigned char *da)
+int llc_mac_hdr_init(struct sk_buff *skb,
+                    const unsigned char *sa, const unsigned char *da)
 {
        int rc = 0;
 
@@ -40,7 +41,8 @@ int llc_mac_hdr_init(struct sk_buff *skb, unsigned char *sa, unsigned char *da)
                struct net_device *dev = skb->dev;
                struct trh_hdr *trh;
                
-               trh = (struct trh_hdr *)skb_push(skb, sizeof(*trh));
+               skb->mac.raw = skb_push(skb, sizeof(*trh));
+               trh = tr_hdr(skb);
                trh->ac = AC;
                trh->fc = LLC_FRAME;
                if (sa)
@@ -50,8 +52,8 @@ int llc_mac_hdr_init(struct sk_buff *skb, unsigned char *sa, unsigned char *da)
                if (da) {
                        memcpy(trh->daddr, da, dev->addr_len);
                        tr_source_route(skb, trh, dev);
+                       skb->mac.raw = skb->data;
                }
-               skb->mac.raw = skb->data;
                break;
        }
 #endif
@@ -61,7 +63,7 @@ int llc_mac_hdr_init(struct sk_buff *skb, unsigned char *sa, unsigned char *da)
                struct ethhdr *eth;
 
                skb->mac.raw = skb_push(skb, sizeof(*eth));
-               eth = (struct ethhdr *)skb->mac.raw;
+               eth = eth_hdr(skb);
                eth->h_proto = htons(len);
                memcpy(eth->h_dest, da, ETH_ALEN);
                memcpy(eth->h_source, sa, ETH_ALEN);
@@ -97,7 +99,7 @@ int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
                            dsap, LLC_PDU_CMD);
        llc_pdu_init_as_ui_cmd(skb);
        rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac);
-       if (!rc)
+       if (likely(!rc))
                rc = dev_queue_xmit(skb);
        return rc;
 }