The case as described by you suggests a long standing decay where infection has completely involved the teeth and surrounding gums and bone. The ulcer what you see in vicinity is called sinus formation linked to infected teeth.
Next Steps
Visit a competent dentist and get a root canal done for the same.
Health Tips
Always get a crown done after root canal treatment.