use Packet test macro

This patch updates the code to use Packet test macro instead of
direct test on action flag instead Packet structure. This fixes
the issues related to p->root->action being set and not detected
in tests.