extern void llc_save_primitive(struct sk_buff* skb, u8 prim);
extern u8 llc_data_accept_state(u8 state);
extern void llc_build_offset_table(void);
+extern int llc_release_sockets(struct llc_sap *sap);
#endif /* LLC_CONN_H */
return !memcmp(mac1, mac2, IFHWADDRLEN);
}
-struct llc_sap;
-
-extern struct llc_sap *llc_sap_open(u8 lsap,
- int (*func)(struct sk_buff *skb,
- struct net_device *dev,
- struct packet_type *pt));
-extern void llc_sap_close(struct llc_sap *sap);
-
extern int llc_establish_connection(struct sock *sk, u8 *lmac,
u8 *dmac, u8 dsap);
extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
-extern void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
- u8 *dmac, u8 dsap);
-extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
- u8 *dmac, u8 dsap);
-extern void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb,
- u8 *dmac, u8 dsap);
extern int llc_send_disc(struct sock *sk);
#endif /* LLC_IF_H */
extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk);
extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
+extern struct llc_sap *llc_sap_open(u8 lsap,
+ int (*rcv)(struct sk_buff *skb,
+ struct net_device *dev,
+ struct packet_type *pt));
+extern void llc_sap_close(struct llc_sap *sap);
+
+extern void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
+ u8 *dmac, u8 dsap);
+extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
+ u8 *dmac, u8 dsap);
+extern void llc_build_and_send_test_pkt(struct llc_sap *sap,
+ struct sk_buff *skb, u8 *dmac, u8 dsap);
+
#endif /* LLC_SAP_H */
#include <linux/skbuff.h>
#include <net/datalink.h>
#include <net/psnap.h>
-#include <net/llc_if.h>
#include <net/llc_sap.h>
#include <linux/mm.h>
#include <linux/in.h>
if (!sk->sk_zapped)
llc_sap_unassign_sock(llc->sap, sk);
release_sock(sk);
- if (llc->sap && hlist_empty(&llc->sap->sk_list.list))
+ if (llc->sap && hlist_empty(&llc->sap->sk_list.list)) {
+ llc_release_sockets(llc->sap);
llc_sap_close(llc->sap);
+ }
sock_put(sk);
llc_sk_free(sk);
out:
#endif
/**
- * llc_release_conns - releases all connections of a sap
- * @sap: sap to release its connections
+ * llc_release_sockets - releases all sockets in a sap
+ * @sap: sap to release its sockets
*
* Releases all connections of a sap. Returns 0 if all actions complete
* successfully, nonzero otherwise
*/
-int llc_release_connections(struct llc_sap *sap)
+int llc_release_sockets(struct llc_sap *sap)
{
int rc = 0;
struct sock *sk;
return sap;
}
-/*
- * FIXME: this will go away as soon as sap->release_connections is introduced
- * in the next changesets.
- */
-extern int llc_release_connections(struct llc_sap *sap);
-
-/**
- * llc_free_sap - frees a sap
- * @sap: Address of the sap
- *
- * Frees all associated connections (if any), removes this sap from
- * the list of saps in te station and them frees the memory for this sap.
- */
-void llc_free_sap(struct llc_sap *sap)
-{
- llc_release_connections(sap);
- write_lock_bh(&sap->station->sap_list.lock);
- list_del(&sap->node);
- write_unlock_bh(&sap->station->sap_list.lock);
- kfree(sap);
-}
-
/**
* llc_sap_open - open interface to the upper layers.
* @lsap: SAP number.
*
* Close interface function to upper layer. Each one who wants to
* close an open SAP (for example NetBEUI) should call this function.
+ * Removes this sap from the list of saps in the station and then
+ * frees the memory for this sap.
*/
void llc_sap_close(struct llc_sap *sap)
{
- llc_free_sap(sap);
+ WARN_ON(!hlist_empty(&sap->sk_list.list));
+ write_lock_bh(&sap->station->sap_list.lock);
+ list_del(&sap->node);
+ write_unlock_bh(&sap->station->sap_list.lock);
+ kfree(sap);
}
EXPORT_SYMBOL(llc_sap_open);