All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
First of all, we advise you to be patient about your teacher's misbehaviour and rudeness; a student of knowledge should be keen on acquiring knowledge and continue to attend his teacher's classes if one benefits from them. Imaam An-Nawawi mentioned the etiquettes of the student of knowledge saying: 'Among the etiquettes that a student of knowledge should have, is that he should be patient over the misbehaviour and roughness of his teacher; this should not stop him from attending his lessons and think that he is not competent. He should interpret his acts and words which appear to be corrupt in a good and correct way. It is only an unsuccessful person who would refrain from attending the circles of knowledge.'
If the teacher is rude to you, you should start by apologizing to him and tell him that it was your mistake and that you are the one to be blamed, as this is better for you in this world and in the Hereafter, and this is purer for the heart of the Shaykh [the teacher]. It is said that whoever is not patient in being humiliated in seeking knowledge, he would remain all his life in darkness and ignorance, and whoever is patient whilst seeking knowledge, he would undoubtedly be honoured in this life and in the Hereafter. It is reported that Ibn 'Abbaas said: 'I was humiliated as a student of knowledge and was honoured as a teacher [preacher].'
The teacher should also have good morals and should be kind and tolerant to his students. Imaam An-Nawawi mentioned in his book 'Etiquettes with the Quran' a number of beneficial etiquettes that the teacher should have, so we advise the teacher to refer to it as there is no place to mention them all here. This book is translated into English, so you may buy it and gift it to your teacher.
Allaah Knows best.