GNOME Bugzilla – Bug 564896
gst_netaddress_get_ip[46]_address should check for correct type
Last modified: 2008-12-18 12:40:04 UTC
Please describe the problem: gst_netaddress_get_ip4_address gst_netaddress_get_ip6_address both return success even if naddr is the wrong type. Steps to reproduce: ask for a v4/v6 address if naddr is actually v6/v4 type. Actual results: the address you get back is not useful unless you make some assumptions about the implementation details. Expected results: gst_netaddress_get_ip4_address : should fail for v6 address gst_netaddress_get_ip6_address : should either fail or return the v4 address as a transitional v6 address Does this happen every time? yes Other information: I have a patch to submit shortly. patch also adds two new functions gst_netaddress_get_address_bytes gst_netaddress_set_address_bytes Not strictly needed, but convenient
Created attachment 124878 [details] [review] patch for netaddress_[get|set]_*
I'll take a look at this later... makes sense to fail / return transitional ipv6 address IMHO. Next time please attach your patch as unified diff (diff -u) as this is much easier to review :) Also your patch already includes the two new functions.
Created attachment 124919 [details] [review] patch for netaddress_[get|set]_* (unified diff) Sorry about the diff. I usually use subversion and forgot to give cvs diff the -u flag.
Thanks for the patch, commited after some fixes to the return values of the new functions, indentation and the Since docs tags. Patch by: Andrew Feren <acferen at yahoo dot com> * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netaddress_get_ip4_address), (gst_netaddress_get_ip6_address), (gst_netaddress_get_address_bytes), (gst_netaddress_set_address_bytes): * gst-libs/gst/netbuffer/gstnetbuffer.h: Make gst_netaddress_get_ip4_address fail for v6 addresses. Make gst_netaddress_get_ip6_address either fail or return the v4 address as a transitional v6 address. Add two convenience functions: API: gst_netaddress_get_address_bytes() API: gst_netaddress_set_address_bytes() Fixes #564896.