I have known other male dogs who would do this - not the sniffing as much, but the peeing every few feet if you would let them. Both were rescue dogs, so were neutered as adults, maybe it is just an instinctive male territorial thing ...