Bug752 v1.1

Implementation of https://redmine.openinfosecfoundation.org/issues/751 and https://redmine.openinfosecfoundation.org/issues/751https://redmine.openinfosecfoundation.org/issues/752

Buidbot prbuild: https://buildbot.suricata-ids.org/builders/regit/builds/44

This work has been forgotten for a while...