Hope the dog is fine and stop licking but it does sound like his anal glands need to be extracted.
My breeder taught me how to clean it and i do it regularly. He also gets done when he goes to the groomer, usually every other month for a total check, but i do a good maintenance in between grooming's. If i do not clean it for a month "stuff" comes out when i "squeeze it" . It smells very unpleasant but he seems happy after i do it.