af_llc.c (54fb7f25f19a4539d3ec012e410439913650dc06) af_llc.c (590232a7150674b2036291eaefce085f3f9659c8)
1/*
2 * af_llc.c - LLC User Interface SAPs
3 * Description:
4 * Functions in this module are implementation of socket based llc
5 * communications for the Linux operating system. Support of llc class
6 * one and class two is provided via SOCK_DGRAM and SOCK_STREAM
7 * respectively.
8 *

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

872 case LLC_OPT_SIZE:
873 if (opt > LLC_OPT_MAX_SIZE)
874 goto out;
875 llc->n1 = opt;
876 break;
877 case LLC_OPT_ACK_TMR_EXP:
878 if (opt > LLC_OPT_MAX_ACK_TMR_EXP)
879 goto out;
1/*
2 * af_llc.c - LLC User Interface SAPs
3 * Description:
4 * Functions in this module are implementation of socket based llc
5 * communications for the Linux operating system. Support of llc class
6 * one and class two is provided via SOCK_DGRAM and SOCK_STREAM
7 * respectively.
8 *

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

872 case LLC_OPT_SIZE:
873 if (opt > LLC_OPT_MAX_SIZE)
874 goto out;
875 llc->n1 = opt;
876 break;
877 case LLC_OPT_ACK_TMR_EXP:
878 if (opt > LLC_OPT_MAX_ACK_TMR_EXP)
879 goto out;
880 llc->ack_timer.expire = opt;
880 llc->ack_timer.expire = opt * HZ;
881 break;
882 case LLC_OPT_P_TMR_EXP:
883 if (opt > LLC_OPT_MAX_P_TMR_EXP)
884 goto out;
881 break;
882 case LLC_OPT_P_TMR_EXP:
883 if (opt > LLC_OPT_MAX_P_TMR_EXP)
884 goto out;
885 llc->pf_cycle_timer.expire = opt;
885 llc->pf_cycle_timer.expire = opt * HZ;
886 break;
887 case LLC_OPT_REJ_TMR_EXP:
888 if (opt > LLC_OPT_MAX_REJ_TMR_EXP)
889 goto out;
886 break;
887 case LLC_OPT_REJ_TMR_EXP:
888 if (opt > LLC_OPT_MAX_REJ_TMR_EXP)
889 goto out;
890 llc->rej_sent_timer.expire = opt;
890 llc->rej_sent_timer.expire = opt * HZ;
891 break;
892 case LLC_OPT_BUSY_TMR_EXP:
893 if (opt > LLC_OPT_MAX_BUSY_TMR_EXP)
894 goto out;
891 break;
892 case LLC_OPT_BUSY_TMR_EXP:
893 if (opt > LLC_OPT_MAX_BUSY_TMR_EXP)
894 goto out;
895 llc->busy_state_timer.expire = opt;
895 llc->busy_state_timer.expire = opt * HZ;
896 break;
897 case LLC_OPT_TX_WIN:
898 if (opt > LLC_OPT_MAX_WIN)
899 goto out;
900 llc->k = opt;
901 break;
902 case LLC_OPT_RX_WIN:
903 if (opt > LLC_OPT_MAX_WIN)

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

937 rc = get_user(len, optlen);
938 if (rc)
939 goto out;
940 rc = -EINVAL;
941 if (len != sizeof(int))
942 goto out;
943 switch (optname) {
944 case LLC_OPT_RETRY:
896 break;
897 case LLC_OPT_TX_WIN:
898 if (opt > LLC_OPT_MAX_WIN)
899 goto out;
900 llc->k = opt;
901 break;
902 case LLC_OPT_RX_WIN:
903 if (opt > LLC_OPT_MAX_WIN)

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

937 rc = get_user(len, optlen);
938 if (rc)
939 goto out;
940 rc = -EINVAL;
941 if (len != sizeof(int))
942 goto out;
943 switch (optname) {
944 case LLC_OPT_RETRY:
945 val = llc->n2; break;
945 val = llc->n2; break;
946 case LLC_OPT_SIZE:
946 case LLC_OPT_SIZE:
947 val = llc->n1; break;
947 val = llc->n1; break;
948 case LLC_OPT_ACK_TMR_EXP:
948 case LLC_OPT_ACK_TMR_EXP:
949 val = llc->ack_timer.expire; break;
949 val = llc->ack_timer.expire / HZ; break;
950 case LLC_OPT_P_TMR_EXP:
950 case LLC_OPT_P_TMR_EXP:
951 val = llc->pf_cycle_timer.expire; break;
951 val = llc->pf_cycle_timer.expire / HZ; break;
952 case LLC_OPT_REJ_TMR_EXP:
952 case LLC_OPT_REJ_TMR_EXP:
953 val = llc->rej_sent_timer.expire; break;
953 val = llc->rej_sent_timer.expire / HZ; break;
954 case LLC_OPT_BUSY_TMR_EXP:
954 case LLC_OPT_BUSY_TMR_EXP:
955 val = llc->busy_state_timer.expire; break;
955 val = llc->busy_state_timer.expire / HZ; break;
956 case LLC_OPT_TX_WIN:
957 val = llc->k; break;
958 case LLC_OPT_RX_WIN:
959 val = llc->rw; break;
960 default:
961 rc = -ENOPROTOOPT;
962 goto out;
963 }

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

994 .recvmsg = llc_ui_recvmsg,
995 .mmap = sock_no_mmap,
996 .sendpage = sock_no_sendpage,
997};
998
999extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
1000extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
1001
956 case LLC_OPT_TX_WIN:
957 val = llc->k; break;
958 case LLC_OPT_RX_WIN:
959 val = llc->rw; break;
960 default:
961 rc = -ENOPROTOOPT;
962 goto out;
963 }

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

994 .recvmsg = llc_ui_recvmsg,
995 .mmap = sock_no_mmap,
996 .sendpage = sock_no_sendpage,
997};
998
999extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
1000extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
1001
1002static char llc_proc_err_msg[] __initdata =
1003 KERN_CRIT "LLC: Unable to register the proc_fs entries\n";
1004static char llc_sysctl_err_msg[] __initdata =
1005 KERN_CRIT "LLC: Unable to register the sysctl entries\n";
1006static char llc_sock_err_msg[] __initdata =
1007 KERN_CRIT "LLC: Unable to register the network family\n";
1008
1002static int __init llc2_init(void)
1003{
1004 int rc = proto_register(&llc_proto, 0);
1005
1006 if (rc != 0)
1007 goto out;
1008
1009 llc_build_offset_table();
1010 llc_station_init();
1011 llc_ui_sap_last_autoport = LLC_SAP_DYN_START;
1012 rc = llc_proc_init();
1009static int __init llc2_init(void)
1010{
1011 int rc = proto_register(&llc_proto, 0);
1012
1013 if (rc != 0)
1014 goto out;
1015
1016 llc_build_offset_table();
1017 llc_station_init();
1018 llc_ui_sap_last_autoport = LLC_SAP_DYN_START;
1019 rc = llc_proc_init();
1013 if (rc != 0)
1020 if (rc != 0) {
1021 printk(llc_proc_err_msg);
1014 goto out_unregister_llc_proto;
1022 goto out_unregister_llc_proto;
1015 sock_register(&llc_ui_family_ops);
1023 }
1024 rc = llc_sysctl_init();
1025 if (rc) {
1026 printk(llc_sysctl_err_msg);
1027 goto out_proc;
1028 }
1029 rc = sock_register(&llc_ui_family_ops);
1030 if (rc) {
1031 printk(llc_sock_err_msg);
1032 goto out_sysctl;
1033 }
1016 llc_add_pack(LLC_DEST_SAP, llc_sap_handler);
1017 llc_add_pack(LLC_DEST_CONN, llc_conn_handler);
1018out:
1019 return rc;
1034 llc_add_pack(LLC_DEST_SAP, llc_sap_handler);
1035 llc_add_pack(LLC_DEST_CONN, llc_conn_handler);
1036out:
1037 return rc;
1038out_sysctl:
1039 llc_sysctl_exit();
1040out_proc:
1041 llc_proc_exit();
1020out_unregister_llc_proto:
1021 proto_unregister(&llc_proto);
1022 goto out;
1023}
1024
1025static void __exit llc2_exit(void)
1026{
1027 llc_station_exit();
1028 llc_remove_pack(LLC_DEST_SAP);
1029 llc_remove_pack(LLC_DEST_CONN);
1030 sock_unregister(PF_LLC);
1031 llc_proc_exit();
1042out_unregister_llc_proto:
1043 proto_unregister(&llc_proto);
1044 goto out;
1045}
1046
1047static void __exit llc2_exit(void)
1048{
1049 llc_station_exit();
1050 llc_remove_pack(LLC_DEST_SAP);
1051 llc_remove_pack(LLC_DEST_CONN);
1052 sock_unregister(PF_LLC);
1053 llc_proc_exit();
1054 llc_sysctl_exit();
1032 proto_unregister(&llc_proto);
1033}
1034
1035module_init(llc2_init);
1036module_exit(llc2_exit);
1037
1038MODULE_LICENSE("GPL");
1039MODULE_AUTHOR("Procom 1997, Jay Schullist 2001, Arnaldo C. Melo 2001-2003");
1040MODULE_DESCRIPTION("IEEE 802.2 PF_LLC support");
1041MODULE_ALIAS_NETPROTO(PF_LLC);
1055 proto_unregister(&llc_proto);
1056}
1057
1058module_init(llc2_init);
1059module_exit(llc2_exit);
1060
1061MODULE_LICENSE("GPL");
1062MODULE_AUTHOR("Procom 1997, Jay Schullist 2001, Arnaldo C. Melo 2001-2003");
1063MODULE_DESCRIPTION("IEEE 802.2 PF_LLC support");
1064MODULE_ALIAS_NETPROTO(PF_LLC);