Identify these plant/animal related things

Picture here.
They’re about the size of a pea. I took one off and it was filled with brown stuff, like sawdust. Could have been a bunch of little brown eggs, or it could be a larva that was eating the wood. Those are my two theories at least.

Maybe a gall of some type.

Looks like terrapin scale insects. The ant may be tending the insects for the honeydew they produce.