[Swan] Who changed parser.l ????

Philippe Vouters philippe.vouters at laposte.net
Tue Jan 8 17:07:47 EET 2013


Wes,

If you remember your test case, wouldn't this code in parser.l do the trick:
<<EOF>> {
         static int once = 0;
         if (once = !once) {
             stacktop->line++;
         } else if(parser_y_eof()) {
             yyterminate();
         }
}

On my side using Nick's ipsec.unmanaged.*.conf files, here is what it tells:
[philippe at victor openswan-2.6.38]$ sudo systemctl stop ipsec.service
*[philippe at victor libreswan]$ sudo make install*
[philippe at victor openswan-2.6.38]$ sudo systemctl start ipsec.service
[philippe at victor openswan-2.6.38]$ sudo /usr/local/sbin/ipsec addconn 
--verbose --autoall
opening file: /etc/ipsec.conf
debugging mode enabled
including file '/etc/ipsec.d/ipsec.*.conf'(/etc/ipsec.d/ipsec.*.conf) 
from line /etc/ipsec.conf:24
end of file /etc/ipsec.d/ipsec.unmanaged.paulin.conf
resuming /etc/ipsec.conf line 24
end of file /etc/ipsec.conf
Loading default conn
starter: case KH_NOTSET: empty
starter: case KH_NOTSET: empty
Loading conn david
Loading conn mumin
starter: case KH_DEFAULTROUTE: empty
Loading conn paulin
starter: case KH_DEFAULTROUTE: empty
loading all conns according to their auto= settings
   Pass #1: Loading auto=add and auto=route connections
  mumin
parse_src = 1, parse_gateway = 0, has_dst = 0
dst  via 192.168.1.1 dev eth0 src
dst 169.254.0.0 via  dev eth0 src
dst 192.168.1.0 via  dev eth0 src 192.168.1.2
set addr: 192.168.1.2
dst 127.0.0.0 via  dev lo src 127.0.0.1
dst 127.0.0.0 via  dev lo src 127.0.0.1
dst 127.0.0.1 via  dev lo src 127.0.0.1
dst 127.255.255.255 via  dev lo src 127.0.0.1
dst 192.168.1.0 via  dev eth0 src 192.168.1.2
dst 192.168.1.2 via  dev eth0 src 192.168.1.2
dst 192.168.1.255 via  dev eth0 src 192.168.1.2
002 "mumin": deleting connection
002 added connection description "mumin"
  paulin
parse_src = 1, parse_gateway = 0, has_dst = 0
dst  via 192.168.1.1 dev eth0 src
dst 169.254.0.0 via  dev eth0 src
dst 192.168.1.0 via  dev eth0 src 192.168.1.2
set addr: 192.168.1.2
dst 127.0.0.0 via  dev lo src 127.0.0.1
dst 127.0.0.0 via  dev lo src 127.0.0.1
dst 127.0.0.1 via  dev lo src 127.0.0.1
dst 127.255.255.255 via  dev lo src 127.0.0.1
dst 192.168.1.0 via  dev eth0 src 192.168.1.2
dst 192.168.1.2 via  dev eth0 src 192.168.1.2
dst 192.168.1.255 via  dev eth0 src 192.168.1.2
002 "paulin": deleting connection
002 added connection description "paulin"
   Pass #2: Loading auto=start connections

[philippe at victor openswan-2.6.38]$

Philippe Vouters (Fontainebleau/France)
URL: http://vouters.dyndns.org/
SIP: sip:Vouters at sip.linphone.org

Le 08/01/2013 15:51, Paul Wouters a écrit :
> On Tue, 8 Jan 2013, Philippe Vouters wrote:
>
>> Nick problem with his mumin conn is related to this change in parser.l
>> causing a premature exit on file statements.
>> <<EOF>> {
>> /*
>> * Who did remove the Openswan 2.6.38 code reproduced below and
>> * wrote this block hereafter commented out ?
>> */
>> /*
>>        static int once = 0;
>>        if (once = !once) {
>>            stacktop->line++;
>>        } else {
>>            yyterminate();
>>        }
>> */
>> /* From Openswan 2.6.38 */
>>        if(parser_y_eof()) {
>>                yyterminate();
>>        }
>>
>> }
>
> This change was made by Wes to fix an issue where the parser would crash
> if the last line in the file had no EOL.
>
>  git blame lib/libipsecconf/parser.l|grep "static int once"
> 6ca2edb0 lib/libipsecconf/parser.l (Wes Hardaker       2012-12-19
> 18:58:23 -0800 300)         static int once = 0;
>
> commit 6ca2edb045895bbcbf116d19492c43949104956e
> Author: Wes Hardaker <opensource at hardakers.net>
> Date:   Wed Dec 19 18:58:23 2012 -0800
>
>     Rewrite the EOF parser to at least warn on an EOF at an EOL
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libreswan.org/pipermail/swan/attachments/20130108/9592ed83/attachment.html>


More information about the Swan mailing list