)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":27654,"name":"Hongbin Lu","email":"kira034@163.com","username":"hongbin.lu"},"change_message_id":"1d6bef449417df095cf8ee223be834e625cb3fa6","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Change protocol 73 iptables name assigment from rspf to cphb"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change protocol 73 iptables name assigment from rspf to cphb"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Change-Id: Ib73def4e2a9e3644462fdee312768382fcb800a5"},{"line_number":12,"context_line":"Closes-Bug: #1783378"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5f7c97a3_3a943ee7","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":60},"updated":"2018-07-24 20:47:38.000000000","message":"Would you provide a link for this change, and include it in the commit message as a reference?","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"}],"neutron/agent/linux/iptables_firewall.py":[{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"e1a9eea7d4fc2f176793fad833c44ca58db8796b","unresolved":false,"context_lines":[{"line_number":669,"context_line":"            comment\u003dic.ALLOW_ASSOC)]"},{"line_number":670,"context_line":"        return iptables_rules"},{"line_number":671,"context_line":""},{"line_number":672,"context_line":"    def _get_local_protocol_map(self, index_type, iptables_protocol_map):"},{"line_number":673,"context_line":"        class protoent(ctypes.Structure):"},{"line_number":674,"context_line":"            _fields_ \u003d [(\"p_name\", ctypes.c_char_p),"},{"line_number":675,"context_line":"                        (\"p_aliases\", ctypes.POINTER(ctypes.c_char_p)),"},{"line_number":676,"context_line":"                        (\"p_proto\", ctypes.c_int)]"},{"line_number":677,"context_line":"        libc.getprotoent.restype \u003d ctypes.POINTER(protoent)"},{"line_number":678,"context_line":"        libc.setprotoent(0)"},{"line_number":679,"context_line":"        while True:"},{"line_number":680,"context_line":"            pr \u003d libc.getprotoent()"},{"line_number":681,"context_line":"            if not pr:"},{"line_number":682,"context_line":"                break"},{"line_number":683,"context_line":"            r \u003d pr[0]"},{"line_number":684,"context_line":"            if index_type \u003d\u003d \"id\":"},{"line_number":685,"context_line":"                iptables_protocol_map[r.p_name] \u003d r.p_proto"},{"line_number":686,"context_line":"            else:"},{"line_number":687,"context_line":"                iptables_protocol_map[r.p_proto] \u003d r.p_name"},{"line_number":688,"context_line":"        libc.endprotoent()"},{"line_number":689,"context_line":"        return iptables_protocol_map"},{"line_number":690,"context_line":""},{"line_number":691,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":692,"context_line":"        iptables_rule \u003d []"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f7c97a3_78a28b99","line":689,"range":{"start_line":672,"start_character":8,"end_line":689,"end_character":36},"updated":"2018-07-26 16:19:41.000000000","message":"I think I should move this elsewhere and it should be parsed only on startup.  I think at this point , /etc/protocols will get parsed at every time _protocol_args is called .  It\u0027s pretty fast but it would be cleaner to put it elsewhere.  What do you think ?","commit_id":"5b3e664a3dd9abfacf69ef083cb6257fe02df6e3"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"76e33fc6d8ebda7007f952c5f616d1ee271a8d80","unresolved":false,"context_lines":[{"line_number":691,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":692,"context_line":"        iptables_rule \u003d []"},{"line_number":693,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map("},{"line_number":694,"context_line":"                                            n_const.IPTABLES_PROTOCOL_NAME_MAP)"},{"line_number":695,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":696,"context_line":"                                            protocol)"},{"line_number":697,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f7c97a3_03465623","line":694,"updated":"2018-07-30 09:06:58.000000000","message":"If I\u0027m reading this line right we don\u0027t just return the protocol map but also change n_const.IPTABLES_PROTOCOL_NAME_MAP in place. I find it counter-intuitive that we define a constant in one file, then we override it with a possibly different value from another and we still call it a constant. Can\u0027t we initialize the constant like above in the first place?\n\nOr am I missing something here?","commit_id":"5fb9483aae467306727d020352b9334556a053b6"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"5165e646677a441d08f3dc2f701c3bac580ebe1f","unresolved":false,"context_lines":[{"line_number":691,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":692,"context_line":"        iptables_rule \u003d []"},{"line_number":693,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map("},{"line_number":694,"context_line":"                                            n_const.IPTABLES_PROTOCOL_NAME_MAP)"},{"line_number":695,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":696,"context_line":"                                            protocol)"},{"line_number":697,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f7c97a3_4bcd40b8","line":694,"in_reply_to":"5f7c97a3_03465623","updated":"2018-07-30 13:29:11.000000000","message":"Well, I changed the rspf protocol to cphb and 2 reviewer complained about their legacy /etc/protocol so I tried to evolve my patch to satisfy everybody where we would have a default constants definition and we would then align them with /etc/protocols.   I think the constants part is bad if the values are readily available in /etc/protocols so we could keep only the exceptions in that constants array and drop the other values that are maintained upstream by each distros (and iptables uses /etc/protocols because it uses getprotoent and such).\n\nWhat\u0027s your though on this ?   I just didn\u0027t want to create an intermerdiary array so I simply pass the constants as an argument to a function and return a new array.  They are still /etc/protocols constants though so we\u0027re not lying here.","commit_id":"5fb9483aae467306727d020352b9334556a053b6"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"21550aefb3754eb9c5f8893887634b907e725f8f","unresolved":false,"context_lines":[{"line_number":691,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":692,"context_line":"        iptables_rule \u003d []"},{"line_number":693,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map("},{"line_number":694,"context_line":"                                            n_const.IPTABLES_PROTOCOL_NAME_MAP)"},{"line_number":695,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":696,"context_line":"                                            protocol)"},{"line_number":697,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f7c97a3_c16a9116","line":694,"in_reply_to":"5f7c97a3_4bcd40b8","updated":"2018-07-30 15:08:56.000000000","message":"First, I don\u0027t properly understand why we have two protocol name aliases here and which one is preferred in what conditions. So I\u0027m not commenting on that.\n\nMy question is this: Do you realize that in the code above in Python n_const.IPTABLES_PROTOCOL_NAME_MAP gets modified? That the return value is not a \"new array\", but the dict that was passed in? Is that intentional?","commit_id":"5fb9483aae467306727d020352b9334556a053b6"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"fa98621cc28d9d616bd0c3770c027d021a299ebe","unresolved":false,"context_lines":[{"line_number":691,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":692,"context_line":"        iptables_rule \u003d []"},{"line_number":693,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map("},{"line_number":694,"context_line":"                                            n_const.IPTABLES_PROTOCOL_NAME_MAP)"},{"line_number":695,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":696,"context_line":"                                            protocol)"},{"line_number":697,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f7c97a3_2d2b25ea","line":694,"in_reply_to":"5f7c97a3_c14db193","updated":"2018-07-31 09:06:33.000000000","message":"Okay, that\u0027s what I wanted to call your attention to. Here\u0027s a random blog post explaining this part of Python:\n\nhttps://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/\n\nHope it helps.","commit_id":"5fb9483aae467306727d020352b9334556a053b6"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"9eea67ac67e48e4df94c5ae408f63a808cd79ce3","unresolved":false,"context_lines":[{"line_number":691,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":692,"context_line":"        iptables_rule \u003d []"},{"line_number":693,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map("},{"line_number":694,"context_line":"                                            n_const.IPTABLES_PROTOCOL_NAME_MAP)"},{"line_number":695,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":696,"context_line":"                                            protocol)"},{"line_number":697,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"}],"source_content_type":"text/x-python","patch_set":17,"id":"5f7c97a3_c14db193","line":694,"in_reply_to":"5f7c97a3_c16a9116","updated":"2018-07-30 15:14:49.000000000","message":"No it\u0027s not intentional.  I\u0027m not a python coder and I though it was passing the content of the array and it was copied in the new array and then that new array was returned to the caller.","commit_id":"5fb9483aae467306727d020352b9334556a053b6"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":670,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"},{"line_number":671,"context_line":"        if rule_protocol:"},{"line_number":672,"context_line":"            iptables_rule \u003d [\u0027-p\u0027, rule_protocol]"},{"line_number":673,"context_line":""},{"line_number":674,"context_line":"            if (is_port and rule_protocol in constants.IPTABLES_PROTOCOL_MAP):"},{"line_number":675,"context_line":"                # iptables adds \u0027-m protocol\u0027 when the port number is specified"},{"line_number":676,"context_line":"                iptables_rule +\u003d [\u0027-m\u0027,"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_e6ea3a9f","side":"PARENT","line":673,"updated":"2018-07-30 20:19:31.000000000","message":"random whitespace change","commit_id":"ca13e651c972c4eea5c00e1a84b504e0a34afc55"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":45,"context_line":"                     SPOOF_FILTER: \u0027s\u0027}"},{"line_number":46,"context_line":"IPSET_DIRECTION \u003d {constants.INGRESS_DIRECTION: \u0027src\u0027,"},{"line_number":47,"context_line":"                   constants.EGRESS_DIRECTION: \u0027dst\u0027}"},{"line_number":48,"context_line":"comment_rule \u003d iptables_manager.comment_rule"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"libc \u003d ctypes.CDLL(util.find_library(\u0027libc.so.6\u0027))"},{"line_number":51,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_46768e41","line":48,"updated":"2018-07-30 20:19:31.000000000","message":"You should use a global value for this, so you only need to build the protocol mapping table once.  Something like this here:\n\n_IPTABLES_PROTOCOL_NAME_MAP \u003d None","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":671,"context_line":"            comment\u003dic.ALLOW_ASSOC)]"},{"line_number":672,"context_line":"        return iptables_rules"},{"line_number":673,"context_line":""},{"line_number":674,"context_line":"    def _get_local_protocol_map(self):"},{"line_number":675,"context_line":"        iptables_protocol_map\u003dn_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            class protoent(ctypes.Structure):"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_06a17692","line":674,"updated":"2018-07-30 20:19:31.000000000","message":"Then something like this here:\n\nglobal _IPTABLES_PROTOCOL_NAME_MAP\nif _IPTABLES_PROTOCOL_NAME_MAP:\n    return _IPTABLES_PROTOCOL_NAME_MAP\n\nelse do the work and assign _IPTABLES_PROTOCOL_NAME_MAP","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":672,"context_line":"        return iptables_rules"},{"line_number":673,"context_line":""},{"line_number":674,"context_line":"    def _get_local_protocol_map(self):"},{"line_number":675,"context_line":"        iptables_protocol_map\u003dn_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            class protoent(ctypes.Structure):"},{"line_number":678,"context_line":"                _fields_ \u003d [(\"p_name\", ctypes.c_char_p),"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_46376e4c","line":675,"range":{"start_line":675,"start_character":29,"end_line":675,"end_character":30},"updated":"2018-07-30 20:19:31.000000000","message":"I\u0027ll bet putting spaces around the equals will fix the pep8 error.","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":679,"context_line":"                            (\"p_aliases\", ctypes.POINTER(ctypes.c_char_p)),"},{"line_number":680,"context_line":"                            (\"p_proto\", ctypes.c_int)]"},{"line_number":681,"context_line":"            libc.getprotoent.restype \u003d ctypes.POINTER(protoent)"},{"line_number":682,"context_line":"            libc.setprotoent(0)"},{"line_number":683,"context_line":"            while True:"},{"line_number":684,"context_line":"                pr \u003d libc.getprotoent()"},{"line_number":685,"context_line":"                if not pr:"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_86aee67d","line":682,"updated":"2018-07-30 20:19:31.000000000","message":"I did find https://bugs.python.org/issue24809 which suggested adding this to the socket library back in 2015, so maybe in a few years we can use that :(","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":688,"context_line":"                iptables_protocol_map[r.p_proto] \u003d r.p_name"},{"line_number":689,"context_line":"            libc.endprotoent()"},{"line_number":690,"context_line":"        except Exception:"},{"line_number":691,"context_line":"            LOG.exception(\"Unable to get protocol map from libc\")"},{"line_number":692,"context_line":"        return iptables_protocol_map"},{"line_number":693,"context_line":""},{"line_number":694,"context_line":"    def _protocol_arg(self, protocol, is_port):"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_46f20e9d","line":691,"range":{"start_line":691,"start_character":63,"end_line":691,"end_character":64},"updated":"2018-07-30 20:19:31.000000000","message":", using existing mapping\"","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":695,"context_line":"        iptables_rule \u003d []"},{"line_number":696,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map()"},{"line_number":697,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":698,"context_line":"                                            protocol)"},{"line_number":699,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"},{"line_number":700,"context_line":"        if rule_protocol:"},{"line_number":701,"context_line":"            iptables_rule \u003d [\u0027-p\u0027, rule_protocol]"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_c62b7ee7","line":698,"updated":"2018-07-30 20:19:31.000000000","message":"nit, this can be on previous line","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":670,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"},{"line_number":671,"context_line":"        if rule_protocol:"},{"line_number":672,"context_line":"            iptables_rule \u003d [\u0027-p\u0027, rule_protocol]"},{"line_number":673,"context_line":""},{"line_number":674,"context_line":"            if (is_port and rule_protocol in constants.IPTABLES_PROTOCOL_MAP):"},{"line_number":675,"context_line":"                # iptables adds \u0027-m protocol\u0027 when the port number is specified"},{"line_number":676,"context_line":"                iptables_rule +\u003d [\u0027-m\u0027,"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_641e060e","side":"PARENT","line":673,"updated":"2018-08-02 18:15:05.000000000","message":"nit: extraneous change","commit_id":"ca13e651c972c4eea5c00e1a84b504e0a34afc55"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import collections"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"import copy"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"import ctypes"},{"line_number":21,"context_line":"from ctypes import util"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_24b80e10","line":18,"updated":"2018-08-02 18:15:05.000000000","message":"this is unused, one of the pep8 errors","commit_id":"23fcc4989b399372283e2c9d82ac4ef8607e7905"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":677,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":678,"context_line":"        if _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":679,"context_line":"            return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":680,"context_line":"        _IPTABLES_PROTOCOL_NAME_MAP \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":681,"context_line":"        try:"},{"line_number":682,"context_line":"            class protoent(ctypes.Structure):"},{"line_number":683,"context_line":"                _fields_ \u003d [(\"p_name\", ctypes.c_char_p),"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_44618aa1","line":680,"range":{"start_line":680,"start_character":8,"end_line":680,"end_character":35},"updated":"2018-08-02 18:15:05.000000000","message":"you might just want to use a local variable here, then do the assignment on the last line, that way an intermediate call won\u0027t return a stale value.","commit_id":"23fcc4989b399372283e2c9d82ac4ef8607e7905"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":694,"context_line":"            libc.endprotoent()"},{"line_number":695,"context_line":"        except Exception:"},{"line_number":696,"context_line":"            LOG.exception(\"Unable to get protocol map from libc\")"},{"line_number":697,"context_line":"        return iptables_protocol_map"},{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":700,"context_line":"        iptables_rule \u003d []"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_244d6e3b","line":697,"range":{"start_line":697,"start_character":15,"end_line":697,"end_character":36},"updated":"2018-08-02 18:15:05.000000000","message":"_IPTABLES_PROTOCOL_NAME_MAP","commit_id":"23fcc4989b399372283e2c9d82ac4ef8607e7905"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":700,"context_line":"        iptables_rule \u003d []"},{"line_number":701,"context_line":"        protocol_id_map \u003d self._get_local_protocol_map()"},{"line_number":702,"context_line":"        rule_protocol \u003d protocol_id_map.get(protocol,"},{"line_number":703,"context_line":"                                            protocol)"},{"line_number":704,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"},{"line_number":705,"context_line":"        if rule_protocol:"},{"line_number":706,"context_line":"            iptables_rule \u003d [\u0027-p\u0027, rule_protocol]"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_64f5a6cb","line":703,"range":{"start_line":703,"start_character":44,"end_line":703,"end_character":52},"updated":"2018-08-02 18:15:05.000000000","message":"nit: can be on previous line","commit_id":"23fcc4989b399372283e2c9d82ac4ef8607e7905"},{"author":{"_account_id":27654,"name":"Hongbin Lu","email":"kira034@163.com","username":"hongbin.lu"},"change_message_id":"4609ff26e8a5fffb29a20d6c9017a71207d97515","unresolved":false,"context_lines":[{"line_number":671,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":672,"context_line":"        if _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":673,"context_line":"            return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":674,"context_line":"        iptables_protocol_name_map \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":675,"context_line":"        try:"},{"line_number":676,"context_line":"            class protoent(ctypes.Structure):"},{"line_number":677,"context_line":"                _fields_ \u003d [(\"p_name\", ctypes.c_char_p),"}],"source_content_type":"text/x-python","patch_set":24,"id":"5f7c97a3_42763e94","line":674,"range":{"start_line":674,"start_character":8,"end_line":674,"end_character":34},"updated":"2018-08-01 22:00:29.000000000","message":"I print this variable at this point (before merging), the output is: http://paste.openstack.org/show/727095/","commit_id":"6e36bb9b7852ac503ff5c58feb968420c71bc079"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"5333b466c76a68be51e3885ed84773a4bef371b0","unresolved":false,"context_lines":[{"line_number":676,"context_line":"            class protoent(ctypes.Structure):"},{"line_number":677,"context_line":"                _fields_ \u003d [(\"p_name\", ctypes.c_char_p),"},{"line_number":678,"context_line":"                            (\"p_aliases\", ctypes.POINTER(ctypes.c_char_p)),"},{"line_number":679,"context_line":"                            (\"p_proto\", ctypes.c_int)]"},{"line_number":680,"context_line":"            libc.getprotoent.restype \u003d ctypes.POINTER(protoent)"},{"line_number":681,"context_line":"            libc.setprotoent(0)"},{"line_number":682,"context_line":"            while True:"}],"source_content_type":"text/x-python","patch_set":24,"id":"5f7c97a3_fbc5a736","line":679,"range":{"start_line":679,"start_character":51,"end_line":679,"end_character":52},"updated":"2018-08-02 14:58:02.000000000","message":"So couldn\u0027t we change c_int to c_char_p ?  Or cover r.p_proto to string before using it ?  That would solve this issue.","commit_id":"6e36bb9b7852ac503ff5c58feb968420c71bc079"},{"author":{"_account_id":27654,"name":"Hongbin Lu","email":"kira034@163.com","username":"hongbin.lu"},"change_message_id":"4609ff26e8a5fffb29a20d6c9017a71207d97515","unresolved":false,"context_lines":[{"line_number":688,"context_line":"            libc.endprotoent()"},{"line_number":689,"context_line":"        except Exception:"},{"line_number":690,"context_line":"            LOG.exception(\"Unable to get protocol map from libc\")"},{"line_number":691,"context_line":"        _IPTABLES_PROTOCOL_NAME_MAP \u003d iptables_protocol_name_map"},{"line_number":692,"context_line":"        return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":693,"context_line":""},{"line_number":694,"context_line":"    def _protocol_arg(self, protocol, is_port):"}],"source_content_type":"text/x-python","patch_set":24,"id":"5f7c97a3_e2abcad0","line":691,"range":{"start_line":691,"start_character":38,"end_line":691,"end_character":64},"updated":"2018-08-01 22:00:29.000000000","message":"I print this variable again in here (after the merging), the output is: http://paste.openstack.org/show/727096/ .\n\nBy comparing the output of two prints, it looks the result is not merged correct.","commit_id":"6e36bb9b7852ac503ff5c58feb968420c71bc079"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"062ec8eccfc116a4efc80590e80fea57a4bab9a8","unresolved":false,"context_lines":[{"line_number":688,"context_line":"            libc.endprotoent()"},{"line_number":689,"context_line":"        except Exception:"},{"line_number":690,"context_line":"            LOG.exception(\"Unable to get protocol map from libc\")"},{"line_number":691,"context_line":"        _IPTABLES_PROTOCOL_NAME_MAP \u003d iptables_protocol_name_map"},{"line_number":692,"context_line":"        return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":693,"context_line":""},{"line_number":694,"context_line":"    def _protocol_arg(self, protocol, is_port):"}],"source_content_type":"text/x-python","patch_set":24,"id":"5f7c97a3_547ef8e1","line":691,"range":{"start_line":691,"start_character":38,"end_line":691,"end_character":64},"in_reply_to":"5f7c97a3_e2abcad0","updated":"2018-08-02 07:35:25.000000000","message":"I think that\u0027s a type mismatch. n_const.IPTABLES_PROTOCOL_NAME_MAP has decimal string keys, while iptables_protocol_name_map has integer keys.","commit_id":"6e36bb9b7852ac503ff5c58feb968420c71bc079"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":688,"context_line":"                if not pr:"},{"line_number":689,"context_line":"                    break"},{"line_number":690,"context_line":"                r \u003d pr[0]"},{"line_number":691,"context_line":"                _IPTABLES_PROTOCOL_NAME_MAP[\"r.p_proto\"] \u003d r.p_name"},{"line_number":692,"context_line":"            libc.endprotoent()"},{"line_number":693,"context_line":"        except Exception:"},{"line_number":694,"context_line":"            LOG.exception(\"Unable to get protocol map from libc\")"}],"source_content_type":"text/x-python","patch_set":27,"id":"5f7c97a3_5eb3640a","line":691,"range":{"start_line":691,"start_character":44,"end_line":691,"end_character":55},"updated":"2018-08-02 18:15:05.000000000","message":"this should be str(r.p_proto) to make the integer a string","commit_id":"e6b04a1d25740083f54f6ecb803a0af77b165f41"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"69eb47bfc031cac39ba283964ae8d7e7e124d2b7","unresolved":false,"context_lines":[{"line_number":667,"context_line":"            comment\u003dic.ALLOW_ASSOC)]"},{"line_number":668,"context_line":"        return iptables_rules"},{"line_number":669,"context_line":""},{"line_number":670,"context_line":"    def _get_local_protocol_map(self):"},{"line_number":671,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":672,"context_line":"        if _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":673,"context_line":"            return _IPTABLES_PROTOCOL_NAME_MAP"}],"source_content_type":"text/x-python","patch_set":29,"id":"5f7c97a3_01c90d51","line":670,"updated":"2018-08-02 18:39:29.000000000","message":"Maybe change this to get_local_protocol_name(self, protocol)","commit_id":"1a7dd4279fd9a46faa1665ad7bb85eef6bc47a8e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"8ebf29dd3cdefd3923e1e1203d9cbf4c849876ef","unresolved":false,"context_lines":[{"line_number":669,"context_line":""},{"line_number":670,"context_line":"    def _get_local_protocol_map(self):"},{"line_number":671,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":672,"context_line":"        if _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":673,"context_line":"            return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":674,"context_line":"        iptables_protocol_name_map \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":675,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":29,"id":"5f7c97a3_815afd82","line":672,"updated":"2018-08-02 18:42:39.000000000","message":"Dave mentioned we should do this early, say from __init__().  That would be good.  To make it easy we could move all the code below into a separate method, then this \"get\" one is very small:\n\nglobal...\nif not _IPTABLES...\n    init\nreturn _IPTABLE...get(protocol, protocol)","commit_id":"1a7dd4279fd9a46faa1665ad7bb85eef6bc47a8e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d4976a0a4845dcdcd44d61310c573dc1aa487893","unresolved":false,"context_lines":[{"line_number":669,"context_line":""},{"line_number":670,"context_line":"    def _get_local_protocol_map(self):"},{"line_number":671,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":672,"context_line":"        if _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":673,"context_line":"            return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":674,"context_line":"        iptables_protocol_name_map \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":675,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":29,"id":"5f7c97a3_a1c4d90e","line":672,"in_reply_to":"5f7c97a3_815afd82","updated":"2018-08-02 18:43:45.000000000","message":"Of course the init should have already been done, but just in case...","commit_id":"1a7dd4279fd9a46faa1665ad7bb85eef6bc47a8e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"69eb47bfc031cac39ba283964ae8d7e7e124d2b7","unresolved":false,"context_lines":[{"line_number":670,"context_line":"    def _get_local_protocol_map(self):"},{"line_number":671,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":672,"context_line":"        if _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":673,"context_line":"            return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":674,"context_line":"        iptables_protocol_name_map \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":675,"context_line":"        try:"},{"line_number":676,"context_line":"            class protoent(ctypes.Structure):"}],"source_content_type":"text/x-python","patch_set":29,"id":"5f7c97a3_c1d235ff","line":673,"updated":"2018-08-02 18:39:29.000000000","message":"and:\n\nreturn _IPTABLES_PROTOCOL_NAME_MAP.get(protocol, protocol)","commit_id":"1a7dd4279fd9a46faa1665ad7bb85eef6bc47a8e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"69eb47bfc031cac39ba283964ae8d7e7e124d2b7","unresolved":false,"context_lines":[{"line_number":692,"context_line":"        except Exception:"},{"line_number":693,"context_line":"            LOG.exception(\"Unable to get protocol map from libc\")"},{"line_number":694,"context_line":"        _IPTABLES_PROTOCOL_NAME_MAP \u003d iptables_protocol_name_map"},{"line_number":695,"context_line":"        return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":696,"context_line":""},{"line_number":697,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":698,"context_line":"        iptables_rule \u003d []"}],"source_content_type":"text/x-python","patch_set":29,"id":"5f7c97a3_e1cf3152","line":695,"updated":"2018-08-02 18:39:29.000000000","message":"Here too.","commit_id":"1a7dd4279fd9a46faa1665ad7bb85eef6bc47a8e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"69eb47bfc031cac39ba283964ae8d7e7e124d2b7","unresolved":false,"context_lines":[{"line_number":713,"context_line":"        if port_range_min is None:"},{"line_number":714,"context_line":"            return args"},{"line_number":715,"context_line":""},{"line_number":716,"context_line":"        protocol \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.get(protocol, protocol)"},{"line_number":717,"context_line":"        if protocol in [\u0027icmp\u0027, \u0027ipv6-icmp\u0027]:"},{"line_number":718,"context_line":"            protocol_type \u003d \u0027icmpv6\u0027 if protocol \u003d\u003d \u0027ipv6-icmp\u0027 else \u0027icmp\u0027"},{"line_number":719,"context_line":"            # Note(xuhanp): port_range_min/port_range_max represent"}],"source_content_type":"text/x-python","patch_set":29,"id":"5f7c97a3_41aaa56d","line":716,"updated":"2018-08-02 18:39:29.000000000","message":"Guess we missed this one...\n\nAlso, if we are making a call to get the array, then using just the protocol value, we should probably just create a get_local_protocol_name(protocol) method, see above.","commit_id":"1a7dd4279fd9a46faa1665ad7bb85eef6bc47a8e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"fae45b389ec3e2e9c1b5297905c38fbf9e2863f4","unresolved":false,"context_lines":[{"line_number":686,"context_line":"                # protocol \u00270\u0027 uses no -p argument"},{"line_number":687,"context_line":"                if r.p_proto \u003d\u003d 0:"},{"line_number":688,"context_line":"                    continue"},{"line_number":689,"context_line":"                iptables_protocol_name_map[str(r.p_proto)] \u003d r.p_name"},{"line_number":690,"context_line":"            libc.endprotoent()"},{"line_number":691,"context_line":"        except Exception:"},{"line_number":692,"context_line":"            LOG.exception(\"Unable to create iptables protocol map\")"}],"source_content_type":"text/x-python","patch_set":32,"id":"3f79a3b5_97aa4617","line":689,"updated":"2018-08-03 18:20:34.000000000","message":"So this line is returning bytes in py35, not a string, causing _convert_sgr_to_iptables_rules to generate something like this:\n\nargs: [\u0027-d\u0027, \u002710.0.0.0/24\u0027, \u0027-p\u0027, b\u0027icmp\u0027, \u0027-m\u0027, \u0027multiport\u0027, \u0027--dports\u0027, \u00278:0\u0027, \u0027-j RETURN\u0027]\"\n\nOne possible solution is to:\n\n    from neutron_lib.utils import helpers\n\n    iptables_protocol_name_map[str(r.p_proto)] \u003d helpers.safe_decode_utf8(r.p_name)\n\nThere might be other ways but quickly playing with the _fields_ types above just got me a core dump.","commit_id":"3ea35f3dc7271263adc5857692b887493f935ac7"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"b67ebb3bc3de94d07507b823c9175ca42c5e04ef","unresolved":false,"context_lines":[{"line_number":684,"context_line":"                r \u003d pr[0]"},{"line_number":685,"context_line":"                p_name \u003d helpers.safe_decode_utf8(r.p_name)"},{"line_number":686,"context_line":"                local_protocol_name_map[str(r.p_proto)] \u003d p_name"},{"line_number":687,"context_line":"            libc.endprotoent()"},{"line_number":688,"context_line":"        except Exception:"},{"line_number":689,"context_line":"            LOG.exception(\"Unable to create local protocol name map\")"},{"line_number":690,"context_line":"        return local_protocol_name_map"}],"source_content_type":"text/x-python","patch_set":34,"id":"3f79a3b5_91a8cedb","line":687,"updated":"2018-08-08 07:22:29.000000000","message":"Shouldn\u0027t You end this in \"finally\" clause? Will it be no problem if exception will be raised somewhere and that will not be ended properly?","commit_id":"fc87f0c713f58cd10db2eecad1585e271ac1e853"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"92723eba91ba711e5874ccece86fc2e57a1391d3","unresolved":false,"context_lines":[{"line_number":684,"context_line":"                r \u003d pr[0]"},{"line_number":685,"context_line":"                p_name \u003d helpers.safe_decode_utf8(r.p_name)"},{"line_number":686,"context_line":"                local_protocol_name_map[str(r.p_proto)] \u003d p_name"},{"line_number":687,"context_line":"            libc.endprotoent()"},{"line_number":688,"context_line":"        except Exception:"},{"line_number":689,"context_line":"            LOG.exception(\"Unable to create local protocol name map\")"},{"line_number":690,"context_line":"        return local_protocol_name_map"}],"source_content_type":"text/x-python","patch_set":34,"id":"3f79a3b5_ce5e9d11","line":687,"in_reply_to":"3f79a3b5_88573c03","updated":"2018-08-08 13:35:32.000000000","message":"I\u0027m not expecting any exceptions but since we\u0027re using ctypes/libc calls, I wanted to make sure that if ANYTHING happens, we at least know it ...  It could be a LOG.info instead of LOG.exception.","commit_id":"fc87f0c713f58cd10db2eecad1585e271ac1e853"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"92723eba91ba711e5874ccece86fc2e57a1391d3","unresolved":false,"context_lines":[{"line_number":684,"context_line":"                r \u003d pr[0]"},{"line_number":685,"context_line":"                p_name \u003d helpers.safe_decode_utf8(r.p_name)"},{"line_number":686,"context_line":"                local_protocol_name_map[str(r.p_proto)] \u003d p_name"},{"line_number":687,"context_line":"            libc.endprotoent()"},{"line_number":688,"context_line":"        except Exception:"},{"line_number":689,"context_line":"            LOG.exception(\"Unable to create local protocol name map\")"},{"line_number":690,"context_line":"        return local_protocol_name_map"}],"source_content_type":"text/x-python","patch_set":34,"id":"3f79a3b5_8e798594","line":687,"in_reply_to":"3f79a3b5_91a8cedb","updated":"2018-08-08 13:35:32.000000000","message":"Is this better now ?","commit_id":"fc87f0c713f58cd10db2eecad1585e271ac1e853"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"1257e5ba4f3eede9c3832b3d9db9768bad5674e1","unresolved":false,"context_lines":[{"line_number":684,"context_line":"                r \u003d pr[0]"},{"line_number":685,"context_line":"                p_name \u003d helpers.safe_decode_utf8(r.p_name)"},{"line_number":686,"context_line":"                local_protocol_name_map[str(r.p_proto)] \u003d p_name"},{"line_number":687,"context_line":"            libc.endprotoent()"},{"line_number":688,"context_line":"        except Exception:"},{"line_number":689,"context_line":"            LOG.exception(\"Unable to create local protocol name map\")"},{"line_number":690,"context_line":"        return local_protocol_name_map"}],"source_content_type":"text/x-python","patch_set":34,"id":"3f79a3b5_88573c03","line":687,"in_reply_to":"3f79a3b5_91a8cedb","updated":"2018-08-08 13:01:33.000000000","message":"We may also ask what exceptions are we expecting here and why are we suppressing all of them regardless of what we\u0027ve got (except Exception).","commit_id":"fc87f0c713f58cd10db2eecad1585e271ac1e853"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"089c0ea57065f0c1d5eb8f6762d624d90e690f0b","unresolved":false,"context_lines":[{"line_number":668,"context_line":"            comment\u003dic.ALLOW_ASSOC)]"},{"line_number":669,"context_line":"        return iptables_rules"},{"line_number":670,"context_line":""},{"line_number":671,"context_line":"    def _local_protocol_name_map(self):"},{"line_number":672,"context_line":"        local_protocol_name_map \u003d {}"},{"line_number":673,"context_line":"        try:"},{"line_number":674,"context_line":"            class protoent(ctypes.Structure):"},{"line_number":675,"context_line":"                _fields_ \u003d [(\"p_name\", ctypes.c_char_p),"},{"line_number":676,"context_line":"                            (\"p_aliases\", ctypes.POINTER(ctypes.c_char_p)),"},{"line_number":677,"context_line":"                            (\"p_proto\", ctypes.c_int)]"},{"line_number":678,"context_line":"            libc.getprotoent.restype \u003d ctypes.POINTER(protoent)"},{"line_number":679,"context_line":"            libc.setprotoent(0)"},{"line_number":680,"context_line":"            while True:"},{"line_number":681,"context_line":"                pr \u003d libc.getprotoent()"},{"line_number":682,"context_line":"                if not pr:"},{"line_number":683,"context_line":"                    break"},{"line_number":684,"context_line":"                r \u003d pr[0]"},{"line_number":685,"context_line":"                p_name \u003d helpers.safe_decode_utf8(r.p_name)"},{"line_number":686,"context_line":"                local_protocol_name_map[str(r.p_proto)] \u003d p_name"},{"line_number":687,"context_line":"            libc.endprotoent()"},{"line_number":688,"context_line":"        except Exception:"},{"line_number":689,"context_line":"            LOG.exception(\"Unable to create local protocol name map\")"},{"line_number":690,"context_line":"        return local_protocol_name_map"},{"line_number":691,"context_line":""},{"line_number":692,"context_line":"    def _protocol_name_map(self):"},{"line_number":693,"context_line":"        global _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":694,"context_line":"        if not _IPTABLES_PROTOCOL_NAME_MAP:"},{"line_number":695,"context_line":"            tmp_map \u003d n_const.IPTABLES_PROTOCOL_NAME_MAP.copy()"},{"line_number":696,"context_line":"            tmp_map.update(self._local_protocol_name_map())"},{"line_number":697,"context_line":"            _IPTABLES_PROTOCOL_NAME_MAP \u003d tmp_map"},{"line_number":698,"context_line":"        return _IPTABLES_PROTOCOL_NAME_MAP"},{"line_number":699,"context_line":""},{"line_number":700,"context_line":"    def _iptables_protocol_name(self, protocol):"},{"line_number":701,"context_line":"        # protocol zero is a special case and requires no \u0027-p\u0027"},{"line_number":702,"context_line":"        if protocol and protocol !\u003d \u00270\u0027:"},{"line_number":703,"context_line":"            return self._protocol_name_map().get(protocol, protocol)"},{"line_number":704,"context_line":""},{"line_number":705,"context_line":"    def _protocol_arg(self, protocol, is_port):"},{"line_number":706,"context_line":"        iptables_rule \u003d []"}],"source_content_type":"text/x-python","patch_set":34,"id":"3f79a3b5_2eccf1ba","line":703,"range":{"start_line":671,"start_character":2,"end_line":703,"end_character":68},"updated":"2018-08-08 13:37:44.000000000","message":"I like the refactoring.   I was thinking about that the other day and I didn\u0027t like the single-do-it-all function and this is better... a bit harder to read but that\u0027s how good code should look like!","commit_id":"fc87f0c713f58cd10db2eecad1585e271ac1e853"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"fb62e8c0fcc540337cd81ad8f999f9d7129fc661","unresolved":false,"context_lines":[{"line_number":686,"context_line":"                r \u003d pr[0]"},{"line_number":687,"context_line":"                p_name \u003d helpers.safe_decode_utf8(r.p_name)"},{"line_number":688,"context_line":"                local_protocol_name_map[str(r.p_proto)] \u003d p_name"},{"line_number":689,"context_line":"        finally:"},{"line_number":690,"context_line":"            libc.endprotoent()"},{"line_number":691,"context_line":"        except:"},{"line_number":692,"context_line":"            LOG.exception(\"Unable to create local protocol name map: %s\", sys.exc_info()[0])"},{"line_number":693,"context_line":"        return local_protocol_name_map"}],"source_content_type":"text/x-python","patch_set":35,"id":"3f79a3b5_4eb92de7","line":690,"range":{"start_line":689,"start_character":9,"end_line":690,"end_character":30},"updated":"2018-08-08 13:45:18.000000000","message":"finally block is typically after the except one so it\u0027s obvious it\u0027s always done last.","commit_id":"9a4142faf68637020d8f87d0f852c6de8587b5b2"}],"neutron/common/constants.py":[{"author":{"_account_id":27654,"name":"Hongbin Lu","email":"kira034@163.com","username":"hongbin.lu"},"change_message_id":"1d6bef449417df095cf8ee223be834e625cb3fa6","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_3a62fe16","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"updated":"2018-07-24 20:47:38.000000000","message":"Just want to confirm. Would this change be compatible with the legacy OS?","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"d5d62f618af7ade01545cd833343287d52ba26a7","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d5eaaf75","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"in_reply_to":"5f7c97a3_154a67ac","updated":"2018-07-25 10:51:08.000000000","message":"Debian has cphb too: \n\nhttps://lists.debian.org/lsb-discuss/2000/08/msg00008.html","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"fea3cf72955c1a83b52b2db679fb7f1d81487118","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d0707daa","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"in_reply_to":"5f7c97a3_35f3e36f","updated":"2018-07-25 11:07:51.000000000","message":"In C++, we can include netdb.h ... is there a similar thing with python ?","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"bb57d2df69811935f92eaf352b106fc1da700688","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_bc9b6077","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"in_reply_to":"5f7c97a3_3a62fe16","updated":"2018-07-25 08:31:39.000000000","message":"+1\n\ni suspect it needs some mechanism to handle multiple possibilities, rather than a simple update.","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"c19af44fe945569d9f468b67e160670ba78a99db","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_154a67ac","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"in_reply_to":"5f7c97a3_bc9b6077","updated":"2018-07-25 10:49:19.000000000","message":"Well we could always parse /etc/protocols in order to get the protocol list instead of hard coding them.   Unless that file doesn\u0027t exist, then we should use the hardcoded values here but protocol 73 is no longer rspf and is now cphb ... ;)","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"a34f0276b7f5ca9183a55e15056a715825fb5955","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d095dd95","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"in_reply_to":"5f7c97a3_d0707daa","updated":"2018-07-25 11:10:01.000000000","message":"Something a la https://mail.python.org/pipermail/python-list/2012-June/625276.html would do ain\u0027t it ?","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"3da7ebc6e57a243a19201191b67ed0dd7ac7b377","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                              \u002758\u0027: \u0027ipv6-icmp\u0027,"},{"line_number":110,"context_line":"                              \u002759\u0027: \u0027ipv6-nonxt\u0027,"},{"line_number":111,"context_line":"                              \u002760\u0027: \u0027ipv6-opts\u0027,"},{"line_number":112,"context_line":"                              \u002773\u0027: \u0027cphb\u0027,"},{"line_number":113,"context_line":"                              \u002781\u0027: \u0027vmtp\u0027,"},{"line_number":114,"context_line":"                              \u002788\u0027: \u0027eigrp\u0027,"},{"line_number":115,"context_line":"                              \u002789\u0027: \u0027ospf\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_35f3e36f","line":112,"range":{"start_line":112,"start_character":37,"end_line":112,"end_character":41},"in_reply_to":"5f7c97a3_d5eaaf75","updated":"2018-07-25 10:52:24.000000000","message":"IANA has cphb too (I think it\u0027s the reference):\n\nhttp://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml","commit_id":"e008130d25cfc7aac28366b42b96faad6f64aaae"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"2e9afad0b0eb6cf39cd069bcc5b2115b8c81229b","unresolved":false,"context_lines":[{"line_number":67,"context_line":"# it will need to be updated in the future:"},{"line_number":68,"context_line":"#"},{"line_number":69,"context_line":"# $ for num in {0..255}; do iptables -A INPUT -p $num; done"},{"line_number":70,"context_line":"# $ iptables-save"},{"line_number":71,"context_line":"#"},{"line_number":72,"context_line":"# These cases are special, and were found by inspection:"},{"line_number":73,"context_line":"# - \u0027ipv6-encap\u0027 uses \u0027ipv6\u0027"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_d7f4938a","line":70,"updated":"2018-07-30 16:17:53.000000000","message":"Did you run these two commands and verify this?  This mapping is used to translate numbers specified in security group rules to names used by iptables.  Without it, duplicate security group rules can be created since we are doing an exact string match on the output.\n\nIf the intent is to allow someone to use \u0027cphb\u0027 as an argument when creating a security group rule then that can be added in the neutron-lib constants file in IP_PROTOCOL_MAP, as was done for some of the ICMPv6 values.","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b2ec39445836cc01ff82d7394252e0bdd9b1f809","unresolved":false,"context_lines":[{"line_number":67,"context_line":"# it will need to be updated in the future:"},{"line_number":68,"context_line":"#"},{"line_number":69,"context_line":"# $ for num in {0..255}; do iptables -A INPUT -p $num; done"},{"line_number":70,"context_line":"# $ iptables-save"},{"line_number":71,"context_line":"#"},{"line_number":72,"context_line":"# These cases are special, and were found by inspection:"},{"line_number":73,"context_line":"# - \u0027ipv6-encap\u0027 uses \u0027ipv6\u0027"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_ab7f2b67","line":70,"in_reply_to":"5f7c97a3_807a4eec","updated":"2018-07-30 20:19:31.000000000","message":"Crap, I guess we\u0027ll need to do some tweaking then...","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"fa98621cc28d9d616bd0c3770c027d021a299ebe","unresolved":false,"context_lines":[{"line_number":67,"context_line":"# it will need to be updated in the future:"},{"line_number":68,"context_line":"#"},{"line_number":69,"context_line":"# $ for num in {0..255}; do iptables -A INPUT -p $num; done"},{"line_number":70,"context_line":"# $ iptables-save"},{"line_number":71,"context_line":"#"},{"line_number":72,"context_line":"# These cases are special, and were found by inspection:"},{"line_number":73,"context_line":"# - \u0027ipv6-encap\u0027 uses \u0027ipv6\u0027"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_cda391af","line":70,"in_reply_to":"5f7c97a3_ab7f2b67","updated":"2018-07-31 09:06:33.000000000","message":"Probably starting to better understand the need here. So what do you think about this?\n\n1) One map from protocol names to numbers. This can allow multiple names without a problem. Either all possible names can be added to a constants file. Or better since the /etc/protocols file allows aliases we can use that for multiple names and completely drop this map from the constants file.\n\n2) Another map from protocol number to canonical name. Where \"canonical\" is I guess what works with iptables. So if iptables uses getprotoent, we should too.\n\nAltogether we could iterate over getprotoent entries once and initialize both maps.\n\nDoes this makes sense?","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"3f6bce287bfc44aa4d22848e6becbd4ad89d4f30","unresolved":false,"context_lines":[{"line_number":67,"context_line":"# it will need to be updated in the future:"},{"line_number":68,"context_line":"#"},{"line_number":69,"context_line":"# $ for num in {0..255}; do iptables -A INPUT -p $num; done"},{"line_number":70,"context_line":"# $ iptables-save"},{"line_number":71,"context_line":"#"},{"line_number":72,"context_line":"# These cases are special, and were found by inspection:"},{"line_number":73,"context_line":"# - \u0027ipv6-encap\u0027 uses \u0027ipv6\u0027"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_a4765e91","line":70,"in_reply_to":"5f7c97a3_cda391af","updated":"2018-07-31 20:27:05.000000000","message":"I think the name to number mapping is only needed on the API side, where someone is adding a SG rule by name, and it\u0027s a little tricky since we don\u0027t really want to create duplicate SG rules with different names and the same number (we do slightly today and it\u0027s been a pain to slowly fix).  But it\u0027s something we can figure out just in another patch.\n\nFor this patch I\u0027d just focus on the iptables mapping since it\u0027s causing the bug, and will most likely need a backport, so keeping this a minimal change would be good.","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":7130,"name":"David Hill","email":"davidchill@hotmail.com","username":"dhill"},"change_message_id":"bfb6957da32fff787ea1a5b973db605c8149c307","unresolved":false,"context_lines":[{"line_number":67,"context_line":"# it will need to be updated in the future:"},{"line_number":68,"context_line":"#"},{"line_number":69,"context_line":"# $ for num in {0..255}; do iptables -A INPUT -p $num; done"},{"line_number":70,"context_line":"# $ iptables-save"},{"line_number":71,"context_line":"#"},{"line_number":72,"context_line":"# These cases are special, and were found by inspection:"},{"line_number":73,"context_line":"# - \u0027ipv6-encap\u0027 uses \u0027ipv6\u0027"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_807a4eec","line":70,"in_reply_to":"5f7c97a3_d7f4938a","updated":"2018-07-30 18:49:59.000000000","message":"I get better.  A customer that did all of that for us :\n\n/usr/lib/python2.7/site-packages/neutron/common/constants.py defines names for some protocols in IPTABLES_PROTOCOL_NAME_MAP\n\nDefinition of protocol number 4 and 73 are different compared to /etc/protocols:\n#/etc/protocols defined value\n/usr/lib/python2.7/site-packages/neutron/common/constants.py defined value\n\n#ipv4   4       IPv4            # IPv4 encapsulation\nipencap 4       IPv4            # IPv4 encapsulation\n#cphb   73      CPHB            # Computer Protocol Heart Beat\nrspf    73      RSPF            # Computer Protocol Heart Beat\n\nWe have a customer who has defined protocols 2-255 to security group, when neutron-openvswitch-agent tries to create matching rules iptables-manager fails to unknown protocol:\n\n2018-07-24 10:56:11.225 18538 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent ; Stdout: ; Stderr: iptables-restore v1.4.21: unknown protocol \"rspf\" specified\n2018-07-24 10:56:12.824 18538 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent ; Stdout: ; Stderr: iptables-restore v1.4.21: unknown protocol \"rspf\" specified\n2018-07-24 10:56:15.218 18538 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent ; Stdout: ; Stderr: iptables-restore v1.4.21: unknown protocol \"rspf\" specified\n2018-07-24 10:56:16.824 18538 ERROR neutron.plugins.ml2.drivers.openvswitch.agent.ovs_neutron_agent ; Stdout: ; Stderr: iptables-restore v1.4.21: unknown protocol \"rspf\" specified","commit_id":"61c10dfdec098b60406183b755b169b0b14583ed"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d05718c39beeeb85ac23e9d0f749e4d023c1996f","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                              \u00271\u0027: \u0027icmp\u0027,"},{"line_number":83,"context_line":"                              \u00272\u0027: \u0027igmp\u0027,"},{"line_number":84,"context_line":"                              \u00273\u0027: \u0027ggp\u0027,"},{"line_number":85,"context_line":"                              \u00274\u0027: \u0027ipv4\u0027,"},{"line_number":86,"context_line":"                              \u00275\u0027: \u0027st\u0027,"},{"line_number":87,"context_line":"                              \u00276\u0027: \u0027tcp\u0027,"},{"line_number":88,"context_line":"                              \u00278\u0027: \u0027egp\u0027,"}],"source_content_type":"text/x-python","patch_set":28,"id":"5f7c97a3_7eb6608f","line":85,"updated":"2018-08-02 18:15:05.000000000","message":"We should not make these changes here since it could break backwards-compatibility, plus the reading of /etc/protocols obviates the need.  We can change them in the Stein cycle.","commit_id":"25398eb0c380a55b1066d1e00579e7ac1bc474d3"}]}
